mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
Update loot and zombie spawn, change some count/foreach
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Created exclusively for ArmA2:OA - DayZMod.
|
||||
Please request permission to use/alter/distribute from project leader (R4Z0R49)
|
||||
*/
|
||||
private ["_type","_position","_minDist","_maxDist","_isWreck","_nearByPlayer","_iPos","_positions","_zombieChance","_unitTypes","_min","_max","_num","_clean","_obj","_config","_i","_objPos"];
|
||||
private ["_type","_position","_minDist","_maxDist","_isWreck","_nearByPlayer","_iPos","_positions","_zombieChance","_unitTypes","_min","_max","_num","_obj","_config","_i","_objPos"];
|
||||
_obj = _this select 0;
|
||||
_objPos = _this select 1;
|
||||
_config = _this select 2;
|
||||
@@ -17,8 +17,8 @@ if (!([_objPos] call DZE_SafeZonePosCheck)) then {
|
||||
_zombieChance = getNumber (_config >> "zombieChance");
|
||||
_num = round(random(_max - _min) + _min);
|
||||
_minDist = (sizeOf _type);
|
||||
_maxDist = if (_isWreck) then {(_minDist + 20)} else {(_minDist + 10)}; // zeds at crash sites can spawn further away.
|
||||
|
||||
_maxDist = [(_minDist + 10),(_minDist + 20)] select (_isWreck); // zeds at crash sites can spawn further away.
|
||||
|
||||
// Walking Zombies
|
||||
for "_i" from 0 to _num do {
|
||||
if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
|
||||
@@ -26,7 +26,7 @@ if (!([_objPos] call DZE_SafeZonePosCheck)) then {
|
||||
[_position,true,_unitTypes,_isWreck,false] call zombie_generate;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Internal Zombies
|
||||
_nearByPlayer = ({isPlayer _x} count (_objPos nearEntities ["CAManBase",30])) > 0;
|
||||
if (!_nearByPlayer) then {
|
||||
|
||||
@@ -34,6 +34,6 @@ _zPos set [2, (_zPos select 2) + 1.7];
|
||||
};
|
||||
};
|
||||
if (!_isOk) exitWith {false};
|
||||
} forEach playableUnits;
|
||||
} count playableUnits;
|
||||
|
||||
_isOk
|
||||
_isOk
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_zeds","_isWreck","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_position","_radius","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"];
|
||||
private ["_zeds","_isWreck","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_position","_radius","_inVehicle","_Controlledzeddivided","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum","_vehicle"];
|
||||
_age = -1;
|
||||
_position = [player] call fnc_getPos;
|
||||
_radius = 200; // distance from player to perform checks.
|
||||
@@ -35,13 +35,13 @@ if (_inVehicle) then {
|
||||
//Crew can spawn zeds.
|
||||
if ((count (crew _vehicle)) > 1) then {
|
||||
_Controlledzeddivided = 2;
|
||||
|
||||
|
||||
//Dont allow driver to spawn if we have other crew members.
|
||||
if (player == driver _vehicle) exitwith {_doNothing = true;};
|
||||
if (player == driver _vehicle) exitwith {_doNothing = true;};
|
||||
} else {
|
||||
_Controlledzeddivided = 4;
|
||||
};
|
||||
|
||||
|
||||
if (_Controlledzeddivided > 0) then {
|
||||
dayz_maxControlledZombies = round(dayz_maxControlledZombies / _Controlledzeddivided);
|
||||
};
|
||||
@@ -90,7 +90,7 @@ if (_doNothing) exitWith {};
|
||||
|
||||
//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",
|
||||
dayz_spawnZombies, dayz_maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies,
|
||||
dayz_spawnZombies, dayz_maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies,
|
||||
dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, dayz_currentWeaponHolders,dayz_maxMaxWeaponHolders]);
|
||||
};*/
|
||||
|
||||
@@ -110,7 +110,7 @@ _serverTime = serverTime; // Get the current time once per cycle.
|
||||
if (_canSpawn) then {
|
||||
_dis = _x distance player;
|
||||
_islocal = _x getVariable ["", false]; // object created locally via TownGenerator.
|
||||
|
||||
|
||||
//Loot
|
||||
if (dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders) then { // Check this first
|
||||
_checkLoot = (count (getArray (_config >> "lootPos"))) > 0;
|
||||
@@ -129,17 +129,17 @@ _serverTime = serverTime; // Get the current time once per cycle.
|
||||
if (_dis > _spawnZedRadius) then {
|
||||
_zombied = (_x getVariable ["zombieSpawn",_serverTime]);
|
||||
_age = _serverTime - _zombied;
|
||||
if ((_age == 0) || {_age > 300}) then {
|
||||
if ((_age == 0) || {_age > 300}) then {
|
||||
//Make sure crash sites always spawn Zeds
|
||||
_isWreck = _x isKindOf "CrashSite";
|
||||
_bPos = getPosATL _x;
|
||||
if (!_isWreck) then {
|
||||
if ((dayz_spawnZombies < dayz_maxControlledZombies) && {dayz_CurrentNearByZombies < dayz_maxNearByZombies} && {dayz_currentGlobalZombies < dayz_maxGlobalZeds}) then {
|
||||
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
|
||||
if (_zombiesNum == 0) then {
|
||||
if (_zombiesNum == 0) then {
|
||||
_x setVariable ["zombieSpawn",_serverTime,!_islocal];
|
||||
[_x,_bPos,_config,false] call building_spawnZombies;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 30)]);
|
||||
@@ -149,4 +149,4 @@ _serverTime = serverTime; // Get the current time once per cycle.
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach _nearby;
|
||||
} count _nearby;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "\z\addons\dayz_code\loot\Loot.hpp"
|
||||
|
||||
private ["_radius","_isWreck","_position","_unitTypes","_agent","_doLoiter","_type","_favStance","_lootGroup"];
|
||||
private ["_isWreck","_position","_unitTypes","_agent","_doLoiter","_type","_favStance","_lootGroup"];
|
||||
|
||||
_position = _this select 0;
|
||||
_doLoiter = _this select 1; // wander around
|
||||
@@ -9,27 +9,27 @@ _isWreck = _this select 3;
|
||||
|
||||
if (surfaceIsWater _position) exitWith { diag_log "Zombie_Generate: Location is in Water Abort"; };
|
||||
|
||||
if (_isWreck || {([_position, 15, 10, 70] call fnc_fieldOfView)}) then {
|
||||
|
||||
if (([_position, 15, 10, 70] call fnc_fieldOfView) || {_isWreck}) then {
|
||||
|
||||
if (count _unitTypes == 0) then {
|
||||
_unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass");
|
||||
};
|
||||
|
||||
|
||||
// Create zombie
|
||||
_type = _unitTypes call BIS_fnc_selectRandom;
|
||||
_agent = createAgent [_type, _position, [], 0, "CAN_COLLIDE"];
|
||||
_agent setDir (random 360);
|
||||
_agent setPosATL _position;
|
||||
_favStance = if (ceil(random 3) == 2) then {"middle"} else {"Up"};
|
||||
_favStance = ["Up","middle"] select (ceil(random 3) == 2);
|
||||
_agent setUnitPos _favStance;
|
||||
_agent setVariable ["stance", _favStance];
|
||||
_agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still
|
||||
|
||||
|
||||
// Add to global counters
|
||||
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";
|
||||
|
||||
Reference in New Issue
Block a user