Jump to content

Recommended Posts

Hello

How to create a waypoint for a vehicle that would be a random point and act as a loop. As long as the vehicle is alive.

Must working on each map.

The waypoint should not go into the water.

Share this post


Link to post
Share on other sites

 

You have to set the expression of the last waypoint:

https://community.bistudio.com/wiki/setWaypointStatements

 

that waypoint should find a suitable position (without water) with:

https://community.bistudio.com/wiki/BIS_fnc_findSafePos

 

and it should add the new waypoint on the prior found position:

https://community.bistudio.com/wiki/addWaypoint

 

you can use this to find a random initial position for BIS_fnc_findSafePos:

https://community.bistudio.com/wiki/random

 

  • Like 1

Share this post


Link to post
Share on other sites

This is a bit unfinished, but somehow this is how it should go?

 

_Pos_1 = SP_Mission_Pos;

_Spawn_Height = 0.35; //The vehicle may be born underground

_Group_Crew = createGroup SP_Missions_Enemy_Side;

 

//Create vehicle

_ConvoyVehicle_1 selectRandom SP_Convoy_Vehicle_Array;

SP_Vehicle_1 createVehicle [_ConvoyVehicle_1, _Pos_1, [], 0, "None"];

SP_Vehicle_1 setPosATL [getPosATL SP_Vehicle_1 select 0, getPosATL SP_Vehicle_1 select 1, _Spawn_Height];

SP_Vehicle_1 engineOn true;

 

_Seats_Number = [_ConvoyVehicle_1, true] call BIS_fnc_crewCount;

_Seats_Number_Crew = [_ConvoyVehicle_1, false] call BIS_fnc_crewCount;

 

for "_x" from 1 to _Seats_Number_Crew do

{

    _Unit_Crew = _Group_Crew createUnit [SP_Civilian_Array select floor (random count SP_Civilian_Array), _Pos_Spawn, [], 0, "None"];

    [_Unit_Crew] joinSilent _Group_Crew;

    _Unit_Crew moveInAny SP_Vehicle_1;

    (leader _Unit_Crew) setSkill 1; 

};

 

_Safe_WP_1 = [_Pos_1, 1, worldSize, 3, 0, 20, 0] call BIS_fnc_findSafePos;

 

_RandomWaypoint = SP_Vehicle_1 getpos [_Safe_WP_1, random 360];

_WP1 = _Unit_Crew addWaypoint [(_RandomWaypoint), 0];

_WP1 setWaypointSpeed "NORMAL";

_WP1 setWaypointBehaviour "SAFE";

_WP1 setWaypointCombatMode "BLUE";

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×