Advertisement
DarkBall

Untitled

May 22nd, 2020
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 3.78 KB | None | 0 0
  1. [] spawn {
  2.     addMissionEventHandler["TeamSwitch", {
  3.         params["_previousUnit", "_newUnit"];
  4.         group _previousUnit selectLeader _newUnit;
  5.     }];
  6.     playerAction = player;
  7.     fn_disableUnconscious = {
  8.         params['_unit'];
  9.         _unit setUnconscious false;
  10.         _unit setDamage 0;
  11.         _unit allowDamage true;
  12.         _unit setCaptive false;
  13.     };
  14.     fn_Unconscious = {
  15.         params['_unit'];
  16.         _unit setUnconscious true;
  17.         _unit setCaptive true;
  18.         _unit allowDamage false;
  19.         [_unit] call fn_holdAction;
  20.         if (isPlayer _unit) then {
  21.             addMissionEventHandler["TeamSwitch", {
  22.                 params["_previousUnit", "_newUnit"];
  23.                 if (_newUnit == playerAction) then {
  24.                     call fn_Effects;
  25.                 };
  26.                 ppEffectDestroy[PP_chrom, PP_wetD];
  27.             }];
  28.         };
  29.     };
  30.     fn_Effects = {
  31.         PP_chrom = ppEffectCreate["ChromAberration", 200];
  32.         PP_chrom ppEffectEnable true;
  33.         PP_chrom ppEffectAdjust[1, 0.41, true];
  34.         PP_chrom ppEffectCommit 120;
  35.         PP_wetD = ppEffectCreate["WetDistortion", 300];
  36.         PP_wetD ppEffectEnable true;
  37.         PP_wetD ppEffectAdjust[1, 0.2, 0.2, 1, 1, 1, 1, 0.05, 0.01, 0.05, 0.01, 0.1, 0.1, 0.2, 0.2];
  38.         PP_wetD ppEffectCommit 120;
  39.     };
  40.     fn_LostHoldAction = {
  41.         unitLostHoldAction = _this select 0;
  42.         [] spawn {
  43.             sleep 40;
  44.  
  45.             if (!(isNil {
  46.                     missionNamespace getVariable "HoldActionLost"
  47.                 })) then {
  48.                 [unitLostHoldAction] call fn_disableUnconscious;
  49.                 missionNamespace setVariable['HoldActionLost', nil];
  50.                 if (isPlayer unitLostHoldAction) then {
  51.                     ppEffectDestroy[PP_chrom, PP_wetD];
  52.                 };
  53.             } else {
  54.                 unitLostHoldAction setDamage 1;
  55.                 [unitLostHoldAction, actionId] call BIS_fnc_holdActionRemove;
  56.             };
  57.         };
  58.     };
  59.     fn_holdAction = {
  60.         params['_unit'];
  61.         [_unit] call fn_LostHoldAction;
  62.         actionId = [
  63.             _unit,
  64.             "Поднять",
  65.             "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_revive_ca.paa",
  66.             "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
  67.             "_this distance _target < 3 && 'FirstAidKit' in items _this",
  68.             "_caller distance _target < 3 && 'FirstAidKit' in items _caller", {
  69.                 targetHoldAction = _this select 0;
  70.                 callerHoldAction = _this select 1;
  71.                 if (stance callerHoldAction == 'PRONE') then {
  72.                     callerHoldAction playMove 'ainvppnemstpslaywrfldnon_medicother';
  73.                 } else {
  74.                     callerHoldAction playMove 'ainvpknlmstpslaywrfldnon_medicother';
  75.                 };
  76.             }, {}, {
  77.                 callerHoldAction removeItem 'FirstAidKit';
  78.                 missionNamespace setVariable['HoldActionLost', true];
  79.                 [targetHoldAction] call fn_disableUnconscious;
  80.                 [targetHoldAction, actionId] call BIS_fnc_holdActionRemove;
  81.             }, {},
  82.             [],
  83.             6,
  84.             0,
  85.             true,
  86.             false
  87.         ] call BIS_fnc_holdActionAdd;
  88.     }; {
  89.         if (_x in units group player) then {
  90.             _x addEventHandler['HandleDamage', {
  91.                 params['_unit', '', '_damage'];
  92.                 if (_damage >= 0.7) then {
  93.                     if (isPlayer _unit) then {
  94.                         call fn_Effects;
  95.                         call fn_Player_HoldActionLost;
  96.                     };
  97.                     [_unit] call fn_Unconscious;
  98.                 };
  99.             }];
  100.         };
  101.     }
  102.     forEach allUnits;
  103. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement