Home   Help Search Login Register  

Author Topic: counting units from two groups whether they are inside a vehicle or not...  (Read 1043 times)

0 Members and 1 Guest are viewing this topic.

Offline filth

  • Members
  • *
  • Who's the bad man?
here's the situation:

i'm using a modified condition line from a related topic to execute a new trigger which i want to fire when members of alpha and bravo group's numbers are down to 2.
the condition line is as follows: ({_x in thislist} count units alpha) + ({_x in thislist} count units bravo) < 3

this works perfectly as long as the group members are not inside a vehicle. the trouble is, there's a really good chance that they will be inside a vehicle when this trigger condition is met. and i have no idea which vehicle, as it's a multiplayer mission. so i can't use the condition lines in the thread i found in a search, started by surpher, as i won't know the name of the specific vehicles.

how can i modify the count unit condition to make sure the units are counted whether they're inside a vehicle or not? (and it needs to apply for any vehicle on the map)
i've been reading some other threads on counting units inside vehicles, and outside vehicles, but i can't seem to see a solution to counting the units in groups whether they're inside or outside at the same time. is there a way of doing this using this:

_all = [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16]
#loop
westalive = 0
"if (alive _x) then {westalive = walive + 1}" foreach _all;
? westalive == 0 : goto "westdead"
~5
goto "loop"
#westdead
~2
[] exec "alldead.sqs"
exit

this is a script i use (can't remember the author's name) for checking that members of the multiplayer environment are alive throughout the game and fires an end scene if everyone dies. is there a way to modify this maybe so that it fires when there are only 2 members left?

fingers crossed...

btw, i didn't want to start a new thread, because i posted this at the end of another recent thread, so this might count as a double post, but i apologise in advance if it's considered as such, it's just that i haven't managed to get a reply from the other post yet and i was concerned that seeing as i posted it after the thread had been resolved, that no-one was still registered for notifications to that thread.
« Last Edit: 29 Jun 2007, 13:09:34 by filth_merchant 101 »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
give this a go -

Code: [Select]
({vehicle _x in thislist} count units alpha) + ({vehicle _x in thislist} count units bravo) < 3
and look at vehicle in the comref for hints on why this should work. it being for multiplayer, it may not - no idea  :confused:

Offline filth

  • Members
  • *
  • Who's the bad man?
bedges... it works, you bloody genius, you. i feel at peace again. cheers buster!  :cool2: