Page MenuHomeFeedback Tracker

BIS_fnc_spawnGroup creates AI with skill 1 by default
Closed, ResolvedPublic

Description

I found that when BIS_fnc_spawnGroup is called with no skill parameter, then the AI skill is always 1.

A suggestion would be to generate a random skill setting between 0.1-1 on every generated unit within the group. Maybe should createUnit (array), which is used within BIS_fnc_spawnGroup, also use a default setting of 0.5. {F21367} {F21368}

Details

Legacy ID
48221295
Severity
None
Resolution
Fixed
Reproducibility
Always
Category
Scripting
Additional Information

Basically every popular COOP mission in A3 MP is currently using BIS_fnc_spawnGroup; I would bet something that it's the cause that many players complain about inhumanly AI skills.

Event Timeline

Fireball edited Steps To Reproduce. (Show Details)Aug 12 2013, 1:57 AM
Fireball edited Additional Information. (Show Details)
Fireball set Category to Scripting.
Fireball set Reproducibility to Always.
Fireball set Severity to None.
Fireball set Resolution to Fixed.
Fireball set Legacy ID to 48221295.May 7 2016, 3:59 PM
Fireball edited a custom field.

yes the skill of the unit is 1 but my difficulty says it should be 0.75 on regular.

Sorry, I should have been clear, that this ticket is about multiplayer.

I'll attach a repro mission.

EDIT: Mission file attached, repro works for me in SP and MP.

If this is not the true skill of the AI, then it would be interesting to know how to visualize it - else we have no chance of knowing what the effective skill is.

I've seen this too (beta branch as of 08/18), i wouldn't have guessed BIS_fnc_spawnGroup was the culprit. I also noticed the function was ignoring the direction to spawn the group to as input by the 8 parameter.

Edit: on closer inspection of the function, the thing is that the azimuth is indeed set for the individual unit, but the whole group will keep a northbound azimuth.

temporary fix of the azimuth issue:

[code]
private ["_relPos"];
_relPos = _positions select _i;
_relPos = [_relPos, 360 - _azimuth] call BIS_fnc_rotateVector2D; // added line
_itemPos = [(_pos select 0) + (_relPos select 0), (_pos select 1) + (_relPos select 1)];
[/code]

Edit 2:

only to add that the currently the function does:
_unit = _grp createUnit [_type, _itemPos, [], 0, "FORM"];

which suggests an array type creation, and in wiki:
Object = group createUnit [type, position, markers, placement, special]

which suggests that the parameter 3 is placement radius ("0" in the function) not skill as per the normal alternative creation method.

Edit 3 (temp fix until the createUnit function in array mode does not mess with the skill):

[code]
_unit = _grp createUnit [_type, _itemPos, [], 0, "FORM"]; commented out
_type createUnit [_itemPos, _grp]; using old mode
_unit = (units _grp) select ((count units _grp) - 1);
fetching the unit from group
_unit setDir _azimuth;
[/code]

What a pain in the ass this issue is. Currently it is game breaking, because A.I. with 1.0 skill are super precise.

^^ in the meanwhile try the attached fn_spawnGroup_patched.zip and call the function with

[code]
spawnGroup_patched = compile preProcessFileLineNumbers 'fn_spawnGroup_patched.sqf';
_group = [params] call spawnGroup_patched;
[/code]

it solves mentioned bugs

oukej added a subscriber: oukej.May 7 2016, 3:59 PM

Mass-closing resolved issues updated only last year - assuming fixed correctly.

Cheers!