WIP Selectable high thirst/hunger consequence

This commit is contained in:
mrschick 2024-08-10 18:55:33 +02:00
parent 831bf92ca1
commit 389defeac1
3 changed files with 39 additions and 5 deletions

View File

@ -27,15 +27,25 @@ if ((_thirst > 99.9 || {_hunger > 99.9}) && {random 1 < 0.5}) exitWith {
// Exit if unit is not awake, below are animation based consequences // Exit if unit is not awake, below are animation based consequences
if !(_player call EFUNC(common,isAwake)) exitWith {}; if !(_player call EFUNC(common,isAwake)) exitWith {};
// Set unit unconscious with 45s cooldown (chance based on how high thirst/hunger are) // Trigger high thirst/hunger consequence
if ( if (
GETEGVAR(medical,enabled,false) && GETEGVAR(medical,enabled,false) &&
{(CBA_missionTime - XGVAR(lastUnconEvent)) > 45} && {(_thirst > 85 || {_hunger > 85})}
{(_thirst > 85 || {_hunger > 85}) && {random 1 < linearConversion [85, 100, _thirst max _hunger, 0.05, 0.1, true]}}
) exitWith { ) exitWith {
if (XGVAR(nearDepletedConsequence) == 1) then { // Set unit unconscious with a 45s cooldown
if (
(CBA_missionTime - XGVAR(lastUnconEvent)) > 45 &&
{random 1 < linearConversion [85, 100, _thirst max _hunger, 0.05, 0.1, true]}
) then {
[_player, true, 5, true] call EFUNC(medical,setUnconscious); [_player, true, 5, true] call EFUNC(medical,setUnconscious);
XGVAR(lastUnconEvent) = CBA_missionTime; XGVAR(lastUnconEvent) = CBA_missionTime;
}; };
} else { // Add pain
if (ACE_Player getVariable [QEGVAR(medical,pain), 0] < 0.1) then {
[ACE_Player, 0.1] call ace_medical_fnc_adjustPainLevel;
};
};
};
// Make unit fall if moving fast // Make unit fall if moving fast
if ((_thirst > 93 || {_hunger > 93}) && {speed _player > 1} && {isNull objectParent _player}) exitWith { if ((_thirst > 93 || {_hunger > 93}) && {speed _player > 1} && {isNull objectParent _player}) exitWith {

View File

@ -45,6 +45,15 @@
true true
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
[
QXGVAR(nearDepletedConsequence),
"LIST",
[LSTRING(NearDepletedConsequence_DisplayName), LSTRING(NearDepletedConsequence_Description)],
LSTRING(DisplayName),
[[0, 1], [LSTRING(NearDepletedConsequence_Pain), LSTRING(NearDepletedConsequence_Unconsciousness)], 1],
true
] call CBA_fnc_addSetting;
[ [
QXGVAR(waterSourceActions), QXGVAR(waterSourceActions),
"LIST", "LIST",

View File

@ -115,6 +115,21 @@
<Spanish>Tiempo sin agua</Spanish> <Spanish>Tiempo sin agua</Spanish>
<Turkish>Susuz Kalma Süresi</Turkish> <Turkish>Susuz Kalma Süresi</Turkish>
</Key> </Key>
<Key ID="STR_ACE_Field_Rations_NearDepletedConsequence_DisplayName">
<English>Consequence of extreme thirst/hunger</English>
<German>Folge von extremen Durst/Hunger</German>
<Italian>Conseguenze di sete/fame estrema</Italian>
</Key>
<Key ID="STR_ACE_Field_Rations_NearDepletedConsequence_Pain">
<English>Pain</English>
<German>Schmerzen</German>
<Italian>Dolore</Italian>
</Key>
<Key ID="STR_ACE_Field_Rations_NearDepletedConsequence_Unconsciousness">
<English>Fainting</English>
<German>Ohnmacht</German>
<Italian>Svenimenti</Italian>
</Key>
<Key ID="STR_ACE_Field_Rations_TimeWithoutWater_Description"> <Key ID="STR_ACE_Field_Rations_TimeWithoutWater_Description">
<English>How long should a person be able to go without water (hours).</English> <English>How long should a person be able to go without water (hours).</English>
<Chinese>一個單位脫水之前能支撐多久(單位為小時)。</Chinese> <Chinese>一個單位脫水之前能支撐多久(單位為小時)。</Chinese>