Jump to content
Sign in to follow this  
1para{god-father}

Spawn distance from pos

Recommended Posts

OK need some more advice please !

I have spawned a vehicle that driver around some WP around the map, once it get destroyed I would like to spawn in a group of men to start an ambush , I know I can get the position of the vehicle

But how can I then spawn them a good distance away from that position and attack i.e Seek & Destroy

Thanks

Share this post


Link to post
Share on other sites

Make a marker and setMarkerPos it to whereever the vehicle got destroyed with more code. Then do

_dest = markername;
_dir = random 359; //OR the direction you want to be
vehiclename setPos [(getMarkerPos _dest select 0)-[color="Red"]100[/color]*sin(_dir),(getMarkerPos _dest select 1)-[color="Red"]100[/color]*cos(_dir)];

Where the red variable is how you change your distance from the vehicle.

Share this post


Link to post
Share on other sites

Try this mate....

Where:-

_veh is the vehicle

_ang is the direction you want them to come from.

_dis is how far out you want them to start

_ang = random 360;   //if you want a random direction

_dx = sin([b]_ang[/b])*[b]_dis[/b];
_dy = cos[b](_ang[/b])*[b]_dis[/b];

[b]_newpos[/b] = [((getpos [b]_veh[/b]) select 0) + _dx, ((getpos [b]_veh[/b]) select 1) + _dy, 0];

_newpos is your new position [x,y,z]

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

Guys you are all great, love this community always so helpful !

Another question I can get BIS_fnc_spawnGroup working with a marker but not with x,y,z where am i going wrong ?

_positionToSpawnIn = [getPos _vehicleambush select 0, (getPos _vehicleambush select 1) + 30,0];
hint str _positionToSpawnIn;
_grp = [getPos _positionToSpawnIn, east, _enemyCount] call BIS_fnc_spawnGroup; 

Opps sorry worked it out did not need getpos !!

Thanks guys !

Edited by psvialli
Worked it out

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
Sign in to follow this  

×