Jump to content
SGT Major Ray Jefferson

creation of trigger condition

Recommended Posts

Hello, this is the first time I post on this forum.
I'm trying to create a trigger condition that activates when there are only 5 men left in the area for a given camp (independents)?
I had tried this in the condition of my trigger but it didn't work :
this && GUER countSide thislist == 5

Share this post


Link to post
Share on other sites

Hello, I think the question has already been answered by Iceman77, did you try this in trigger condition?

 

{alive _x && (side _x) == independent} count allUnits == 5

 

Source :

Cheers

Share this post


Link to post
Share on other sites

Well, I am not sure that you really need this in your condition. According to the docs, this in the condition field of the trigger is the boolean value of the activation condition chosen for the trigger (for example "East Not Present"). If I am not mistaken you don't really need this part unless you have other conditions you want to check for, which are taken care of by the trigger.

 

Otherwise, I believe that only the second part of the condition check should suffice. This would be

// Independent is an alias for GUER
(independent countSide thisList) isEqualTo 5

One thing that is not clear in the docs of countSide and has to be checked is whether the command counts dead units along with alive ones. It most probably does not but it's not always safe to assume things when coding, so please test that...

If the command counts dead units too you would have to filter them before performing the "comparison". This could be done like

private _allGuer = independent countSide thisList; // All independent units

_allGuer = {alive _x} count _allGuer; // Count alive units
_allGuer isEqualTo 5 // Check the number of alive independent units

This could also be one-lined, which personally I don't like, but for reference this would look like

({alive _x} count (independent countSide thisList)) isEqualTo 5

One more thing to note is that, depending on your needs, you may want to change the comparison test you make. To clarify, in case that the trigger is a garrisoned outpost and you want to call reinforcements when the independent units holding it reach 5 men strength, you may want to check for less than six instead of equal to five. This would allow you to avoid situations where the check of the trigger misses the five men. This could easily happen if there are six men left and two or three die from a grenade (or some other AoE attack).

Similarly, if independent are the ones attacking and you want to check when at least five of them have gone inside the outpost, you could check for greater than instead of equal to five men.

Just for reference, the first case would look like (with the assumption that countSide does not count dead units)

(independent countSide thisList) < 5

Please keep in mind that the code provided is NOT tested, so do test before assuming that it works as intended.

 

Hope this helps somehow. If it doesn't and/or want further help please don't hesitate to ask 🙂.

  • Like 2

Share this post


Link to post
Share on other sites

HOW TO MAKE THE MISSION END WHEN THERE ARE LESS THAN “X” TROOPS ON THE MAP

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

 

If the enemy is Opforce and I wish the mission to end when there are less than say 5 enemy remaining:

 

Set up a trigger to coverthe whole map

Activation is Opforce, Once and Present

In the condition type:   count  thislist  <  5

 

 

In your case, use independants instead of Opforce

 

  • Like 1

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

×