This script creates a loop for every crewed vehicle on the map, for all sides and requires F2 (but can easily be adapted not to). It's not fully tested so bugs might occur.
Simply start it from the init.sqf
Code: Select all
if !(isServer) exitWith {};
sleep 0.0001;
// ====================================================================================
// WAIT FOR COMMON VARIABLES TO BE SET
// Before executing this script, we wait for the script 'f_setLocalVars.sqf' to run:
waitUntil {scriptDone f_setLocalVars};
// ====================================================================================
// _vehicles = vehicles;
_vehicles = f_var_vehicles; //f_var_vehicles_BLU f_var_vehicles_RES f_var_vehicles_OPF
_sleep = 1; //increase _sleep when using a lot of vehicles
_alloweddamage = 0.8; //damage allowed before the crew bails no matter what
{
_x allowCrewInImmobile true;
[_x] spawn {
_unit = _this select 0;
while {damage _unit < _alloweddamage && canFire _unit} do
{
sleep _sleep;
};
_unit allowCrewInImmobile false;
{_x action ["eject", _unit];} forEach crew _unit;
};
} forEach _vehicles;