Jump to content
Sign in to follow this  
fatty86

Counting all units in a trigger area - including those in vehicles

Recommended Posts

I'm trying to set up a trigger to fire when all BLUFOR units are within the trigger area. Here's what I've got:

Trigger BLUFOR PRESENT, condition:

((count thisList) == ({alive _x && side _x == west} count allUnits))

The trouble I'm having is this. It appears count thisList is counting all units in a BLUFOR helicopter as one single unit. So, say I have 10 guys on the ground, and 3 in a helicopter. It's treating the three helicopter guys as one unit, so 10+1=11.

However, the count allUnits is returning EVERY BLUFOR man still alive, which is the full 13.

The difference is that count allUnits treats each guy - including those in the helicopter - as an individual unit.

How do I get the two to see 'eye to eye' and count each unit the same?

Share this post


Link to post
Share on other sites

my brain is kindof fried now, but crew command also works on man units correctly returning 1, this is probably the key to get it to work.

will look at this again with fresh eyes sometime tomorrow.

Edit:

cant figure out a way to acomplish this in trigger only atm. only workaround i see is using a script and manually add crew count foreach vehicles to list, but thats not what you are after.

then again, a trigger is same as a waitUntil command so the difference is nothing afaik.

Edited by Demonized
added edit.

Share this post


Link to post
Share on other sites

I'd settle for any other way to get the trigger to fire when all units of a given side are within its area.

Share this post


Link to post
Share on other sites

I'm sure there is a nice neat way of doing it but all I can come up with is this using two triggers.

in a unit or game logic place ftrig=true

Trigger One

BLFOR Present

Repeating

cond ftrig

on act many=0;{{many=many+1} forEach units _x } forEach thislist;ftrig=false

on dea ftrig=true

Trigger Two

0 0 size

cond ((many) == ({alive _x && side _x == west} count allUnits))

on act hint format [" %1","all here"];

The first trigger counts all the units in the trigger even those in vehicles.

The second trigger looks to see if the number found in trigger one matches the total of allunits.

ftrig is just used to force trigger one to repeat, you could add some delay time so it's not checking every 0.5 seconds.

Share this post


Link to post
Share on other sites

yeah i did not get it to work in a single condition in single trigger either, using scripts or double triggers works...

Share this post


Link to post
Share on other sites
{alive _x && side _x == WEST && vehicle _x in thislist} count allunits == {alive _x && side _x == WEST} count allunits

Share this post


Link to post
Share on other sites

so simple lol put this in trigger and activate by radio alpha

hintC format["There are %1 units on this map.", count allUnits];

Share this post


Link to post
Share on other sites
so simple lol put this in trigger and activate by radio alpha

hintC format["There are %1 units on this map.", count allUnits];

This does not solve the problem at all.

Share this post


Link to post
Share on other sites
This does not solve the problem at all.

Why don't you just put a vehicle with two crewmen and two single infantry men (including player) on the map and see if

hintsilent format["There are %1 units on this map.", count allUnits];

returns 4?

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  

×