Jump to content
Sign in to follow this  
Bahger

Request for code: >50% of all BLUEFOR units dead

Recommended Posts

I'd like to set a trigger declaring the mission a loss when >50% of all Blue forces are dead before the victory trigger fires, which is that no OPFOR remain in the "Victory" trigger zone. I assume I'd put this code in the trigger condition window of "Lose" type trigger. I don't want the mission to end, necessarily, I just want to send the player a message, unless there's a better solution. Can anyone advise?

Share this post


Link to post
Share on other sites

I assume you have put the activation of the trigger to blufor. If so, give this a shot in the condition field:

({!alive _x} count thislist) > ({alive _x} count thislist)

And then write like

hint "You are losing badly";

in the on activation field.

Share this post


Link to post
Share on other sites

Well, you'd have to also make sure your living units are activating the trigger.

If units aren't created during the mission, you could just count them at the start, and then check if the number of currently alive units is less than 50% of the original count. Something like:

_blueforCount = {(side _x) == WEST} count allUnits;
waitUntil {{((side _x) == WEST) && (alive _x)} count allUnits} < (0.5 * _blueforCount)};

To save running over all units, you could create an array of all bluefor units and use that instead of allUnits.

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  

×