Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Inspired by this reddit post: https://www.reddit.com/r/arma/comments/ow91tk/and_for_my_next_scripting_trick_i_will_be_making/
- And based on KillzoneKid's Epic Armour Drop script: http://killzonekid.com/arma-scripting-tutorials-epic-armour-drop/
- USAGE: _veh call KK_fnc_paraDrop;
- */
- if (isServer) then {
- KK_fnc_paraDrop = {
- params [ ["_veh", objNull, [objNull]] ];
- if (isNull _veh || {!(_veh isKindOf "Helicopter")}) exitWith {};
- private _offset = _veh selectionPosition ["rotor_center", "MEMORY"];
- if (_offset isEqualTo [0,0,0]) then {_offset = [0, 0.5, 3]};
- private _class = format ["%1_parachute_02_F", toString[(toArray faction _veh)#0]];
- private _para = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
- private _paras = [_para];
- _para attachTo [_veh, _offset];
- detach _para;
- _veh attachTo [_para, _offset apply {-_x}];
- if (_veh isKindOf "Heli_Transport_03_base_F") then {
- _offset = (_veh selectionPosition ["rotor_02_center", "MEMORY"]) vectorDiff _offset;
- private _p = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
- _paras pushBack _p;
- _p attachTo [_para, _offset];
- _p setVectorUp [0,-0.3,0.6];
- } else {
- private _mass = getMass _veh;
- if (_mass > 6000) then {
- private _extraParas = [[0.5,-0.4,0.6], [-0.5,-0.4,0.6]];
- if (_mass > 12000) then {_extraParas = _extraParas + [[0.5,0.4,0.6], [-0.5,0.4,0.6]]};
- _extraParas apply {
- private _p = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
- _paras pushBack _p;
- _p attachTo [_para, [0,0,0]];
- _p setVectorUp _x;
- };
- };
- };
- [_veh, _paras] spawn {
- params ["_veh","_paras"];
- waitUntil {getPos _veh select 2 < 4};
- private _vel = velocity _veh;
- [_veh, _vel] spawn {
- params ["_veh","_vel"];
- private _damageAllowed = isDamageAllowed _veh;
- _veh allowDamage false;
- detach _veh;
- _veh setVelocity _vel;
- private _delay = time + 3;
- waitUntil {isTouchingGround _veh && {abs(velocity _veh #2) < 0.1 || time > _delay}};
- _veh allowDamage _damageAllowed;
- };
- if (isMultiplayer) then {
- missionNamespace setVariable ["#FX", [_veh, _vel#2]];
- publicVariable "#FX";
- } else {
- [_veh, _vel#2] spawn KK_fnc_FX;
- };
- playSound3D ["a3\sounds_f\weapons\Flare_Gun\flaregun_1_shoot.wss", _veh];
- _paras apply {detach _x; _x disableCollisionWith _veh};
- private _delay = time + 8;
- waitUntil {time > _delay};
- _paras select {!isNull _x} apply {deleteVehicle _x};
- };
- };
- };
- if (!isDedicated) then {
- KK_fnc_FX = {
- params ["_veh", "_vel"];
- for "_i" from 1 to 100 do {
- drop [
- ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 7, 48],
- "",
- "Billboard",
- 0,
- 1 + random 0.5,
- [0, -2, 1.5],
- [-20 + random 40, -20 + random 40, -5 + _vel],
- 1,
- 0.05,
- 0.04,
- 0,
- [0.5, 10 + random 20],
- [
- [0,0,0,1],
- [0,0,0,0.3],
- [1,1,1,0.1],
- [1,1,1,0.03],
- [1,1,1,0.01],
- [1,1,1,0.003],
- [1,1,1,0.001],
- [1,1,1,0]
- ],
- [1],
- 0.1,
- 0.1,
- "",
- "",
- _veh,
- random 360,
- true,
- 0.1
- ];
- };
- };
- "#FX" addPublicVariableEventHandler {_this#1 spawn KK_fnc_FX};
- };
Add Comment
Please, Sign In to add comment