diff --git a/addons/medical_status/functions/fnc_initUnit.sqf b/addons/medical_status/functions/fnc_initUnit.sqf index 078bcafeef..c5b381c017 100644 --- a/addons/medical_status/functions/fnc_initUnit.sqf +++ b/addons/medical_status/functions/fnc_initUnit.sqf @@ -63,15 +63,8 @@ _unit setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true]; // medication _unit setVariable [VAR_MEDICATIONS, [], true]; -// TODO move to treatment -private _logs = _unit getVariable [QEGVAR(medical,allLogs), []]; -{ - _unit setVariable [_x, nil]; -} forEach _logs; -_unit setVariable [QEGVAR(medical,allLogs), [], true]; - [{ params ["_unit"]; TRACE_2("Unit Init",_unit,local _unit); - [QGVAR(initialized), [_unit]] call CBA_fnc_localEvent; -}, [_unit], 0.5] call CBA_fnc_waitAndExecute; + [QGVAR(initialized), _unit] call CBA_fnc_localEvent; +}, _unit, 0.5] call CBA_fnc_waitAndExecute; diff --git a/addons/medical_treatment/XEH_postInit.sqf b/addons/medical_treatment/XEH_postInit.sqf index 4eca095dbc..a17469a648 100644 --- a/addons/medical_treatment/XEH_postInit.sqf +++ b/addons/medical_treatment/XEH_postInit.sqf @@ -1,6 +1,18 @@ #include "script_component.hpp" -[QEGVAR(medical_status,initialized), FUNC(checkItems)] call CBA_fnc_addEventHandler; +[QEGVAR(medical_status,initialized), { + params ["_unit"]; + + // Clear all saved medical logs + { + _unit setVariable [_x, nil, true]; + } forEach (_unit getVariable [QEGVAR(medical,allLogs), []]); + + _unit setVariable [QEGVAR(medical,allLogs), [], true]; + + [_unit] call FUNC(checkItems); +}] call CBA_fnc_addEventHandler; + ["loadout", FUNC(checkItems)] call CBA_fnc_addPlayerEventHandler; // Handle bodybags and litter on server