From 55910cc3d2d57b2105430a46d9fb2688e6d9be0b Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 2 Oct 2016 13:50:30 -0400 Subject: [PATCH] Remove humanity hit for killing player zombies If you kill a player zombie you should not lose humanity. Player_death is now synced with the humanity hit code in the damage handler. Also the killing blow set variable was moved up because the same conditions were already checked above. --- SQF/dayz_code/compile/fn_damageHandler.sqf | 5 +---- SQF/dayz_code/compile/player_death.sqf | 13 ++++--------- SQF/dayz_code/medical/morphine.sqf | 1 - SQF/dayz_code/medical/painkiller.sqf | 1 - 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index fe12f4296..6fa184888 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -94,10 +94,7 @@ if (_unit == player) then { // - Accidental Murder - \\ When wearing the garb of a non-civilian you are taking your life in your own hands // Attackers humanity should not be punished for killing a survivor who has shrouded his identity in military garb. - _punishment = - ((_isBandit || - {player getVariable ["OpenTarget",false]}) && - {!_isPZombie}); + _punishment = ((_isBandit or {player getVariable ["OpenTarget",false]}) && !_isPZombie); _humanityHit = 0; if (!_punishment && {(dayz_lastHumanityChange + 3) < diag_tickTime}) then { diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index 08b05cf63..bf108ad26 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -76,14 +76,12 @@ _array = _this; if (count _array > 0) then { _source = _array select 0; _method = _array select 1; - if ((!isNull _source) && (_source != player)) then { + if (!isNull _source && _source != player && isPlayer _source) then { //Don't send humanity hit to AI units _isBandit = (player getVariable["humanity",0]) <= -2000; //_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]); //if you are a bandit or start first - player will not recieve humanity drop - _punishment = - _isBandit || - {player getVariable ["OpenTarget",false]}; + _punishment = ((_isBandit or {player getVariable ["OpenTarget",false]}) && !_isPZombie); _humanityHit = 0; if (!_punishment) then { @@ -102,13 +100,10 @@ if (count _array > 0) then { _killsV = _source getVariable ["banditKills",0]; _source setVariable ["banditKills",(_killsV + 1),true]; }; - }; - _body setVariable ["deathType",_method,true]; - - //Setup for study bodys. - if ((!isNull _source) && (_source != player)) then { + //Setup for study bodys. _body setVariable ["KillingBlow",_source,true]; }; + _body setVariable ["deathType",_method,true]; }; terminate dayz_musicH; diff --git a/SQF/dayz_code/medical/morphine.sqf b/SQF/dayz_code/medical/morphine.sqf index 8826178e2..a8eea213f 100644 --- a/SQF/dayz_code/medical/morphine.sqf +++ b/SQF/dayz_code/medical/morphine.sqf @@ -45,7 +45,6 @@ if ((_unit == player) or (vehicle player != player)) then { //Self Healing _id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf"; } else { - //PVCDZ_plr_Humanity = [player,50]; [50,0] call player_humanityChange; }; diff --git a/SQF/dayz_code/medical/painkiller.sqf b/SQF/dayz_code/medical/painkiller.sqf index 74eb6d3e8..7431a8121 100644 --- a/SQF/dayz_code/medical/painkiller.sqf +++ b/SQF/dayz_code/medical/painkiller.sqf @@ -15,7 +15,6 @@ if ((_unit == player) or (vehicle player != player)) then { //Self Healing _id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf"; } else { - //PVCDZ_plr_Humanity = [player,20]; [20,0] call player_humanityChange; };