Jump to content
sariel

Check if unit exists

Recommended Posts

Hi there,

 

does anybody know how to check if a unit exists?

i have set a group of 5 units. i named them unit1, unit2, unit3, ...

 

i have done this to play the mission with 5 people or less.

when there are less than 5 players ai will be disabled.

in a helicopter extraction i have set the condition for a waypoint to:

((!alive unit1) OR (unit1 in heli)) AND ((!alive unit2) OR (unit2 in heli)) AND ((!alive unit3) OR (unit3 in heli))

but this will only work if all units exist. so i need a way to check if the unit is present.

 

thanks for your help.

sariel

Share this post


Link to post
Share on other sites

thanks @Grumpy Old Man looks great! :)

can you tell me how to count all players in the heli too?

 

and:

does

!(_unit isEqualTo objNull)

work with _unit1, _unit2, ... or did i miss something there?

Share this post


Link to post
Share on other sites

If you named your units unit1, unit2 etc then use that instead _unit.

 

To get the number of players inside a chopper do this:

{isPlayer _x} count crew MyChopperName;

Will return 0 if no player is in the chopper.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

"count" is probably one of the most useful and at the same time most underestimated commands out there. :D

  • Like 1

Share this post


Link to post
Share on other sites

"count" is probably one of the most useful and at the same time most underestimated commands out there. :D

Probably one of my most favorite commands, next to the new alternative syntax of select.

Then there's apply and of course not to forget the glorious params.

 

Quite a treat these new commands.

 

Cheers

  • 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

×