From 8dc6ef8def7d362518b4234c9108214eb307155e Mon Sep 17 00:00:00 2001 From: AirwavesMan Date: Thu, 22 Oct 2020 12:05:56 +0200 Subject: [PATCH] Update player_harvest.sqf Fix that trees going down directly after hit by a chainsaw or hatchet. This is a long time bug because DZE_TEMP_treedmg got not resetted after the tree was cut down. Also, this commit makes sure that every tree gives at least 16 or more wood on harvesting. Ive added that to reduce the number of cut down trees to not affect the network traffic too much as it is the case at the moment. All trees and damage get sync over the network. --- SQF/dayz_code/compile/player_harvest.sqf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SQF/dayz_code/compile/player_harvest.sqf b/SQF/dayz_code/compile/player_harvest.sqf index 00d34cdc4..35d49994e 100644 --- a/SQF/dayz_code/compile/player_harvest.sqf +++ b/SQF/dayz_code/compile/player_harvest.sqf @@ -19,7 +19,11 @@ if (_ammo in ["Hatchet_Swing_Ammo","Chainsaw_Swing_Ammo"]) then { // damage must be going down _damage = damage _tree; if (DZE_TEMP_treedmg < _damage) then { - if (_damage < 0.99 && {(random 1) > 0.9}) then { + if (isNil "DZE_WoodCounter") then { + DZE_WoodCounter = 0; + }; + DZE_WoodCounter = DZE_WoodCounter + 1; + if (_damage < 0.99 && {(random 1) > 0.9} && {DZE_WoodCounter > 15}) then { if (typeOf _tree == "") then { // Ask server to setDamage on tree and sync for JIP PVDZ_objgather_Knockdown = [_tree,player]; @@ -27,8 +31,10 @@ if (_ammo in ["Hatchet_Swing_Ammo","Chainsaw_Swing_Ammo"]) then { } else { deleteVehicle _tree; }; + DZE_TEMP_treedmg = 1; + DZE_WoodCounter = nil; }; - _itemOut = [["PartWoodPile","PartWoodPile","ItemLog"] call BIS_fnc_selectRandom,"PartWoodLumber"] select (_ammo == "Chainsaw_Swing_Ammo"); + _itemOut = [["PartWoodPile","PartWoodPile","ItemLog"] call BIS_fnc_selectRandom,"PartWoodLumber"] select (_ammo == "Chainsaw_Swing_Ammo"); [_itemOut,1,1] call fn_dropItem; [player,60,false,getPosATL player] spawn player_alertZombies;