Crew is not following waypoints when spawned using BIS_fnc_spawnCrew {F26468}
Description
Description
Details
Details
- Legacy ID
- 4245885059
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Category
- AI Issues
Steps To Reproduce
Included repro mission, mission init below.
Additional Information
- spawn { player setCaptive true; sleep 3; private ["_vehicleClassname", "_vehicle", "_vehiclePosition", "_crew", "_group", "_initialWaypointIndex", "_noOfWaypoints", "_wpPosition1", "_wpPosition2", "_wpPosition3", "_waypoint"]; _vehicleClassname = "B_APC_Wheeled_01_cannon_F"; _vehiclePosition = getPosATL player; _vehiclePosition set [0, (_vehiclePosition select 0) + 10]; _vehiclePosition set [1, (_vehiclePosition select 1) + 10]; _vehicle = createVehicle [_vehicleClassname, _vehiclePosition, [], 0, "NONE"]; createCenter west; -------------------------------- Crew is not following waypoints when spawend with BIS_fnc_spawnCrew _group = createGroup west; _crew = [_vehicle, _group, false, "", "B_crew_F"] call BIS_fnc_spawnCrew; // -------------------------------- _initialWaypointIndex = 0; if (count waypoints _group > 0) then { _initialWaypointIndex = (count waypoints _group) - 1; }; _wpPosition1 = getPosATL player; _wpPosition1 set [0, (_wpPosition1 select 0) + random 200]; _wpPosition1 set [1, (_wpPosition1 select 1) + random 200]; _wpPosition2 = getPosATL player; _wpPosition2 set [0, (_wpPosition2 select 0) + random 200]; _wpPosition2 set [1, (_wpPosition2 select 1) + random 200]; _wpPosition3 = getPosATL player; _wpPosition3 set [0, (_wpPosition3 select 0) + random 200]; _wpPosition3 set [1, (_wpPosition3 select 1) + random 200]; _waypoint = _group addWaypoint [_wpPosition1, 0]; _waypoint setWaypointType "MOVE"; _waypoint setWaypointBehaviour (["AWARE", "SAFE"] select (floor random 2)); _waypoint setWaypointCombatMode "RED"; _waypoint = _group addWaypoint [_wpPosition2, 0]; _waypoint setWaypointType "MOVE"; _waypoint setWaypointBehaviour (["AWARE", "SAFE"] select (floor random 2)); _waypoint setWaypointCombatMode "RED"; _waypoint = _group addWaypoint [_wpPosition3, 0]; _waypoint setWaypointType "MOVE"; _waypoint setWaypointBehaviour (["AWARE", "SAFE"] select (floor random 2)); _waypoint setWaypointCombatMode "RED"; [_group, (count waypoints _group) - 1] setWaypointStatements ["true", format["(group this) setCurrentWaypoint [group this, %1]", _initialWaypointIndex]];
};
Event Timeline
Comment Actions
Although the code is correct, it seems it's assigning the waypoints before the crew have been initialized.
Solution is a small delay just after the BIS_fnc_spawnCrew;
_crew = [_vehicle, _group, false, "", "B_crew_F"] call BIS_fnc_spawnCrew;
sleep 0.2;