From 13a32b2b870ce04fcd74be0bcc88cb3de0cb96e6 Mon Sep 17 00:00:00 2001 From: BAXENdev Date: Fri, 19 Jan 2024 11:17:59 -0500 Subject: [PATCH 01/16] Consistentency Update with Overdosing --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 62353584460..ece72a6c506 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -26,7 +26,9 @@ private _overdosedMedications = []; // Check for overdose from current medication if (_maxDosage > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose >= floor (_maxDosage + round(random(2)))) then { + // if (_currentDose >= floor (_maxDosage + round(random(2)))) then { // CASE 1: Old Behavior + // if (_currentDose >= floor (_maxDosage + round(random(2)) + 1)) then { // CASE 2: New Behavior with Random + if (_currentDose > _maxDose) then { // CASE 3: New Bahavior without Random TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 6f7302a8bd7d43cf83553f6d4db32271cf42f920 Mon Sep 17 00:00:00 2001 From: BAXENdev Date: Fri, 19 Jan 2024 11:32:38 -0500 Subject: [PATCH 02/16] Added Description to Condition Cases --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index ece72a6c506..df19ceb7a2e 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -28,7 +28,7 @@ if (_maxDosage > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); // if (_currentDose >= floor (_maxDosage + round(random(2)))) then { // CASE 1: Old Behavior // if (_currentDose >= floor (_maxDosage + round(random(2)) + 1)) then { // CASE 2: New Behavior with Random - if (_currentDose > _maxDose) then { // CASE 3: New Bahavior without Random + if (_currentDose > _maxDose) then { // CASE 3: New Bahavior without TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 5835c31157fcc0b8a3d6a678307fd65e29c45d6c Mon Sep 17 00:00:00 2001 From: BAXENdev <83290629+BAXENdev@users.noreply.github.com> Date: Fri, 19 Jan 2024 18:01:52 -0500 Subject: [PATCH 03/16] Updated to CASE 2 Overdose behavior: ODs on uses `_maxDose + {1 or 2 or 3}` from `_maxDose + {0 or 1 or 2}` --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index df19ceb7a2e..e2ed5f45dbc 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -26,9 +26,7 @@ private _overdosedMedications = []; // Check for overdose from current medication if (_maxDosage > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - // if (_currentDose >= floor (_maxDosage + round(random(2)))) then { // CASE 1: Old Behavior - // if (_currentDose >= floor (_maxDosage + round(random(2)) + 1)) then { // CASE 2: New Behavior with Random - if (_currentDose > _maxDose) then { // CASE 3: New Bahavior without + if (_currentDose >= floor (_maxDosage + round(random(1)) + 1)) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 6ede391ab5e76f3269c619d7d01bbc6817a969de Mon Sep 17 00:00:00 2001 From: BAXENdev <83290629+BAXENdev@users.noreply.github.com> Date: Fri, 19 Jan 2024 18:07:52 -0500 Subject: [PATCH 04/16] Update fnc_onMedicationUsage.sqf --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index e2ed5f45dbc..3e86f2f0788 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -26,7 +26,7 @@ private _overdosedMedications = []; // Check for overdose from current medication if (_maxDosage > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose >= floor (_maxDosage + round(random(1)) + 1)) then { + if (_currentDose >= floor (_maxDosage + round(random(2)) + 1)) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 48e652502a74861f922ebc0d15ee0571f205e912 Mon Sep 17 00:00:00 2001 From: BAXENdev <83290629+BAXENdev@users.noreply.github.com> Date: Sat, 20 Jan 2024 11:06:07 -0500 Subject: [PATCH 05/16] Update fnc_onMedicationUsage.sqf --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 3e86f2f0788..266d04fe811 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -26,7 +26,7 @@ private _overdosedMedications = []; // Check for overdose from current medication if (_maxDosage > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose >= floor (_maxDosage + round(random(2)) + 1)) then { + if (_currentDose > floor (_maxDosage + round(random(2)))) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 75eb399cdc2992f2143af37e3dd302ed52905f11 Mon Sep 17 00:00:00 2001 From: BAXENdev Date: Mon, 22 Jan 2024 18:46:11 -0500 Subject: [PATCH 06/16] Added riskDose range and updated medications --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 9 ++++++--- .../medical_treatment/functions/fnc_medicationLocal.sqf | 3 ++- .../functions/fnc_onMedicationUsage.sqf | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index eeeacf700f6..203647dda9d 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -567,6 +567,8 @@ class ADDON { timeTillMaxEffect = 30; // How many of this type of medication can be in the system before the patient overdoses? maxDose = 4; + // A range of doses past max dose where there is a chance of not overdosing + riskDose = 2; // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName onOverDose = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity @@ -591,7 +593,8 @@ class ADDON { hrIncreaseHigh[] = {10, 40}; timeInSystem = 120; timeTillMaxEffect = 10; - maxDose = 10; + maxDose = 9; + riskDose = 2; incompatibleMedication[] = {}; }; class Adenosine { @@ -601,14 +604,14 @@ class ADDON { hrIncreaseHigh[] = {-15, -35}; timeInSystem = 120; timeTillMaxEffect = 15; - maxDose = 6; + maxDose = 5; incompatibleMedication[] = {}; }; class PainKillers { painReduce = 0.1; timeInSystem = 600; timeTillMaxEffect = 60; - maxDose = 10; + maxDose = 9; incompatibleMedication[] = {}; viscosityChange = 5; }; diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index b5499e9bb45..c754c00db92 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -59,6 +59,7 @@ private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",g private _timeInSystem = GET_NUMBER(_medicationConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem")); private _timeTillMaxEffect = GET_NUMBER(_medicationConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect")); private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); +private _maxDose = GET_NUMBER(_medicationConfig >> "riskDose",getNumber (_defaultConfig >> "riskDose")); private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange")); private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow")); private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal")); @@ -75,4 +76,4 @@ TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange); [_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment); // Check for medication compatiblity -[_patient, _className, _maxDose, _incompatibleMedication] call FUNC(onMedicationUsage); +[_patient, _className, _maxDose, _riskDose, _incompatibleMedication] call FUNC(onMedicationUsage); diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 266d04fe811..8667185c1e6 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -18,7 +18,7 @@ * Public: No */ -params ["_target", "_className", "_maxDosage", "_incompatibleMedication"]; +params ["_target", "_className", "_maxDosage", "_riskDose", "_incompatibleMedication"]; TRACE_4("onMedicationUsage",_target,_className,_maxDosage,_incompatibleMedication); private _overdosedMedications = []; @@ -26,7 +26,7 @@ private _overdosedMedications = []; // Check for overdose from current medication if (_maxDosage > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose > floor (_maxDosage + round(random(2)))) then { + if (_currentDose > floor (_maxDosage + round(random(_riskDose)))) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 49d89a2b970ac8ed46b19a40c9a579a52e979e79 Mon Sep 17 00:00:00 2001 From: BAXENdev Date: Thu, 25 Jan 2024 04:03:33 -0500 Subject: [PATCH 07/16] maxDose -> maxSafeDose | riskDose -> chanceDoses --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 8 ++++---- .../medical_treatment/functions/fnc_medicationLocal.sqf | 6 +++--- .../medical_treatment/functions/fnc_onMedicationUsage.sqf | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 203647dda9d..e5a27be37c7 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -566,9 +566,10 @@ class ADDON { // How long until the maximum effect is reached timeTillMaxEffect = 30; // How many of this type of medication can be in the system before the patient overdoses? - maxDose = 4; - // A range of doses past max dose where there is a chance of not overdosing - riskDose = 2; + maxSafeDose = 4; + // The number of doses over maxDose that there is chance to not overdose. Chance decreases as dose gets higher. + // Dose 4: Safe | Dose 5 and 6: Possible Overdose | Dose 7: Overdose + chanceDoses = 2; // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName onOverDose = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity @@ -594,7 +595,6 @@ class ADDON { timeInSystem = 120; timeTillMaxEffect = 10; maxDose = 9; - riskDose = 2; incompatibleMedication[] = {}; }; class Adenosine { diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index c754c00db92..a635dbbf97e 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -58,8 +58,8 @@ private _medicationConfig = _defaultConfig >> _classname; private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",getNumber (_defaultConfig >> "painReduce")); private _timeInSystem = GET_NUMBER(_medicationConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem")); private _timeTillMaxEffect = GET_NUMBER(_medicationConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect")); -private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); -private _maxDose = GET_NUMBER(_medicationConfig >> "riskDose",getNumber (_defaultConfig >> "riskDose")); +private _maxSafeDose = GET_NUMBER(_medicationConfig >> "maxSafeDose",getNumber (_defaultConfig >> "maxSafeDose")); +private _chanceDoses = GET_NUMBER(_medicationConfig >> "chanceDoses",getNumber (_defaultConfig >> "chanceDoses")); private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange")); private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow")); private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal")); @@ -76,4 +76,4 @@ TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange); [_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment); // Check for medication compatiblity -[_patient, _className, _maxDose, _riskDose, _incompatibleMedication] call FUNC(onMedicationUsage); +[_patient, _className, _maxSafeDose, _chanceDoses, _incompatibleMedication] call FUNC(onMedicationUsage); diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 8667185c1e6..1e8fc3ab36f 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -18,15 +18,15 @@ * Public: No */ -params ["_target", "_className", "_maxDosage", "_riskDose", "_incompatibleMedication"]; +params ["_target", "_className", "_maxSafeDose", "_chanceDoses", "_incompatibleMedication"]; TRACE_4("onMedicationUsage",_target,_className,_maxDosage,_incompatibleMedication); private _overdosedMedications = []; // Check for overdose from current medication -if (_maxDosage > 0) then { +if (_maxSafeDose > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose > floor (_maxDosage + round(random(_riskDose)))) then { + if (_currentDose > floor (_maxSafeDose + round(random(_chanceDoses)))) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From d925ad2dbc0181c8bf2a900c6fc666b4f983a126 Mon Sep 17 00:00:00 2001 From: BAXENdev Date: Thu, 25 Jan 2024 04:07:22 -0500 Subject: [PATCH 08/16] Fixed maxDose reference in trace --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 1e8fc3ab36f..ce322f753ae 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -19,7 +19,7 @@ */ params ["_target", "_className", "_maxSafeDose", "_chanceDoses", "_incompatibleMedication"]; -TRACE_4("onMedicationUsage",_target,_className,_maxDosage,_incompatibleMedication); +TRACE_4("onMedicationUsage",_target,_className,_maxSafeDose,_incompatibleMedication); private _overdosedMedications = []; From de31288e68d51ebe3e47c895dfd7a59ff2460ebe Mon Sep 17 00:00:00 2001 From: BAXENdev Date: Thu, 25 Jan 2024 04:08:17 -0500 Subject: [PATCH 09/16] Added chanceDoses to trace --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index ce322f753ae..903e747e647 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -19,7 +19,7 @@ */ params ["_target", "_className", "_maxSafeDose", "_chanceDoses", "_incompatibleMedication"]; -TRACE_4("onMedicationUsage",_target,_className,_maxSafeDose,_incompatibleMedication); +TRACE_4("onMedicationUsage",_target,_className,_maxSafeDose,_chanceDoses,_incompatibleMedication); private _overdosedMedications = []; From be211ed59988bfa6eb63987f49735a6d2a4403ee Mon Sep 17 00:00:00 2001 From: BAXENdev Date: Thu, 25 Jan 2024 10:28:49 -0500 Subject: [PATCH 10/16] Fixed use of TRACE macro --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 903e747e647..3b4e30301f3 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -19,7 +19,7 @@ */ params ["_target", "_className", "_maxSafeDose", "_chanceDoses", "_incompatibleMedication"]; -TRACE_4("onMedicationUsage",_target,_className,_maxSafeDose,_chanceDoses,_incompatibleMedication); +TRACE_5("onMedicationUsage",_target,_className,_maxSafeDose,_chanceDoses,_incompatibleMedication); private _overdosedMedications = []; From 91866cc51130afd25c39b2321d06ea97328de258 Mon Sep 17 00:00:00 2001 From: BAXENdev <83290629+BAXENdev@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:11:23 +0000 Subject: [PATCH 11/16] Updated comments and variable maxSafeDose -> maxDose --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 10 +++++----- .../functions/fnc_medicationLocal.sqf | 4 ++-- .../functions/fnc_onMedicationUsage.sqf | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index e5a27be37c7..6c2a6fd0c62 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -565,11 +565,11 @@ class ADDON { timeInSystem = 120; // How long until the maximum effect is reached timeTillMaxEffect = 30; - // How many of this type of medication can be in the system before the patient overdoses? - maxSafeDose = 4; - // The number of doses over maxDose that there is chance to not overdose. Chance decreases as dose gets higher. - // Dose 4: Safe | Dose 5 and 6: Possible Overdose | Dose 7: Overdose - chanceDoses = 2; + // How many of this type of medication can be in the system before the patient can possibly overdose? + maxDose = 4; + // The number of doses over maxSafeDose where there is a chance to avoid overdose. Chance decreases as dose gets higher. + // Example with maxDose = 4 and = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose + chanceDoses = 2; // TODO: rename // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName onOverDose = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index a635dbbf97e..592f8d67337 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -58,7 +58,7 @@ private _medicationConfig = _defaultConfig >> _classname; private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",getNumber (_defaultConfig >> "painReduce")); private _timeInSystem = GET_NUMBER(_medicationConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem")); private _timeTillMaxEffect = GET_NUMBER(_medicationConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect")); -private _maxSafeDose = GET_NUMBER(_medicationConfig >> "maxSafeDose",getNumber (_defaultConfig >> "maxSafeDose")); +private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); private _chanceDoses = GET_NUMBER(_medicationConfig >> "chanceDoses",getNumber (_defaultConfig >> "chanceDoses")); private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange")); private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow")); @@ -76,4 +76,4 @@ TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange); [_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment); // Check for medication compatiblity -[_patient, _className, _maxSafeDose, _chanceDoses, _incompatibleMedication] call FUNC(onMedicationUsage); +[_patient, _className, _maxDose, _chanceDoses, _incompatibleMedication] call FUNC(onMedicationUsage); diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 3b4e30301f3..1b6c004a5d6 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -18,15 +18,15 @@ * Public: No */ -params ["_target", "_className", "_maxSafeDose", "_chanceDoses", "_incompatibleMedication"]; -TRACE_5("onMedicationUsage",_target,_className,_maxSafeDose,_chanceDoses,_incompatibleMedication); +params ["_target", "_className", "_maxDose", "_chanceDoses", "_incompatibleMedication"]; +TRACE_5("onMedicationUsage",_target,_className,_maxDose,_chanceDoses,_incompatibleMedication); private _overdosedMedications = []; // Check for overdose from current medication -if (_maxSafeDose > 0) then { +if (_maxDose > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose > floor (_maxSafeDose + round(random(_chanceDoses)))) then { + if (_currentDose > floor (_maxDose + round(random(_chanceDoses)))) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 948f46817e8567f8bfcaa44221d5028874ddaf0f Mon Sep 17 00:00:00 2001 From: BAXENdev <83290629+BAXENdev@users.noreply.github.com> Date: Sat, 27 Jan 2024 03:26:22 +0000 Subject: [PATCH 12/16] Updated comment and overdose formula --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 2 +- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 6c2a6fd0c62..4b01d21c6cd 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -567,7 +567,7 @@ class ADDON { timeTillMaxEffect = 30; // How many of this type of medication can be in the system before the patient can possibly overdose? maxDose = 4; - // The number of doses over maxSafeDose where there is a chance to avoid overdose. Chance decreases as dose gets higher. + // The number of doses over maxSafeDose where there is a chance to overdose. The chance increases as dose gets higher. // Example with maxDose = 4 and = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose chanceDoses = 2; // TODO: rename // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 1b6c004a5d6..d93b3fb5af3 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -26,7 +26,7 @@ private _overdosedMedications = []; // Check for overdose from current medication if (_maxDose > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose > floor (_maxDose + round(random(_chanceDoses)))) then { + if (_currentDose > _maxDose + (floor random _chanceDoses)) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From d8cc674a49b36f065ccbb3f8dc6a5b2ebefeba6f Mon Sep 17 00:00:00 2001 From: BAXENdev <83290629+BAXENdev@users.noreply.github.com> Date: Sat, 3 Feb 2024 02:02:20 +0000 Subject: [PATCH 13/16] chanceDoses -> maxDoseDeviation --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 4 ++-- .../medical_treatment/functions/fnc_medicationLocal.sqf | 4 ++-- .../functions/fnc_onMedicationUsage.sqf | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 4b01d21c6cd..865a66d0e30 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -568,8 +568,8 @@ class ADDON { // How many of this type of medication can be in the system before the patient can possibly overdose? maxDose = 4; // The number of doses over maxSafeDose where there is a chance to overdose. The chance increases as dose gets higher. - // Example with maxDose = 4 and = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose - chanceDoses = 2; // TODO: rename + // Example with maxDose = 4 and maxDoseDeviation = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose + maxDoseDeviation = 2; // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName onOverDose = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index 592f8d67337..0d0aa735ce6 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -59,7 +59,7 @@ private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",g private _timeInSystem = GET_NUMBER(_medicationConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem")); private _timeTillMaxEffect = GET_NUMBER(_medicationConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect")); private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); -private _chanceDoses = GET_NUMBER(_medicationConfig >> "chanceDoses",getNumber (_defaultConfig >> "chanceDoses")); +private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange")); private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow")); private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal")); @@ -76,4 +76,4 @@ TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange); [_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment); // Check for medication compatiblity -[_patient, _className, _maxDose, _chanceDoses, _incompatibleMedication] call FUNC(onMedicationUsage); +[_patient, _className, _maxDose, _maxDoseDeviation, _incompatibleMedication] call FUNC(onMedicationUsage); diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index d93b3fb5af3..571c4d878aa 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -7,26 +7,27 @@ * 0: The patient * 1: Medication Treatment classname * 2: Max dosage (0 to ignore) + * 3: Max Dose Devatiation * 3: Incompatable medication > * * Return Value: * None * * Example: - * [player, "morphine", 4, [["x", 1]]] call ace_medical_treatment_fnc_onMedicationUsage + * [player, "morphine", 4, 2, [["x", 1]]] call ace_medical_treatment_fnc_onMedicationUsage * * Public: No */ -params ["_target", "_className", "_maxDose", "_chanceDoses", "_incompatibleMedication"]; -TRACE_5("onMedicationUsage",_target,_className,_maxDose,_chanceDoses,_incompatibleMedication); +params ["_target", "_className", "_maxDose", "_maxDoseDeviation", "_incompatibleMedication"]; +TRACE_5("onMedicationUsage",_target,_className,_maxDose,_maxDoseDeviation,_incompatibleMedication); private _overdosedMedications = []; // Check for overdose from current medication if (_maxDose > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); - if (_currentDose > _maxDose + (floor random _chanceDoses)) then { + if (_currentDose > _maxDose + (floor random _maxDoseDeviation)) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; }; From 005bab481ea2543dcb16f527385da500016d9b96 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:25:18 +0100 Subject: [PATCH 14/16] Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 571c4d878aa..d5db10c64dd 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -6,8 +6,8 @@ * Arguments: * 0: The patient * 1: Medication Treatment classname - * 2: Max dosage (0 to ignore) - * 3: Max Dose Devatiation + * 2: Max dose (0 to ignore) + * 3: Max dose deviation * 3: Incompatable medication > * * Return Value: From 2d5aa89671560d20744f5b2cd65ebc8dee240a52 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:15:54 -0300 Subject: [PATCH 15/16] Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index d5db10c64dd..cd26d154242 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -27,6 +27,11 @@ private _overdosedMedications = []; // Check for overdose from current medication if (_maxDose > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); + // Because both {floor random 0} and {floor random 1} return 0 + if (_maxDoseDeviation > 0) then { + _maxDoseDeviation = _maxDoseDeviation + 1; + }; + if (_currentDose > _maxDose + (floor random _maxDoseDeviation)) then { TRACE_1("exceeded max dose",_currentDose); _overdosedMedications pushBackUnique _className; From 43bdf73856e0046c8d3ab28d3b5e9b912ec4f63f Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 13 Feb 2024 02:37:30 -0800 Subject: [PATCH 16/16] Update addons/medical_treatment/ACE_Medical_Treatment.hpp --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index cee22517947..267a45dd445 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -567,7 +567,7 @@ class ADDON { timeTillMaxEffect = 30; // How many of this type of medication can be in the system before the patient can possibly overdose? maxDose = 4; - // The number of doses over maxSafeDose where there is a chance to overdose. The chance increases as dose gets higher. + // The number of doses over maxDose where there is a chance to overdose. // Example with maxDose = 4 and maxDoseDeviation = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose maxDoseDeviation = 2; // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName