Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [] spawn {
- addMissionEventHandler["TeamSwitch", {
- params["_previousUnit", "_newUnit"];
- group _previousUnit selectLeader _newUnit;
- }];
- playerAction = player;
- fn_disableUnconscious = {
- params['_unit'];
- _unit setUnconscious false;
- _unit setDamage 0;
- _unit allowDamage true;
- _unit setCaptive false;
- };
- fn_Unconscious = {
- params['_unit'];
- _unit setUnconscious true;
- _unit setCaptive true;
- _unit allowDamage false;
- [_unit] call fn_holdAction;
- if (isPlayer _unit) then {
- addMissionEventHandler["TeamSwitch", {
- params["_previousUnit", "_newUnit"];
- if (_newUnit == playerAction) then {
- call fn_Effects;
- };
- ppEffectDestroy[PP_chrom, PP_wetD];
- }];
- };
- };
- fn_Effects = {
- PP_chrom = ppEffectCreate["ChromAberration", 200];
- PP_chrom ppEffectEnable true;
- PP_chrom ppEffectAdjust[1, 0.41, true];
- PP_chrom ppEffectCommit 120;
- PP_wetD = ppEffectCreate["WetDistortion", 300];
- PP_wetD ppEffectEnable true;
- 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];
- PP_wetD ppEffectCommit 120;
- };
- fn_LostHoldAction = {
- unitLostHoldAction = _this select 0;
- [] spawn {
- sleep 40;
- if (!(isNil {
- missionNamespace getVariable "HoldActionLost"
- })) then {
- [unitLostHoldAction] call fn_disableUnconscious;
- missionNamespace setVariable['HoldActionLost', nil];
- if (isPlayer unitLostHoldAction) then {
- ppEffectDestroy[PP_chrom, PP_wetD];
- };
- } else {
- unitLostHoldAction setDamage 1;
- [unitLostHoldAction, actionId] call BIS_fnc_holdActionRemove;
- };
- };
- };
- fn_holdAction = {
- params['_unit'];
- [_unit] call fn_LostHoldAction;
- actionId = [
- _unit,
- "Поднять",
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_revive_ca.paa",
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
- "_this distance _target < 3 && 'FirstAidKit' in items _this",
- "_caller distance _target < 3 && 'FirstAidKit' in items _caller", {
- targetHoldAction = _this select 0;
- callerHoldAction = _this select 1;
- if (stance callerHoldAction == 'PRONE') then {
- callerHoldAction playMove 'ainvppnemstpslaywrfldnon_medicother';
- } else {
- callerHoldAction playMove 'ainvpknlmstpslaywrfldnon_medicother';
- };
- }, {}, {
- callerHoldAction removeItem 'FirstAidKit';
- missionNamespace setVariable['HoldActionLost', true];
- [targetHoldAction] call fn_disableUnconscious;
- [targetHoldAction, actionId] call BIS_fnc_holdActionRemove;
- }, {},
- [],
- 6,
- 0,
- true,
- false
- ] call BIS_fnc_holdActionAdd;
- }; {
- if (_x in units group player) then {
- _x addEventHandler['HandleDamage', {
- params['_unit', '', '_damage'];
- if (_damage >= 0.7) then {
- if (isPlayer _unit) then {
- call fn_Effects;
- call fn_Player_HoldActionLost;
- };
- [_unit] call fn_Unconscious;
- };
- }];
- };
- }
- forEach allUnits;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement