Jump to content
Sign in to follow this  
Ice_Rhino

Simple Way to Count Units Alive

Recommended Posts

Is it possible and if so how, to count the amount of remaining enemies within a trigger area and display the result?

Thanks in advance

Share this post


Link to post
Share on other sites
_aliveInTrigger = {[triggerName, _x] call BIS_fnc_inTrigger && side _x == opfor && alive _x} count AllUnits;
hint format ["There are %1 bad dudes alive in the trigger", _aliveInTrigger];

Edited by kylania

Share this post


Link to post
Share on other sites

Thanks kylania, Where do I place the code and how does it fire, Radio Call??

Share this post


Link to post
Share on other sites

Depends on when you want it to run I guess. When and how should you see this count get displayed?

Share this post


Link to post
Share on other sites

I tried to put it into an OPFOR Present Repeat trigger but it keeps coming up missing ;

Share this post


Link to post
Share on other sites

Ice, it won't work as shown above as there a local variables in a public space.

remove all the _ from the front of the aliveInTrigger

Share this post


Link to post
Share on other sites

Oops, was missing a = in there. and the _ local variable thing KevsnoTrev mentioned :)

Share this post


Link to post
Share on other sites

You have both lost me now. I understand the remove _ from in front of the aliveInTrigger obviously nut the a= I don't get?

Share this post


Link to post
Share on other sites

OK, working in a trigger, however it says that there 0 units in the trigger area when there are about 25 opfor present

Share this post


Link to post
Share on other sites

Perfect, thanks KYL. One last question, what trigger parameters would you use in order to get this to display say every minute. I tried a repeat OPFOR present but that does nothing so at the moment it is on OPFOR detecting BLUFOR which is not ideal.

Thanks

Share this post


Link to post
Share on other sites

I wouldn't put it in a trigger, I'd run it from a script as it was originally written. Just a while true, that code, then sleep 60. :)

Share this post


Link to post
Share on other sites

Question: Is there an equally powerful command like " BIS_fnc_inTrigger" to determine the amount of enemy units that exist within a given marker?

Share this post


Link to post
Share on other sites

The exact same command. :)

["someMarker", unitObject] call BIS_fnc_inTrigger;

Share this post


Link to post
Share on other sites
The exact same command. :)

["someMarker", unitObject] call BIS_fnc_inTrigger;

I assumed because I was receiving a "0" count when entering a marker name that the command "BIS_fnc_inTrigger" was only for triggers only.

Thank you Kylania!

Share this post


Link to post
Share on other sites

KYL. how would I do that then and only count the guys within the specific trigger area?

Edited by Ice_Rhino

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  

×