Jump to content
Sign in to follow this  
Espectro (DayZ)

Counting units

Recommended Posts

Hi all. I have a problem.

In my mission (multiplayer coop) a group of members needs to board a chopper, which then flies them off to an objective... I use this to see when all members are in the chopper:

"_x in heli" count units team == west countside units team

This works fine until the AI gets disabled in the lobby.... So it isnt working if not all 10 (which is maxplayers for the mission) is there!! buhuuu. can u help me?

Group name is "team" and choppername is "heli"

Share this post


Link to post
Share on other sites

Well, here's the way, i'm doing that in mp missions:

:note - if you have a whole playable squad, where

even the squad leader can be disabled from the lobby,

you can't use the leaders init field to specify the name

for the group.

Therefore i'm always using a trigger, covering only the

playable squad.

e.g: west/present

condition: this

activation:

myleader = thislist select 0; mygroup = group myleader

Now you can use the following condition, to check if the

whole group is onboard:

"_x in heli" count (units mygroup) == count (units mygroup)

~S~ CD

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Espectro @ Sep. 16 2002,17:41)</td></tr><tr><td id="QUOTE">In my mission (multiplayer coop) a group of members needs to board a chopper, which then flies them off to an objective... I use this to see when all members are in the chopper<span id='postcolor'>

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_teamlist=units team

_unitsarray=+_teamlist

_n=0

_count=count _teamlist

#loop

   _unit=_teamlist select _n

   _n=_n+1

   ?not(alive _unit):_unitsarray=_unitsarray-[_unit]

?(_n < _count):goto "loop"

_unitsinchopper=crew heli

_unitsoutside=_unitsarray-_unitsinchopper

_count=count _unitsoutside

?(_count==0):teaminchopper=true<span id='postcolor'>

If all living (!) team members are inside the chopper, then the boolean variable teaminchopper is set true - just use a trigger to unlock the waypoint once this variable is set. Works fine in my coop missions.

Share this post


Link to post
Share on other sites

Why doing it complicated Joltan?

In my sample, i compare the actual number

of units from that group in the chopper with

the actual count-result of units in that group.

You don't need to add or remove units from an

extra array here.

Also the trigger, which i use to specify the group leader

and the groupname, doesn't use any performance for the

reason it's a one-time-runner at the start of the mission.

~S~ CD

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (DV Chris Death @ Sep. 16 2002,18:42)</td></tr><tr><td id="QUOTE">Why doing it complicated Joltan?<span id='postcolor'>

Because dead units can't enter a chopper, but are still members of the team... units team will always return all units present at game start, including those that died inbetween - so you would be stuck if any unit dies before you take off.

If you are sure there are no dead team members and readability isn't of any importance, all could be condensed to one single line:

?((count ((units team)-(crew heli)))==0):teaminchopper=true

You could even use a trigger instead of a script

As it is unfortunately quite often the case that someone dies right at the start on public servers (either a noob/someone killed by a noob, or the ai of someone who ghosted getting killed by the other players), I've found the need to take this into consideration. I usually use a loop that waits several seconds inbetween checking for the condition to be met - that way it doesn't burden the server much.

Share this post


Link to post
Share on other sites

Joltan, i'm sure it has been working in my last mission

with that method i suggested (even if some members

of the group were killed).

Once i'm back home from work, i'll test it again and

post the result in here.

~S~ CD

Share this post


Link to post
Share on other sites

OK Joltan,

I've tried it again, and it still works.

I've placed a group (w1grp)

Then i've created a repeatable radio call, which displays

the number of units in this group. (hint format ["%1",count (units w1grp)]

Then i started, hit the trigger, result was 10.

Then i killed one of the guys (*snief*), hit the trigger

again, and the result was 9.

~S~ CD

Share this post


Link to post
Share on other sites

i think what joltan is trying to say if you have 5 units and 1 is dead but not detected dead (OH NO 4 IS DOWN) Thats where the problem starts wink.gif

BTW im thinking thats what he's on about anyway tounge.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">i think what joltan is trying to say if you have 5 units and 1 is dead but not detected dead (OH NO 4 IS DOWN) Thats where the problem starts <span id='postcolor'>

Yeah, but then there comes the countside command to be

helpful. When using west countside, only living units will be

counted (even if dead ones weren't detected yet).

"_x in heli" count (units mygroup) == west countside (units mygroup)

~S~ CD

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  

×