Jump to content
Sign in to follow this  
Recon1

TRIGGER SPAWN AI HELP

Recommended Posts

OK i just stared making maps so I need help in the trigger spawning AI's i dont want to spawn to many at the time it lags the game so if anyone can help it would be great oh and I dont care about waves or respawning ai just to spawn them ones

thanks Recon1

Share this post


Link to post
Share on other sites

ravennx set up something very similar to what I think you're after so check out this post here m8:

http://www.flashpoint1985.com/cgi-bin....t=65117

Just to simplify his code a bit:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;AI spawn script adapted from ravennx

group1 = createGroup east

group1 createUnit ["SoldierESniper",getMarkerPos "ai", [], 0, "FORM"]

~0.2

group1 createUnit ["SoldierAT",getMarkerPos "ai", [], 0, "FORM"]

~0.2

group1 createUnit ["SoldierEB",getMarkerPos "ai", [], 0, "FORM"]

~0.2

group1 createUnit ["SoldierEMG",getMarkerPos "ai", [], 0, "FORM"]

~0.2

group1 createUnit ["SoldierESniper",getMarkerPos "ai", [], 0, "FORM"]

~0.2

group1 createUnit ["SoldierAT",getMarkerPos "ai", [], 0, "FORM"]

~0.2

group1 createUnit ["SoldierEB",getMarkerPos "ai", [], 0, "FORM"]

~0.2

group1 createUnit ["SoldierEMG",getMarkerPos "ai", [], 0, "FORM"]

_waypoint0 = group1 addWaypoint [getMarkerPos "wp", 0]

_waypoint0 setWaypointType "SAD"

Just make a file in your mission directory called something like spawn.sqs and copy across this code.

Then create a trigger (eg. BLUFOR present) and in the OnAct line put

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "spawn.sqs";

the only other thing would be to put a short sleep between each createUnit line in the code (eg add a line and ~2 as above) as this should reduce strain on the server when the units spawn.

Finally you'll need to place a couple of markers in the editor to get this code to work one called ai (where the units will spawn) and second called wp where the spawned units will move to.

Share this post


Link to post
Share on other sites

it works great lol now i have to find a way to change it from opfor to mercs and make them bad

thanks Recon1

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  

×