cklymowsky 1 Posted April 2, 2018 HI All, I'm trying to get a group of soldiers that have entered the nearby vehicle to move the designated _randomSectorDestination. They manage to get in the vehicle, but don't head for their waypoint. I noticed if they are in a boat or a truck they seem to drive in a circle, and change steering wheel every few second. I can't figure out what's going wrong? Thanks in advance. Quote rivate ["_transportArray","_transport","_numberOfSeats","_numberOfUnits","_transportGroupArray","_wp"]; params ["_grp","_randomSectorDestination"]; _transportArray = []; _transport = objNull; _numberOfSeatsBefore = 0; _numberOfSeats = 0; _numberOfUnits = 0; _transportGroupArray = []; _numberOfUnitsInVehicle = 0; _wp = []; // Create array of all unclaimed transports 0.005 ms _transportArray = nearestObjects [leader _grp , ["Car","Tank","Air","Ship"], 250]; _numberOfUnits = {alive _x} count units _grp; { _numberOfSeatsBefore = (_x emptyPositions "cargo"); if ((isNull (_x getVariable ["claimed", grpNull])) and (_numberOfSeatsBefore >=_numberOfUnits) ) exitWith { _x setVariable ["claimed", _grp, true]; _grp addVehicle _x; _transport = _x; }; }forEach _transportArray; if (isNull _transport) exitWith {}; while {(count (waypoints _grp)) > 0} do { deleteWaypoint ((waypoints _grp) select 0)}; _wp = _grp addWaypoint [[(getPosATL _transport) select 0,(getPosATL _transport) select 1,((getPosATL _transport) select 2) + 2], 0]; //_wp = _grp addWaypoint [(getPosASL _transport), 0]; _wp setWaypointName format ["%1 with %2 seats",typeOf _transport, (_transport emptyPositions "cargo")] ; _wp setWaypointType "GETIN"; _grp SetSpeedMode "Full"; _grp SetCombatMode "YELLOW"; _grp SetBehaviour "AWARE"; [_grp, _transport] spawn BEAKS_fnc_AIRepairRearmFlip; //wait until all group has boarded or all seats are full inside waitUntil { sleep 0.1; _numberOfSeats = (_transport emptyPositions "cargo"); _numberOfUnits = {alive _x} count units _grp; _numberOfUnitsInVehicle = {(alive _x) and ((vehicle _x == _transport))} count units _grp; _wp setWaypointName format ["%1 with %2 seats left",typeOf _transport, _numberOfSeats] ; ((_numberOfSeats == 0) or (_numberOfUnitsInVehicle == _numberOfUnits)) }; while {(count (waypoints _grp)) > 0} do { deleteWaypoint ((waypoints _grp) select 0)}; if ( (_transport isKindOf "Ship") or (typeOf _transport == "B_Boat_Armed_01_minigun_F") or (typeOf _transport == "O_Boat_Armed_01_hmg_F") or (typeOf _transport == "B_Boat_Armed_01_minigun_F") or (typeOf _transport == "O_T_Boat_Armed_01_hmg_F")) then { {if ((_x getVariable 'owner') != AIside) then {_randomSectorArray pushBack _x}} forEach [sector1,sector2]; _randomSectorDestination = _randomSectorArray call BIS_fnc_selectRandom; _wp = _grp addWaypoint [_randomSectorDestination, 0]; _wp setWaypointType "GETOUT"; _wp setWaypointName str _randomSectorDestination; //_wp setWaypointBehaviour "AWARE"; //_wp setWaypointCompletionRadius 250; //_wp setWaypointSpeed "FULL"; {_x sideChat format ["%1 Anchors aweigh for %2 in %3", _wp, _randomSectorDestination, typeOf _transport]} forEach allPlayers; } else { // Move to original waypoint _wp = _grp addWaypoint [(getPosASL _randomSectorDestination), 0]; _wp setWaypointType "MOVE"; _wp setWaypointName str _randomSectorDestination; //_wp setWaypointBehaviour "AWARE"; //_wp setWaypointCompletionRadius 20; //_wp setWaypointSpeed "FULL"; }; waitUntil { sleep 0.1; if !(vehicle leader _grp != leader _grp ) then {[_grp,_randomSectorDestination] call BEAKS_fnc_transport}; // if _leader is not in a vehicle then find nearby transport to fit the entire group (((_randomSectorDestination getVariable 'owner') == (side _grp)) && (((leader _grp) distance _randomSectorDestination) <= 20))// TEST sector owner }; Share this post Link to post Share on other sites