59 lines
2.3 KiB
Plaintext
59 lines
2.3 KiB
Plaintext
|
/*
|
||
|
Author: Djeeberjr (Kex (based on cobra4v320's Ai HALO Jump script))
|
||
|
|
||
|
Description:
|
||
|
Puts the backpack on the chest and adds a parachute.
|
||
|
THIS FUNCTION HAS TO BE EXECUTED WHERE THE UNIT IS LOCAL!
|
||
|
|
||
|
Parameter(s):
|
||
|
1: OBJECT - the unit
|
||
|
|
||
|
*/
|
||
|
|
||
|
params ["_unit"];
|
||
|
|
||
|
_backpack_class = backpack _unit;
|
||
|
|
||
|
// Holtser weapon
|
||
|
_unit action ["SWITCHWEAPON",_unit,_unit,-1];
|
||
|
|
||
|
// Unit already has a parachute
|
||
|
if (backpack _unit != "" and {getText (configfile >> "CfgVehicles" >> backpack _unit >> "backpackSimulation") isEqualTo "ParachuteSteerable"}) then {_backpack_class = "";};
|
||
|
|
||
|
if (_backpack_class != "") then{
|
||
|
_container = backpackContainer _unit;
|
||
|
_weapon_cargo = getWeaponCargo _container;
|
||
|
_magazine_cargo = getMagazineCargo _container;
|
||
|
_item_cargo = getItemCargo _container;
|
||
|
|
||
|
removeBackpack _unit;
|
||
|
_unit addBackpack "b_parachute";
|
||
|
_packHolder = createVehicle ["groundWeaponHolder", [0,0,0], [], 0, "can_collide"];
|
||
|
_packHolder addBackpackCargoGlobal [_backpack_class, 1];
|
||
|
|
||
|
_packHolder attachTo [vehicle _unit,[-0.07,0.65,-0.55],"spine3"];
|
||
|
[_packHolder, [[0,-0.2,-1],[0,1,0]]] remoteExecCall ["setVectorDirAndUp", 0, _packHolder];
|
||
|
|
||
|
sleep 5; // Wait because sometime when you teleport a player high up on a plane he is going in "HaloFreeFall_non" state
|
||
|
|
||
|
waitUntil {animationState _unit == "HaloFreeFall_non" or (!alive _unit)};
|
||
|
_packHolder attachTo [_unit,[-0.12,-0.02,-.74],"pelvis"];
|
||
|
[_packHolder, [[0,-1,-0.05],[0,0,-1]]] remoteExecCall ["setVectorDirAndUp", 0, _packHolder];
|
||
|
|
||
|
waitUntil {animationState _unit == "para_pilot" or (!alive _unit)};
|
||
|
_packHolder attachTo [vehicle _unit,[-0.07,0.67,-0.13],"pelvis"];
|
||
|
[_packHolder, [[0,-0.2,-1],[0,1,0]]] remoteExecCall ["setVectorDirAndUp", 0, _packHolder];
|
||
|
|
||
|
waitUntil {isTouchingGround _unit or (getPos _unit select 2) < 1 or (!alive _unit)};
|
||
|
deleteVehicle _packHolder;
|
||
|
_unit addBackpack _backpack_class;
|
||
|
clearAllItemsFromBackpack _unit;
|
||
|
_container = backpackContainer _unit;
|
||
|
{_container addWeaponCargo [_x, (_weapon_cargo select 1) select _forEachIndex]} forEach (_weapon_cargo select 0);
|
||
|
{_container addMagazineCargo [_x, (_magazine_cargo select 1) select _forEachIndex]} forEach (_magazine_cargo select 0);
|
||
|
{_container addItemCargo [_x, (_item_cargo select 1) select _forEachIndex]} forEach (_item_cargo select 0);
|
||
|
}else
|
||
|
{
|
||
|
_unit addBackpack "b_parachute";
|
||
|
};
|