diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index dbb0d115c3..b60e1ca574 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -64,22 +64,21 @@ _unit setUnitPos "DOWN"; // So the AI does not get stuck, we are moving the unit to a temp group on its own. [_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); -_captiveSwitch = [_unit, true] call EFUNC(common,setCaptiveSwitch); +[_unit, QGVAR(unconscious), true] call EFUNC(common,setCaptivityStatus); [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); _startingTime = time; _minWaitingTime = (round(random(10)+5)); [{ - private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch", "_hasMovedOut"]; + private ["_unit", "_vehicleOfUnit","_minWaitingTime", "_oldAnimation", "_captiveSwitch", "_hasMovedOut"]; _args = _this select 0; _unit = _args select 0; _oldAnimation = _args select 1; - _captiveSwitch = _args select 2; - _originalPos = _args select 3; - _startingTime = _args select 4; - _minWaitingTime = _args select 5; - _hasMovedOut = _args select 6; + _originalPos = _args select 2; + _startingTime = _args select 3; + _minWaitingTime = _args select 4; + _hasMovedOut = _args select 5; // Since the unit is no longer alive, get rid of this PFH. if (!alive _unit) exitwith { // EXIT PFH @@ -104,10 +103,8 @@ _minWaitingTime = (round(random(10)+5)); }; if (!_hasMovedOut) then { // Reset the unit back to the previous captive state. - if (_captiveSwitch) then { - [_unit, false] call EFUNC(common,setCaptiveSwitch); - }; - + [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + // Swhich the unit back to its original group [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); @@ -137,6 +134,6 @@ _minWaitingTime = (round(random(10)+5)); [_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call EFUNC(common,doAnimation); // Reset animations if unit starts doing wierd things. }; -}, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime, false] ] call CBA_fnc_addPerFrameHandler; +}, 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false] ] call CBA_fnc_addPerFrameHandler; ["medical_onUnconscious", [_unit], [_unit, true]] call EFUNC(common,targetEvent);