Jump to content
Sign in to follow this  
lawman_actual

Track number of units in an area

Recommended Posts

Hey

 

 

 

I need a way to fire a trigger any time ANY blueFor unit enters or exits an area regardless of if there's one already in it. And of  course the reverse for opFor.

 

I've just spent a while modifying my scripts to run on the basis that a variable gets +1 each time a US unit enters the area, or -1 each time CSAT enter the area.

Similarly, each time a US unit leaves the area, it gets -1, and each time CSAT leave it gets +1.

 

So in the end, when there are no units present the variable is neutral (at 0).

When there are more US units it will be positive (the number reflective the number of units) and the opposite for CSAT.

 

 

Trouble is, I then went back to the game and remembered that my triggers don't work like that.

 

Oops.

 

Share this post


Link to post
Share on other sites

The following should help you with your issue:
Handle units entering and leaving an area
 
This script will always act as soon as the units activating the trigger have changed, either by amount or if it's not the exact same units in "thisList" of the trigger.
You can do anything inside the two forEach loops inside that script or you can simply count the arrays and do something with those numbers.

 

Have a nice Play!

Johnny

  • 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
Sign in to follow this  

×