Jump to content
Sloppy Noodl3

Multiple groups not alive trigger?

Recommended Posts

Hello everyone I am not new to Arma but I am new to mission editing and I have no knowledge of scripting what so ever and I could really use some help. I am building a simple mission and one thing in particular has me confused.

I am trying to get a trigger to activate when multiple groups are dead. For example I am making a mission where you defend against multiple groups attacking your position. Once they are all dead I would like the trigger to activate. I have four groups with multiple units inside.

"tank" "tank2" "unit 1" and

"unit 2" are all groups.

 

At first I anticipated I would simply do the following.

 

(!alive tank1) && (!alive tank2) && (!alive unit1) & (!alive unit2) but this does not work for groups only units. I could technically do !alive for each unit within the 4 groups but I have well over 20 units so it seems excessive. Is there an easier way to just do all the groups?

I have read the article below on this topic but I still don't understand how exactly how to accomplish what I need. I feel the article below is complicated as I don't understand the context of jandrews mission.

Can anyone help me try to understand this concept in reference to my mission? Thanks so much guys.

 

 

Share this post


Link to post
Share on other sites

Your groups are made of units and vehicles. !alive  aVehicle means that the vehicle aVehicle is destroyed, as !alive myUnit means that myUnit is dead.

 

For your aim, you just have to check alive for each units of each group, no matter if a vehicle is damaged and empty.

 

So, I suggest you:

(units group1 + units group2 +....) findIf {alive _x} isEqualTo -1 

or, 2nd method:

{alive _x} count (units group1 + units group2 +....) isEqualTo 0

 

How does it work?

In first case, findIf will check the array composed by the units of your groups and will return the index (so >0) for the first alive guy, and will exit without checking the furthers. -1 means "no matching occurrence" (faster)

In the second case, you are just counting (at each occurrence for the trigger condition, so twice a second) for the alive condition on each unit of each group (slower).

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you so much it works. Also thanks for explaining how it works. If I ever find the time to learn how to script I will

know exactly why it works as well.

  • 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

×