Jump to content
Sign in to follow this  
Phantom Six

Helo Extraction Help (check unit if true instead alive)

Recommended Posts

I'm having a problem with my map. My condition is

((!alive unit1) OR (unit1 in helicopter)) AND ((!alive unit2) OR (unit2 in helicopter)) AND ((!alive unit3) OR (unit3 in helicopter)) AND ((!alive unit4) OR (unit4 in helicopter)) AND ((!alive unit5) OR (unit5 in helicopter)) AND ((!alive unit6) OR (unit6 in helicopter)) AND ((!alive unit7) OR (unit7 in helicopter)) AND ((!alive unit8) OR (unit8 in helicopter))

and then helicopter would take off if this condition is met. Problem is, what if all slots were not taken and there are no players for that area. What it means is instead of whether the unit is dead or alive, cannot be determines and I need to replace !alive with a syntax that determines whether the unit exist or not.

Plus I also use a revive script so no one is really going to be dead or alive.

Does anyone know what the command is for whether unit exist or not and what do I put for condition instead?

Share this post


Link to post
Share on other sites

if (isNull unitname) then {hint "unitname object does not exists"};

{!isNull _x AND (!alive _x OR _x in helicopter)} foreach [unit1, unit2, unit3, unit4, unit5, unit6, unit7, unit8];

think above condition should work.

it checks if unit is really an object, and if its either dead or in helicopter for all units in last array.

Edited by Demonized

Share this post


Link to post
Share on other sites

hmm the PHP Code you send me give me a Type Nothing, excepted Bool error but ummm, will this work.

((!alive unit1) OR (!isNull unit1) OR (unit1 in helicopter)) AND ((!alive unit2) OR (!isNull unit2) OR (unit2 in helicopter)) AND ((!alive unit3) OR (!isNull unit3) OR (unit3 in helicopter)) AND ((!alive unit4) OR (!isNull unit4) OR (unit4 in helicopter)) AND ((!alive unit5) OR (!isNull unit5) OR (unit5 in helicopter)) AND ((!alive unit6) OR (!isNull unit6) OR (unit6 in helicopter)) AND ((!alive unit7) OR (!isNull unit7) OR (unit7 in helicopter)) AND ((!alive unit8) OR (!isNull unit8) OR (unit8 in helicopter))

Tried a little test with that on my friend's test map but without the !alive unit. Doesn't work with the !isNull

Edited by Phantom Six

Share this post


Link to post
Share on other sites
hmm the PHP Code you send me give me a Type Nothing, excepted Bool error but ummm, will this work.

((!alive unit1) OR (!isNull unit1) OR (unit1 in helicopter)) AND ((!alive unit2) OR (!isNull unit2) OR (unit2 in helicopter)) AND ((!alive unit3) OR (!isNull unit3) OR (unit3 in helicopter)) AND ((!alive unit4) OR (!isNull unit4) OR (unit4 in helicopter)) AND ((!alive unit5) OR (!isNull unit5) OR (unit5 in helicopter)) AND ((!alive unit6) OR (!isNull unit6) OR (unit6 in helicopter)) AND ((!alive unit7) OR (!isNull unit7) OR (unit7 in helicopter)) AND ((!alive unit8) OR (!isNull unit8) OR (unit8 in helicopter))

Tried a little test with that on my friend's test map but without the !alive unit. Doesn't work with the !isNull

Hey, it's too tired to type such long code, try to use forEach syntax.

Share this post


Link to post
Share on other sites
{alive _x && _x in helicopter} count playableunits == {alive _x} count playableunits

Share this post


Link to post
Share on other sites
{alive _x && _x in helicopter} count playableunits == {alive _x} count playableunits

That code wasn't working either :(

Edited by Phantom Six

Share this post


Link to post
Share on other sites

Thats because you tried it in SP editor instead of MP editor/host/dedi.

Share this post


Link to post
Share on other sites
Sorry to insist on it, but it really does work.

Example mission

Tried out your example mission. It works because there's only 1 player as playable and the chopper will fly off regardless of what the AI are doing. After that I decide to make them all playable. When I sat alone in the chopper it won't take off. After that, I decided to make all AI disable and that took off. Tried it with GC Revive script, hmmmm it should work.... yeah, maybe I should try it on my map.

Gave it a try on my sniper map, that condition detects, thanks SHK. I should try it on my other map to see if it works now.

Edited by Phantom Six

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  

×