Jump to content
Sign in to follow this  
-duke-

Spawning AI Squads via Trigger when X Units alive

Recommended Posts

If I haven't confused you with the title, I'm sure I'll be able to do so in my description.

Essentially, I'm currently working on a MP Mission where I have a need to keep AI fighting one another continually in the background. Irregardless of where you are in the mission, there is always fighting and something to do, its pretty fun really.

Currently I have approx. 5 Blufor Squads and 6 Opfor Squads on mission load and they are configured to spawn replacement squads when killed via Triggers such as follows:

Condition: ({not alive _x} count units BLSquad1) == count units BLSquad1 && ({not alive _x} count units BLSquad2) == count units BLSquad2;

On Activation: Friendly12= [(getpos city),west,12] call bis_fnc_spawngroup; wp = Friendly12 addwaypoint [position city3, 0]; wp setwaypointtype "MOVE"; wp setwaypointspeed "Limited"; wp setwaypointbehaviour "Combat"; hint "Spawning from BLSquad1, BLSquad2, Combined"

I have some existing markers in key locations that allow for the units to advance on one another.

BTW, my apologies if the code doesn't look very good, I'm still very much trying to wrap my head around how to actually achieve things. Much of what I got is cut and pasted from browsing this forum and others online as well as the Biki.

BTWx2, I always use hint to make sure my triggers are at least activating. It may be n00bie but it's all I got. :o

The above works actually rather well but there are times when squads can overlap upon respawn and you notice it rather drastically in FPS for about 5 seconds or so. You can also hit choke points now and again where FPS can literally be cut in half if there are both a number of units close by and overlapping trigger based respawns.

It occurred to me that it may be a much better idea to spawn squads when a Repeating Trigger counts a number less than X but I'm just not educated enough to make this happen.

Essentially, I'd like the Trigger to keep running and only add squads when Opfor (for example) has less than 50 alive units.

Does anyone have any insight on the matter?

BTW, thanks for taking the time to read. I did look around a fair bit before posting but really didn't see anything that would suit this particular need.

Share this post


Link to post
Share on other sites

Essentially, I'd like the Trigger to keep running and only add squads when Opfor (for example) has less than 50 alive units.

condition

({alive _x && side _x == east} count thisList) < 50

on activation

Friendly12= [(getpos city),west,12] call bis_fnc_spawngroup; wp = Friendly12 addwaypoint [position city3, 0]; wp setwaypointtype "MOVE"; wp setwaypointspeed "Limited"; wp setwaypointbehaviour "Combat"; hint "Spawning from BLSquad1, BLSquad2, Combined"

Edited by cobra4v320

Share this post


Link to post
Share on other sites

Thank you very much for the help cobra. I'll try the code either tonight or tomorrow and will respond on how it worked.

Cheers.

Share this post


Link to post
Share on other sites

So I played around with it a bit tonight and it worked like a charm.

Thanks again cobra :)

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  

×