Merge pull request #2044 from worldwidesorrow/master

Updates to zombie and loot spawning
This commit is contained in:
A Man
2019-11-13 10:03:12 +01:00
committed by GitHub
6 changed files with 108 additions and 170 deletions

View File

@@ -1,9 +1,14 @@
/* /*
Spawns loot at the given building. Spawns loot at the given building.
Single parameter: Parameters:
object building to spawn loot at obj - building to spawn loot at
type - classname of building
config - building configs (type, loot chance, loot positions. loot refresh timer)
Usage:
[building,classname,_config] call building_spawnLoot;
Author: Author:
Foxy Foxy
*/ */
@@ -11,37 +16,23 @@ Author:
#include "\z\addons\dayz_code\util\Vector.hpp" #include "\z\addons\dayz_code\util\Vector.hpp"
#include "\z\addons\dayz_code\loot\Loot.hpp" #include "\z\addons\dayz_code\loot\Loot.hpp"
private private ["_vectorUp","_type","_config","_lootChance","_lootPos","_lootGroup","_worldPos","_existingPile","_loot","_obj"];
[
"_vectorUp",
"_type",
"_config",
"_lootChance",
"_lootPos",
"_lootGroup",
"_worldPos",
"_existingPile",
"_loot"
];
_vectorUp = vectorUp _this; _obj = _this select 0;
_type = _this select 1;
_config = _this select 2;
_vectorUp = vectorUp _obj;
if (Vector_Angle(Vector_UP,_vectorUp) > 20) exitWith { 0 }; if (Vector_Angle(Vector_UP,_vectorUp) > 20) exitWith { 0 };
_type = typeOf _this;
_config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type;
if (!isClass _config) exitWith {};
_lootChance = getNumber (_config >> "lootChance"); _lootChance = getNumber (_config >> "lootChance");
if (_lootChance <= 0 or ([_this] call DZE_SafeZonePosCheck)) exitWith {}; if (_lootChance <= 0 or ([_obj] call DZE_SafeZonePosCheck)) exitWith {};
_lootPos = getArray (_config >> "lootPos"); _lootPos = getArray (_config >> "lootPos");
_lootGroup = Loot_GetGroup(getText(_config >> "lootGroup")); _lootGroup = Loot_GetGroup(getText(_config >> "lootGroup"));
{ {
//Get the world position of the spawn position //Get the world position of the spawn position
_worldPos = _this modelToWorld _x; _worldPos = _obj modelToWorld _x;
_worldPos set [2, 0 max (_worldPos select 2)]; _worldPos set [2, 0 max (_worldPos select 2)];
//Delete existing lootpiles within 1m of spawn location //Delete existing lootpiles within 1m of spawn location
@@ -68,7 +59,7 @@ if (isArray (_config >> "lootPosSmall")) then {
if (_lootGroup >= 1) then { if (_lootGroup >= 1) then {
{ {
//Get the world position of the spawn position //Get the world position of the spawn position
_worldPos = _this modelToWorld _x; _worldPos = _obj modelToWorld _x;
_worldPos set [2, 0 max (_worldPos select 2)]; _worldPos set [2, 0 max (_worldPos select 2)];
//Delete existing lootpiles within 1m of spawn location //Delete existing lootpiles within 1m of spawn location
{ {
@@ -84,4 +75,4 @@ if (isArray (_config >> "lootPosSmall")) then {
} else { } else {
diag_log format["Loot group small: %1 does not exist", ((getText(_config >> "lootGroup")) + "Small")]; diag_log format["Loot group small: %1 does not exist", ((getText(_config >> "lootGroup")) + "Small")];
}; };
}; };

View File

@@ -2,28 +2,17 @@
Created exclusively for ArmA2:OA - DayZMod. Created exclusively for ArmA2:OA - DayZMod.
Please request permission to use/alter/distribute from project leader (R4Z0R49) Please request permission to use/alter/distribute from project leader (R4Z0R49)
*/ */
private ["_wreck","_maxlocalspawned","_maxControlledZombies","_iPos","_nearByZed","_nearByPlayer","_rnd","_positions","_zombieChance","_unitTypes","_min","_max","_num","_clean","_obj","_type","_config","_canLoot","_originalPos","_fastRun","_enabled","_i","_Pos"]; private ["_wreck","_iPos","_nearByZed","_nearByPlayer","_rnd","_positions","_zombieChance","_unitTypes","_min","_max","_num","_clean","_obj","_type","_config","_canLoot","_originalPos","_fastRun","_enabled","_i","_Pos"];
_obj = _this select 0; _obj = _this select 0;
_type = _this select 1;
_config = _this select 2;
_wreck = false; _wreck = false;
if (count _this > 1) then { if (count _this > 3) then {
_wreck = _this select 1; _wreck = _this select 3;
}; };
_type = typeOf _obj;
_config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type;
_canLoot = isClass (_config);
_originalPos = getPosATL _obj; _originalPos = getPosATL _obj;
_maxlocalspawned = round(dayz_spawnZombies); if (!([_originalPos] call DZE_SafeZonePosCheck)) then {
//Lets check if we need to divide the amount of zeds
if (r_player_divideinvehicle > 0) then {
_maxlocalspawned = round(dayz_spawnZombies / r_player_divideinvehicle);
};
_maxControlledZombies = round(dayz_maxLocalZombies);
_enabled = false;
if (_canLoot && !([_originalPos] call DZE_SafeZonePosCheck)) then {
//Get zombie class //Get zombie class
_unitTypes = getArray (_config >> "zombieClass"); _unitTypes = getArray (_config >> "zombieClass");
_min = getNumber (_config >> "minRoaming"); _min = getNumber (_config >> "minRoaming");
@@ -37,7 +26,7 @@ if (_canLoot && !([_originalPos] call DZE_SafeZonePosCheck)) then {
for "_i" from 0 to _num do for "_i" from 0 to _num do
{ {
//_iPos = _obj modelToWorld _originalPos; //_iPos = _obj modelToWorld _originalPos;
if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then { if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
[_originalPos,true,_unitTypes,_wreck] call zombie_generate; [_originalPos,true,_unitTypes,_wreck] call zombie_generate;
}; };
}; };
@@ -56,8 +45,8 @@ if (_canLoot && !([_originalPos] call DZE_SafeZonePosCheck)) then {
_nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0; _nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0;
_nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0; _nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
//diag_log ("BUILDING: " + _type + " / " + str(_nearByZed) + " / " + str(_nearByPlayer)); //diag_log ("BUILDING: " + _type + " / " + str(_nearByZed) + " / " + str(_nearByPlayer));
if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then { if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
if (!_nearByPlayer and !_nearByZed) then { if (!_nearByPlayer and {!_nearByZed}) then {
[_iPos,false,_unitTypes,false] call zombie_generate; [_iPos,false,_unitTypes,false] call zombie_generate;
}; };
}; };

View File

@@ -1,6 +1,5 @@
private ["_isWreck","_maxControlledZombies","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_nearbyBuildings","_position","_speed","_radius","_maxlocalspawned","_maxWeaponHolders","_currentWeaponHolders","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_totalcrew","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"]; private ["_zeds","_isWreck","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_position","_speed","_radius","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_totalcrew","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"];
_age = -1; _age = -1;
//_nearbyBuildings = [];
_position = [player] call fnc_getPos; _position = [player] call fnc_getPos;
_speed = speed (vehicle player); _speed = speed (vehicle player);
_radius = 200; //150*0.707; Pointless Processing (106.5) _radius = 200; //150*0.707; Pointless Processing (106.5)
@@ -12,11 +11,23 @@ PVDZ_getTickTime = player;
publicVariableServer "PVDZ_getTickTime"; publicVariableServer "PVDZ_getTickTime";
*/ */
//Total Counts // Current zombies
_maxlocalspawned = round(dayz_spawnZombies); _zeds = entities "zZombie_Base";
_maxControlledZombies = round(dayz_maxLocalZombies); dayz_currentGlobalZombies = count _zeds;
_maxWeaponHolders = round(dayz_maxMaxWeaponHolders); dayz_spawnZombies = 0;
_currentWeaponHolders = round(dayz_currentWeaponHolders); dayz_CurrentNearByZombies = 0;
dayz_maxControlledZombies = dayz_maxLocalZombies; // This variable is also used in building_spawnZombies
{
if ((_x distance _position) < 200 && {alive _x}) then {
if (local _x) then {
dayz_spawnZombies = dayz_spawnZombies + 1;
};
dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
};
} count _zeds;
// Current loot spawns
dayz_currentWeaponHolders = count (_position nearObjects ["ReammoBox",200]);
//Limits (Land,Sea,Air) //Limits (Land,Sea,Air)
_inVehicle = (vehicle player != player); _inVehicle = (vehicle player != player);
@@ -47,8 +58,7 @@ if (_inVehicle) then {
}; };
if (_Controlledzeddivided > 0) then { if (_Controlledzeddivided > 0) then {
_maxControlledZombies = round(_maxControlledZombies / _Controlledzeddivided); dayz_maxControlledZombies = round(dayz_maxControlledZombies / _Controlledzeddivided);
r_player_divideinvehicle = _Controlledzeddivided;
}; };
}; };
@@ -95,15 +105,15 @@ if (_doNothing) exitwith {};
//Logging //Logging
diag_log (format["%1 Local.Agents: %2/%3, NearBy.Agents: %8/%9, Global.Agents: %6/%7, W.holders: %10/%11, (radius:%4m %5fps).","SpawnCheck", diag_log (format["%1 Local.Agents: %2/%3, NearBy.Agents: %8/%9, Global.Agents: %6/%7, W.holders: %10/%11, (radius:%4m %5fps).","SpawnCheck",
_maxlocalspawned, _maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies, dayz_spawnZombies, dayz_maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies,
dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, _currentWeaponHolders,_maxWeaponHolders]); dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, dayz_currentWeaponHolders,dayz_maxMaxWeaponHolders]);
};*/ };*/
// nearObjects is faster than nearestObjects when sorting by distance isn't needed // nearObjects is faster than nearestObjects when sorting by distance isn't needed
// "Building" includes House and all of its child classes (Crashsite, IC_Fireplace1, IC_Tent, etc.) // "Building" includes House and all of its child classes (Crashsite, IC_Fireplace1, IC_Tent, etc.)
_nearby = _position nearObjects ["Building",_radius]; _nearby = _position nearObjects ["Building",_radius];
_maxlocalspawned = _maxlocalspawned max floor(_maxControlledZombies*.8); dayz_spawnZombies = dayz_spawnZombies max floor(dayz_maxControlledZombies*.8);
if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; }; if (dayz_spawnZombies > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
//Spawn Zeds & loot in buildings //Spawn Zeds & loot in buildings
{ {
@@ -121,7 +131,7 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
//Loot //Loot
if (getNumber(_config >> "lootChance") > 0) then { if (getNumber(_config >> "lootChance") > 0) then {
if (_currentWeaponHolders < _maxWeaponHolders) then { if (dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders) then {
//Basic loot check //Basic loot check
if ((_dis < 125) and (_dis > 30) and !_inVehicle and _checkLoot) then { if ((_dis < 125) and (_dis > 30) and !_inVehicle and _checkLoot) then {
_serverTime = serverTime; _serverTime = serverTime;
@@ -130,7 +140,7 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
//Building refresh rate //Building refresh rate
if (_age == 0 or (_age > getNumber(_config >> "lootRefreshTimer"))) then { if (_age == 0 or (_age > getNumber(_config >> "lootRefreshTimer"))) then {
_x setVariable ["looted",_serverTime,!_islocal]; _x setVariable ["looted",_serverTime,!_islocal];
_x call building_spawnLoot; [_x,_type,_config] call building_spawnLoot;
if (!(_x in dayz_buildingBubbleMonitor)) then { if (!(_x in dayz_buildingBubbleMonitor)) then {
dayz_buildingBubbleMonitor set [count dayz_buildingBubbleMonitor, _x]; dayz_buildingBubbleMonitor set [count dayz_buildingBubbleMonitor, _x];
}; };
@@ -151,7 +161,7 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
_age = _serverTime - _zombied; _age = _serverTime - _zombied;
if ((_age == 0) or (_age > 300)) then { if ((_age == 0) or (_age > 300)) then {
if (!_isWreck) then { if (!_isWreck) then {
if ((dayz_spawnZombies < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then { if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
_bPos = getPosATL _x; _bPos = getPosATL _x;
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]); _zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
@@ -164,7 +174,7 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
}; };
//start spawn //start spawn
[_x] call building_spawnZombies; [_x,_type,_config] call building_spawnZombies;
}; };
//diag_log (format["%1 building. %2", __FILE__, _x]); //diag_log (format["%1 building. %2", __FILE__, _x]);
}; };
@@ -172,10 +182,10 @@ if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };
_bPos = getPosATL _x; _bPos = getPosATL _x;
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 30)]); _zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 30)]);
//Should be a wreck //Should be a wreck
if (_zombiesNum == 0) then { [_x,_isWreck] call building_spawnZombies; }; if (_zombiesNum == 0) then { [_x,_type,_config,_isWreck] call building_spawnZombies; };
}; };
}; };
}; };
}; };
}; };
} forEach _nearby; } forEach _nearby;

