Jump to content
Shided

How to make a script that kicks people out of a vehicle when all the crew is unconscious (ACE)

Recommended Posts

So I have a problem with my helis/planes that whenever someone goes unconscious/is dead in one or one explodes you can't respawn and you either need the zeus to delete you or someone else pull you out of the vehicle.

I have made this script so far but it doesn't seem to properly work.

{ if ( _X getVariable ["ACE_isUnconscious", false]) or (!alive _x) then {moveOut _x}  } foreach crew _vehicle

This seems to simply move the unconscious guy out of the vehicle even if he is the only one unconscious there. How would I make it so anyone who is unconscious gets moved out of the thing only when everyone else in the vehicle is also unconscious?

Thank you in advance

Share this post


Link to post
Share on other sites

Try this code:

_hasAliveCrew = ((crew _vehicle) findIf { !(alive _x) or { _x getVariable ["ACE_isUnconscious", false] } }) < 0;

if (_hasAliveCrew) exitWith { };

{
    _x moveOut _vehicle;
} forEach (crew _vehicle);

 

  • Like 2

Share this post


Link to post
Share on other sites

Thank you, I played with with it more on my own, I will see if yours works cause it seems to be much shorter than what I came up with!

Any idea how would I also apply this just for players? Realized that if players died in a heli with an alive ai besides them this doesn't trigger which can create problems.

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

×