; Get the plane object
_plane = _this select 0

#EjectLoop
; Wait for the plane to fail
?(damage _plane >=0.7): goto "Eject"

; Check whether we need to keep doing this
?(not alive _plane): goto "Exit"
goto "EjectLoop"

#Eject
; Get the crew array
_crewarray = crew _plane

; If the plane was empty, we don't need to do anything
? ( count _crewarray == 0) : Goto "Exit"

; Otherwise, set the plane to 70% damage
_plane setDamage 0.70

; Eject the crew
"_x action [""eject"", _plane]" forEach _crewarray

#Exit
exit
