[] 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]];
};