View File

@@ -1,7 +1,7 @@
#include "\z\addons\dayz_code\loot\Loot.hpp" #include "\z\addons\dayz_code\loot\Loot.hpp"
private ["_bypass","_position","_unitTypes","_radius","_method","_agent","_maxlocalspawned","_doLoiter","_wildspawns","_maxControlledZombies", private ["_bypass","_position","_unitTypes","_radius","_method","_agent","_maxlocalspawned","_doLoiter","_wildspawns","_maxControlledZombies",
"_cantSee","_isOk","_zPos","__FILE__","_fov","_safeDistance","_farDistance","_xasl","_eye","_ed","_deg","_skipFOV","_wildSpawns","_tooClose", "_cantSee","_isOk","_zPos","__FILE__","_fov","_safeDistance","_farDistance","_xasl","_eye","_ed","_deg","_skipFOV","_tooClose",
"_type","_loot","_array","_rnd","_lootType","_index","_weights","_loot_count","_favStance","_lootGroup"]; "_type","_loot","_array","_rnd","_lootType","_index","_weights","_loot_count","_favStance","_lootGroup"];
_position = _this select 0; _position = _this select 0;
@@ -10,14 +10,6 @@ _unitTypes = _this select 2; // class of wanted models
//_wildspawns = _this select 3; //_wildspawns = _this select 3;
_bypass = _this select 3; _bypass = _this select 3;
_maxlocalspawned = round(dayz_spawnZombies);
//Lets check if we need to divide the amount of zeds
if (r_player_divideinvehicle > 0) then {
_maxlocalspawned = round(dayz_spawnZombies / r_player_divideinvehicle);
};
_maxControlledZombies = round(dayz_maxLocalZombies);
_cantSee = { _cantSee = {
private "_isOk"; private "_isOk";
@@ -61,63 +53,61 @@ _cantSee = {
_skipFOV = false; _skipFOV = false;
if ((_maxlocalspawned < _maxControlledZombies) && (dayz_CurrentNearByZombies < dayz_maxNearByZombies) && (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then { if (_bypass) then {
if (_bypass) then { _skipFOV = true;
_skipFOV = true; _position = [_position,3,20,1] call fn_selectRandomLocation;
_position = [_position,3,20,1] call fn_selectRandomLocation; };
if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; };
if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then {
_tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
if (_tooClose) exitwith { diag_log "Zombie_Generate: was too close to player."; };
if (count _unitTypes == 0) then {
_unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass");
}; };
if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; };
if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then {
_tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
if (_tooClose) exitwith { diag_log "Zombie_Generate: was too close to player."; };
if (count _unitTypes == 0) then { // lets create an agent
_unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass"); _type = _unitTypes call BIS_fnc_selectRandom;
_radius = 5;
//_method = if (_doLoiter) then {"CAN_COLLIDE"} else {"NONE"};
_agent = createAgent [_type, _position, [], _radius, "CAN_COLLIDE"];
uiSleep 0.03;
//add to global counter
dayz_spawnZombies = dayz_spawnZombies + 1;
dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
dayz_currentGlobalZombies = dayz_currentGlobalZombies + 1;
//Add some loot
if (0.3 > random 1) then {
_lootGroup = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
if (isText _lootGroup) then {
//_lootGroup = dayz_lootGroups find getText (_lootGroup);
_lootGroup = Loot_GetGroup(getText _lootGroup);
//[_agent, _lootGroup, 1] call loot_insert;
Loot_Insert(_agent, _lootGroup, 1);
}; };
};
// lets create an agent _agent setVariable["agentObject",_agent];
_type = _unitTypes call BIS_fnc_selectRandom;
_radius = 5; if (!isNull _agent) then {
//_method = if (_doLoiter) then {"CAN_COLLIDE"} else {"NONE"}; _agent setDir random 360;
_agent = createAgent [_type, _position, [], _radius, "CAN_COLLIDE"];
uiSleep 0.03; uiSleep 0.03;
_position = getPosATL _agent;
//add to global counter
dayz_spawnZombies = dayz_spawnZombies + 1;
dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
dayz_currentGlobalZombies = dayz_currentGlobalZombies + 1;
//Add some loot
if (0.3 > random 1) then {
_lootGroup = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
if (isText _lootGroup) then {
//_lootGroup = dayz_lootGroups find getText (_lootGroup);
_lootGroup = Loot_GetGroup(getText _lootGroup);
//[_agent, _lootGroup, 1] call loot_insert;
Loot_Insert(_agent, _lootGroup, 1);
};
};
_agent setVariable["agentObject",_agent];
if (!isNull _agent) then { _favStance = (
_agent setDir random 360; switch ceil(random(3^0.5)^2) do {
uiSleep 0.03; //case 3: {"DOWN"}; // prone
_position = getPosATL _agent; case 2: {"middle"}; // Kneel "middle"
default {"Up"}; // stand-up
_favStance = ( }
switch ceil(random(3^0.5)^2) do { );
//case 3: {"DOWN"}; // prone _agent setUnitPos _favStance;
case 2: {"middle"}; // Kneel "middle" _agent setVariable ["stance", _favStance];
default {"Up"}; // stand-up _agent setVariable ["BaseLocation", _position];
} _agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still
);
_agent setUnitPos _favStance;
_agent setVariable ["stance", _favStance];
_agent setVariable ["BaseLocation", _position];
_agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still
};
}; };
}; };

View File

@@ -330,8 +330,7 @@ if (!isDedicated) then {
inTraderCity = "Unknown Trader"; inTraderCity = "Unknown Trader";
canPickup = false; canPickup = false;
pickupInit = false; pickupInit = false;
mouseOverCarry = false; //for carry slot since determining mouse pos doesn't work right mouseOverCarry = false; //for carry slot since determining mouse pos doesn't work right
r_player_divideinvehicle = 0;
dayz_currentWeaponHolders = 0; dayz_currentWeaponHolders = 0;
dayz_unsaved = false; dayz_unsaved = false;
dayz_scaleLight = 0; dayz_scaleLight = 0;

View File

@@ -7,7 +7,6 @@ _isPZombie = player isKindOf "PZombie_VB";
_radTimer = 0; _radTimer = 0;
_timer = diag_tickTime; _timer = diag_tickTime;
_timer1 = diag_tickTime;
_timer30 = diag_Ticktime; _timer30 = diag_Ticktime;
_timer150 = diag_ticktime; _timer150 = diag_ticktime;
_timerMonitor = diag_ticktime; _timerMonitor = diag_ticktime;
@@ -346,46 +345,6 @@ while {1 == 1} do {
}; };
}; };
if ((diag_tickTime - _timer1) > 10) then {
_position = getPosATL player;
//Other Counters
dayz_currentGlobalZombies = count entities "zZombie_Base";
_zeds = _position nearEntities ["zZombie_Base",200];
dayz_spawnZombies = 0;
dayz_CurrentNearByZombies = 0;
//Current amounts
{
if (alive _x) then {
if (local _x) then {
dayz_spawnZombies = dayz_spawnZombies + 1;
};
dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
};
} count _zeds;
//dayz_spawnZombies = {alive _x AND local _x} count (_position nearEntities ["zZombie_Base",400]);
//dayz_CurrentNearByZombies = {alive _x} count (_position nearEntities ["zZombie_Base",400]);
dayz_currentWeaponHolders = count (_position nearObjects ["ReammoBox",200]);
//Remove empty cardborad box's << this needs to be changed moved (action menu or close button)
{
//get contents
_weapons = getWeaponCargo _x;
_magazines = getMagazineCargo _x;
_backpacks = getBackpackCargo _x;
if ((count (_weapons select 0) < 1) and (count (_magazines select 0) < 1) and (count (_backpacks select 0) < 1)) then {
//remove vehicle, Need to ask server to remove.
diag_log format["Deleting empty nearby box: %1",_x];
PVDZ_obj_Delete = [_x,player];
publicVariableServer "PVDZ_obj_Delete";
};
} count (_position nearObjects ["CardboardBox",10]);
_timer1 = diag_tickTime;
};
//Two primary guns pickup exploit fix //Two primary guns pickup exploit fix
if ((DZE_TwoPrimaries < 2) && (primaryWeapon player != "") && (!(primaryWeapon player in MeleeWeapons)) && (dayz_onBack != "") && (!(dayz_onBack in MeleeWeapons)) && (isNull (findDisplay 106)) && if ((DZE_TwoPrimaries < 2) && (primaryWeapon player != "") && (!(primaryWeapon player in MeleeWeapons)) && (dayz_onBack != "") && (!(dayz_onBack in MeleeWeapons)) && (isNull (findDisplay 106)) &&
(animationState player != "amovpknlmstpslowwrfldnon_amovpknlmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon")) then { (animationState player != "amovpknlmstpslowwrfldnon_amovpknlmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon" OR animationState player != "amovpercmstpslowwrfldnon_amovpercmstpsraswrfldnon")) then {