Jump to content

Recommended Posts

Hello! im trying to make a script that spawns 1-3 helicopters on a random location on a map and they starts to patroling.

what i have so far is this :

_vehicle = createVehicle [ "B_Heli_Light_01_F", player getPos[ 100, getDir player ], [], 0, "FLY" ]; createVehicleCrew _vehicle;

this is spawning it in the air but i cant seem to find anything  that makes it spawn random, this makes it spawn over the player head. i know that BIS_fnc_randomPos exists but cant seem to get it to work.

i also need the  script to add " [group _unit, getPos _unit, 1000] call BIS_fnc_taskPatrol; " to the helicopters init field to make it start patroling.

and maybe if we are pushing it, maybe having to loiter a little around each waypoint 

 

i feel like i got almost all the pieces to the puzzle but have lost my glasses so i cant put it together...

 

i hope you guys can help.

 

 

 

Share this post


Link to post
Share on other sites

No, you can't script that as is in init field of a spawned helo, but you can make it simple:
 

private _vehicle = createVehicle ["B_Heli_Light_01_F",player getPos[ 100, getDir player ],[],0,"FLY"];
private _grp = createVehicleCrew _vehicle;
[_grp,getPos leader _grp,1000] call BIS_fnc_taskPatrol;

 

Share this post


Link to post
Share on other sites
On 12/16/2022 at 4:20 PM, pierremgi said:

No, you can't script that as is in init field of a spawned helo, but you can make it simple:
 


private _vehicle = createVehicle ["B_Heli_Light_01_F",player getPos[ 100, getDir player ],[],0,"FLY"];
private _grp = createVehicleCrew _vehicle;
[_grp,getPos leader _grp,1000] call BIS_fnc_taskPatrol;

 

so if i run that script it will spawn a light helo and it will start patroling using the BIS_fnc_taskPatrol ?

but how do i get it to spawn on a random location on the map ?

Share this post


Link to post
Share on other sites
11 hours ago, Waoonet said:

but how do i get it to spawn on a random location on the map ?

 

You can:

- randomize some defined  markers' positions: private _pos =  getMarkerPos selectRandom ["mk1","mk2",....,"mkn"];  // if you place and name n markers on map.

- randomize around player's position:  _pos = player getPos [sqrt random 1 * 300, random 360 ]  // for an area with 300m radius.

- randomize anywhere on map:  _pos = [random worldSize, random worldSize,0]

- randomize locations: _pos =   locationPosition  selectRandom (nearestLocations [getpos player, ["NameVillage", "NameLocal","NameCity","NameCityCapital","NameMarine"], 1000]);

 

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

×