From 4968e45e2f626ead679103ee9bb4f230aa5248b2 Mon Sep 17 00:00:00 2001 From: worldwidesorrow Date: Wed, 11 Dec 2019 20:31:43 -0600 Subject: [PATCH] Update epinephrine.sqf isDead check should be done after the animation is finished. Remove redundant setVariable entries. If the animation is interrupted, return the item to the player's inventory. Add localized string. --- SQF/dayz_code/medical/epinephrine.sqf | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/SQF/dayz_code/medical/epinephrine.sqf b/SQF/dayz_code/medical/epinephrine.sqf index 858484b7d..058112536 100644 --- a/SQF/dayz_code/medical/epinephrine.sqf +++ b/SQF/dayz_code/medical/epinephrine.sqf @@ -1,25 +1,27 @@ private ["_finished","_isDead","_unit"]; _unit = (_this select 3) select 0; -_isDead = _unit getVariable["USEC_isDead",false]; call fnc_usec_medic_removeActions; if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; +player removeMagazine "ItemEpinephrine"; _finished = ["Medic",1] call fn_loopAction; -if (!_isDead && _finished && ("ItemEpinephrine" in magazines player)) then { - player removeMagazine "ItemEpinephrine"; - _unit setVariable ["NORRN_unconscious", false, true]; - _unit setVariable ["USEC_isCardiac",false,true]; - +_isDead = _unit getVariable["USEC_isDead",false]; + +if (!_isDead && {_finished}) then { //give humanity [25,0] call player_humanityChange; - PVDZ_send = [_unit,"Epinephrine",[_unit,player,"ItemEpinephrine"]]; + PVDZ_send = [_unit,"Epinephrine",[_unit,player]]; publicVariableServer "PVDZ_send"; + + format [localize "str_actions_medical_general_give", (localize "STR_EQUIP_NAME_14"), (name _unit)] call dayz_rollingMessages; +} else { + player addMagazine "ItemEpinephrine"; }; r_action = false; -dayz_actionInProgress = false; \ No newline at end of file +dayz_actionInProgress = false;