From 450990282265f70d12ee7e4d127c46f62c4109a6 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 2 Oct 2016 13:25:55 -0400 Subject: [PATCH 1/4] Remove source object from Humanity hit network send Source object is always player and not needed anymore after 8ea21a2 --- SQF/dayz_code/compile/fn_damageHandler.sqf | 2 +- SQF/dayz_code/compile/player_death.sqf | 2 +- SQF/dayz_code/compile/player_humanityChange.sqf | 7 +++---- SQF/dayz_code/medical/antibiotics.sqf | 2 +- SQF/dayz_code/medical/bandage.sqf | 2 +- SQF/dayz_code/medical/brokeBones.sqf | 2 +- SQF/dayz_code/medical/epinephrine.sqf | 2 +- SQF/dayz_code/medical/morphine.sqf | 2 +- SQF/dayz_code/medical/painkiller.sqf | 2 +- SQF/dayz_code/medical/transfusion.sqf | 2 +- SQF/dayz_code/system/player_spawn_2.sqf | 6 +++--- 11 files changed, 15 insertions(+), 16 deletions(-) diff --git a/SQF/dayz_code/compile/fn_damageHandler.sqf b/SQF/dayz_code/compile/fn_damageHandler.sqf index 09e0619c6..fe12f4296 100644 --- a/SQF/dayz_code/compile/fn_damageHandler.sqf +++ b/SQF/dayz_code/compile/fn_damageHandler.sqf @@ -116,7 +116,7 @@ if (_unit == player) then { private ["_source","_humanityHit"]; _source = _this select 0; _humanityHit = _this select 1; - PVDZ_send = [_source,"Humanity",[_source,_humanityHit,30]]; + PVDZ_send = [_source,"Humanity",[_humanityHit,30]]; publicVariableServer "PVDZ_send"; }; }; diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index 4fb45eada..08b05cf63 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -95,7 +95,7 @@ if (count _array > 0) then { _humanityHit = -(2000 - _myKills); _kills = _source getVariable ["humanKills",0]; _source setVariable ["humanKills",(_kills + 1),true]; - PVDZ_send = [_source,"Humanity",[_source,_humanityHit,300]]; + PVDZ_send = [_source,"Humanity",[_humanityHit,300]]; publicVariableServer "PVDZ_send"; } else { //i'm "guilty" - kill me as bandit diff --git a/SQF/dayz_code/compile/player_humanityChange.sqf b/SQF/dayz_code/compile/player_humanityChange.sqf index 99c1b36e1..92f9d8d4b 100644 --- a/SQF/dayz_code/compile/player_humanityChange.sqf +++ b/SQF/dayz_code/compile/player_humanityChange.sqf @@ -1,7 +1,6 @@ -private ["_object","_change","_wait","_humanity","_model","_isMen","_isMenH","_isMenB","_isWomen","_isWomenH","_isWomenB"]; -_object = _this select 0; -_change = _this select 1; -_wait = if (count _this > 2) then { _this select 2 } else { 0 }; +private ["_change","_wait","_humanity","_model","_isMen","_isMenH","_isMenB","_isWomen","_isWomenH","_isWomenB"]; +_change = _this select 0; +_wait = _this select 1; _humanity = (player getVariable["humanity",0]) + _change; player setVariable["humanity",_humanity,true]; diff --git a/SQF/dayz_code/medical/antibiotics.sqf b/SQF/dayz_code/medical/antibiotics.sqf index 7a6c3e92c..a21ffe537 100644 --- a/SQF/dayz_code/medical/antibiotics.sqf +++ b/SQF/dayz_code/medical/antibiotics.sqf @@ -45,7 +45,7 @@ if (_hasAntibiotics) then { publicVariableServer "PVDZ_send"; //Give humnaity for good deeds - [player,20] call player_humanityChange; + [20,0] call player_humanityChange; _msg = "str_actions_medical_gave_antibiotics"; }; diff --git a/SQF/dayz_code/medical/bandage.sqf b/SQF/dayz_code/medical/bandage.sqf index 160977c43..480743cfb 100644 --- a/SQF/dayz_code/medical/bandage.sqf +++ b/SQF/dayz_code/medical/bandage.sqf @@ -55,7 +55,7 @@ if (_finished) then { } else { PVDZ_send = [_unit,"Bandage",[_unit,player]]; publicVariableServer "PVDZ_send"; - [player,20] call player_humanityChange; + [20,0] call player_humanityChange; }; } else { r_interrupt = false; diff --git a/SQF/dayz_code/medical/brokeBones.sqf b/SQF/dayz_code/medical/brokeBones.sqf index 752fe929d..42cc2d162 100644 --- a/SQF/dayz_code/medical/brokeBones.sqf +++ b/SQF/dayz_code/medical/brokeBones.sqf @@ -51,7 +51,7 @@ if (_finished) then { //Give humanity reward to player giving the morphine to another player. if (_item in ["ItemMorphine"]) then { - [player,50] call player_humanityChange; + [50,0] call player_humanityChange; }; }; diff --git a/SQF/dayz_code/medical/epinephrine.sqf b/SQF/dayz_code/medical/epinephrine.sqf index e0ce39a5a..203c7a655 100644 --- a/SQF/dayz_code/medical/epinephrine.sqf +++ b/SQF/dayz_code/medical/epinephrine.sqf @@ -14,7 +14,7 @@ if (!_isDead) then { uiSleep 5; //give humanity - [player,25] call player_humanityChange; + [25,0] call player_humanityChange; PVDZ_send = [_unit,"Epinephrine",[_unit,player,"ItemEpinephrine"]]; publicVariableServer "PVDZ_send"; diff --git a/SQF/dayz_code/medical/morphine.sqf b/SQF/dayz_code/medical/morphine.sqf index 3010f595b..8826178e2 100644 --- a/SQF/dayz_code/medical/morphine.sqf +++ b/SQF/dayz_code/medical/morphine.sqf @@ -46,7 +46,7 @@ if ((_unit == player) or (vehicle player != player)) then { _id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf"; } else { //PVCDZ_plr_Humanity = [player,50]; - [player,50] call player_humanityChange; + [50,0] call player_humanityChange; }; //["PVCDZ_hlt_Morphine",[_unit,player]] call broadcastRpcCallAll; diff --git a/SQF/dayz_code/medical/painkiller.sqf b/SQF/dayz_code/medical/painkiller.sqf index 18000e4fd..74eb6d3e8 100644 --- a/SQF/dayz_code/medical/painkiller.sqf +++ b/SQF/dayz_code/medical/painkiller.sqf @@ -16,7 +16,7 @@ if ((_unit == player) or (vehicle player != player)) then { _id = [player,player] execVM "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf"; } else { //PVCDZ_plr_Humanity = [player,20]; - [player,20] call player_humanityChange; + [20,0] call player_humanityChange; }; player removeMagazine "ItemPainkiller"; diff --git a/SQF/dayz_code/medical/transfusion.sqf b/SQF/dayz_code/medical/transfusion.sqf index cb8459c80..58f8aeccf 100644 --- a/SQF/dayz_code/medical/transfusion.sqf +++ b/SQF/dayz_code/medical/transfusion.sqf @@ -194,7 +194,7 @@ while {r_doLoop} do { localize "str_actions_medical_transfusion_successful" call dayz_rollingMessages; //see Note 1 //[player,_unit,"loc",rTITLETEXT,localize "str_actions_medical_transfusion_successful","PLAIN DOWN"] call RE; - if (!_badBag and _bagFound) then { [player,_humanityAwarded] call player_humanityChange; }; + if (!_badBag and _bagFound) then { [_humanityAwarded,0] call player_humanityChange; }; r_doLoop = false; }; diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index f03e0d971..8d460c770 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -23,7 +23,7 @@ _timerMonitor = diag_ticktime; player setVariable ["temperature",dayz_temperatur,true]; player setVariable["friendlies",DZE_Friends,true]; -[player,0] call player_humanityChange; +[0,0] call player_humanityChange; //player addMagazine "Hatchet_swing"; //player addWeapon "MeleeHatchet"; @@ -79,7 +79,7 @@ while {1 == 1} do { _humanity = player getVariable ["humanity",0]; if (_humanity < 1 or _forceHumanity) then { if (vehicle player != player) then { - [player, round(_timeOut / 10)] call player_humanityChange; + [round(_timeOut / 10),0] call player_humanityChange; _forceHumanity = false; } else { _humanity = _humanity + round(_timeOut / 10); @@ -93,7 +93,7 @@ while {1 == 1} do { /* if ((Dayz_loginCompleted) && (diag_tickTime < 25)) then { - [player,0] call player_humanityChange; + [0,0] call player_humanityChange; diag_log ("Running"); _timer10 = diag_Ticktime; From 55910cc3d2d57b2105430a46d9fb2688e6d9be0b Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 2 Oct 2016 13:50:30 -0400 Subject: [PATCH 2/4] 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; }; From c4f861630d8cd0d06909edb19c1170d988a491f7 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 2 Oct 2016 13:57:33 -0400 Subject: [PATCH 3/4] Fix typo from 55910cc Variable is not defined in this script. --- SQF/dayz_code/compile/player_death.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index bf108ad26..2446d8595 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -81,7 +81,7 @@ if (count _array > 0) then { //_isBandit = (_model in ["Bandit1_DZ","BanditW1_DZ"]); //if you are a bandit or start first - player will not recieve humanity drop - _punishment = ((_isBandit or {player getVariable ["OpenTarget",false]}) && !_isPZombie); + _punishment = ((_isBandit or {player getVariable ["OpenTarget",false]}) && !(player isKindOf "PZombie_VB")); _humanityHit = 0; if (!_punishment) then { From 91f168011cf4e2613d60788c3e8574cedd83ec18 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 2 Oct 2016 14:11:20 -0400 Subject: [PATCH 4/4] Remove unused variable from #1770 _inventoryMoney was unused @oiad --- .../AdvancedTrading/functions/z_at_returnChange.sqf | 7 +++---- SQF/dayz_code/compile/epoch_returnChange.sqf | 7 +++---- SQF/dayz_code/stringtable.xml | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_returnChange.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_returnChange.sqf index 1726ae384..2a7b13dc0 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_returnChange.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_returnChange.sqf @@ -24,12 +24,11 @@ Z_ChangeOverflow = false; if (_combine) then { _trade_total = 0; _total_currency = 0; - _inventoryMoney = []; _combineOk = 1; { - _part = (configFile >> "CfgMagazines" >> _x); - _worth = (_part >> "worth"); - if isNumber (_worth) then { + _part = configFile >> "CfgMagazines" >> _x; + _worth = (_part >> "worth"); + if (isNumber _worth) then { _combineOk = [player,_part,1] call BIS_fnc_invRemove; _total_currency = _total_currency + getNumber(_worth); } else { diff --git a/SQF/dayz_code/compile/epoch_returnChange.sqf b/SQF/dayz_code/compile/epoch_returnChange.sqf index b901a9af0..b5b548fe3 100644 --- a/SQF/dayz_code/compile/epoch_returnChange.sqf +++ b/SQF/dayz_code/compile/epoch_returnChange.sqf @@ -36,14 +36,13 @@ if (_canAfford) then { // total currency _total_currency = 0; { - _part = (configFile >> "CfgMagazines" >> _x); - _worth = (_part >> "worth"); - if isNumber (_worth) then { + _part = configFile >> "CfgMagazines" >> _x; + _worth = (_part >> "worth"); + if (isNumber _worth) then { if (([player,_part,1] call BIS_fnc_invRemove) == 1) then { _total_currency = _total_currency + getNumber(_worth); }; }; - } count (magazines player); //diag_log format["DEBUG TRADER INPUT CURRENCY TOTAL: %1", _total_currency]; diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index cd16c14da..114b8e603 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -2737,7 +2737,6 @@ M9 Silenciada M9 Silencieux M9 s tlumičem - M9 SD Blueprint to create a M9SD. Required - 1 M9, 1 Attachment_Silencer. - ToolBox