From de9c29d869a6dc5fbd9b5567be9f7aa6f63d48f4 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:15:40 +0200 Subject: [PATCH] Hunger/Thirst Faiting cooldown of 45s --- addons/field_rations/XEH_postInit.sqf | 2 ++ addons/field_rations/functions/fnc_handleEffects.sqf | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/field_rations/XEH_postInit.sqf b/addons/field_rations/XEH_postInit.sqf index 9fc8406aba..9344eebcbb 100644 --- a/addons/field_rations/XEH_postInit.sqf +++ b/addons/field_rations/XEH_postInit.sqf @@ -6,6 +6,8 @@ if !(hasInterface) exitWith {}; // Exit if not enabled if (!XGVAR(enabled)) exitWith {}; + XGVAR(lastUnconEvent) = 0; + // Add Advanced Fatigue duty factor if (XGVAR(affectAdvancedFatigue) && {missionNamespace getVariable [QEGVAR(advanced_fatigue,enabled), false]}) then { [QUOTE(ADDON), { diff --git a/addons/field_rations/functions/fnc_handleEffects.sqf b/addons/field_rations/functions/fnc_handleEffects.sqf index ad60a743ad..6987074227 100644 --- a/addons/field_rations/functions/fnc_handleEffects.sqf +++ b/addons/field_rations/functions/fnc_handleEffects.sqf @@ -27,12 +27,14 @@ if ((_thirst > 99.9 || {_hunger > 99.9}) && {random 1 < 0.5}) exitWith { // Exit if unit is not awake, below are animation based consequences if !(_player call EFUNC(common,isAwake)) exitWith {}; -// Set unit unconscious (chance based on how high thirst/hunger are) +// Set unit unconscious with 45s cooldown (chance based on how high thirst/hunger are) if ( GETEGVAR(medical,enabled,false) && + {(CBA_missionTime - XGVAR(lastUnconEvent)) > 45} && {(_thirst > 85 || {_hunger > 85}) && {random 1 < linearConversion [85, 100, _thirst max _hunger, 0.05, 0.1, true]}} ) exitWith { [_player, true, 5, true] call EFUNC(medical,setUnconscious); + XGVAR(lastUnconEvent) = CBA_missionTime; }; // Make unit fall if moving fast