Jump to content
Sign in to follow this  
acsriot

AI script to spawn at height

Recommended Posts

So I'm making an ALIVE mission , and I'm using the Nimitz Addon so I have all the players and supports spawning on the character. I usually like to add a AI spawn script and I have made this one

"B_recon_TL_F" createUnit [getmarkerpos "spawn", group player];

"B_recon_TL_F" createUnit [getmarkerpos "spawn", group player];

"B_recon_TL_F" createUnit [getmarkerpos "spawn", group player];

"B_recon_TL_F" createUnit [getmarkerpos "spawn", group player];

"B_recon_TL_F" createUnit [getmarkerpos "spawn", group player];

"B_recon_TL_F" createUnit [getmarkerpos "spawn", group player];

"B_recon_TL_F" createUnit [getmarkerpos "spawn", group player];

with a corresponding spawn marker and item with a add action , the trouble i'm having is how do I get the AI to spawn at the height of 18 so they don't just fall into the water

Share this post


Link to post
Share on other sites

Try this:

for [{_i=0}, {_i < 7}, {_i = _i + 1}] do {									// 7 determines amount to spawn
_unit = "B_recon_TL_F" createUnit [getMarkerPos "spawn", group player];
_unit setPos [getPos _unit select 0, getPos _unit select 1, 18];				// 18 determines height
};

It's a bit more efficient (not that you'll notice any performance increase, it's just good practice not to repeat code) and should do what you want.

Share this post


Link to post
Share on other sites

dosen't seem to work =/ only spawns 1 and still spawns at standard 0 height

Share this post


Link to post
Share on other sites

use this for height difference - setPosATL

as for not spawning stick a 0.5 sleep in to check - or randomise their position when spawing -

for [{_i=0}, {_i < 7}, {_i = _i + 1}] do { // 7 determines amount to spawn

_unit = "B_recon_TL_F" createUnit [getMarkerPos "spawn", group player];

_unit setPosATL [(getPosATL _unit select 0) + _i, getPosATL _unit select 1, (getPosATL _unit select 2) + 18];

sleep 0.5;

};

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  

×