Hunger/Thirst Faiting cooldown of 45s

This commit is contained in:
mrschick 2024-08-07 13:15:40 +02:00
parent b9a361fd39
commit de9c29d869
2 changed files with 5 additions and 1 deletions

View File

@ -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), {

View File

@ -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