// ejectgroup.sqf
// example:
// res = [plane1, group leader1, 1]execVM"ejectgroup.sqf"
// Run this only for a PC (action menu for example)
_transport = _this select 0;
_group = _this select 1;
_delay = _this select 2;
{
trooper_ejected_unit = _x;
publicVariable "trooper_ejected_unit";
Sleep _delay;
} forEach units _group;
// eject_monitor.sqf
// Run this everywhere, from the init.sqf
// []execVM"eject_monitor.sqf";
private["_unit"];
trooper_ejected_unit = objNull;
while {true} do
{
waitUntil {!isNull trooper_ejected_unit};
_unit = trooper_ejected_unit;
trooper_ejected_unit = objNull;
if (local _unit) then
{
[_unit] spawn
{
private["_unit", "_veh", "_pos", "_dir", "_up", "_vel"];
_unit = _this select 0;
_veh = vehicle _unit;
_unit action ["EJECT", _veh];
waitUntil {(vehicle _unit != _unit) && (vehicle _unit != _veh)};
_veh = vehicle _unit;
_pos = getPos _veh;
_dir = vectorDir _veh;
_up = vectorUp _veh;
_vel = velocity _veh;
deleteVehicle _veh;
// LOOK HERE TO PUT THE CORRECT CLASS NAME OF YOUR DESIRED CHUTE
_veh = "MAP_OPC_GU" createVehicle _pos;
_veh setPos _pos;
_veh setVectorDir _dir;
_veh setVectorUp _up;
_veh setVelocity _vel;
_unit moveInDriver _veh;
};
};
};