Jump to content
mattjb

Help: counting dead units in trigger area

Recommended Posts

Is there a means to count the number of dead units in thisList for a trigger area's condition?

Trying, unsuccessfully, with something like: ({!alive _x} count thisList) > 0;

Does thisList only count alive units for some reason?

 

Note: Using ACE medical - not sure if this affects anything.

 

Share this post


Link to post
Share on other sites

Something like this maybe?

 

_Amount = 0;
{
	_Amount = _Amount + 1;
} count allDeadMen;

hint format ["%1 Dead!",_Amount];

 

Share this post


Link to post
Share on other sites

In a trigger area, as dead are civilian and you need to react the trigger:

place a trigger with your area, none,none, repeatable.

on condition field: isNil "trig1"                       (or any variable name you want)

on activation field: hintSilent format ["dead %1",{_x inArea thisTrigger} count allDeadMen]; trig1 = true

on deact. field: 0 = [] spawn {sleep 0.5; trig1 = nil};

 

Here, there is no consideration about side, just a trigger toggling condition true/false with a variable (trig1), to run the code each 0.5 sec.

 

 

 

Share this post


Link to post
Share on other sites

Your logic worked perfectly pierremgi, although I actually ended up taking it a step further in looking for a side-based area trigger for dead units (to simulate an alarm being pulled to trigger reinforcements without relying on eventhandlers) and came up with a combination that appears to be working:

 

Activation: OPFOR

Activation type: Present

{_x inArea thisTrigger && getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 0} count allDeadMen > 0;

Thanks for the help! :)

  • Thanks 1

Share this post


Link to post
Share on other sites
On 16/06/2017 at 10:55 PM, Tankbuster said:

You mean 'badly configured factions' ? :)

 

https://community.bistudio.com/wiki/BIS_fnc_objectSide

 

I think this function does more or less the same thing as your getnumber command

No, I mean it's easier to cope with 3 or 4 sides instead of 10 or 12 factions due to mods/addons.

And your BIS_fnc_objectSide is just using the getnumber... "side" code, with a possible variant of the actual group side. Nothing useful if you know why you're scripting this code instead of the side command ! (like for this dead men trigger).

  • 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

×