mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-06 08:12:53 +03:00
1.7.5.D1222
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
private["_isAir","_inVehicle","_dateNow","_maxZombies","_spawnDelay","_age","_radius","_locationstypes","_nearestCity","_position","_nearbytype","_tooManyZs","_nearbyplayer","_type","_config","_canZombie","_dis","_zombied","_bPos","_zombiesNum","_withinRange"];
|
||||
private["_radius","_position","_inVehicle","_dateNow","_age","_locationstypes","_nearestCity","_maxZombies","_nearby","_maxWildZombies","_tooManyZs","_tooManyWildZs","_type","_config","_canZombie","_dis","_zombied","_bPos","_zombiesNum","_withinRange","_spawnWildZs"];
|
||||
_radius = _this select 0;
|
||||
_position = _this select 1;
|
||||
_inVehicle = _this select 2;
|
||||
_dateNow = _this select 3;
|
||||
_age = _this select 4;
|
||||
_locationstypes = _this select 5;
|
||||
_nearestCity = _this select 6;
|
||||
_maxZombies = _this select 7;
|
||||
_nearby = _this select 8;
|
||||
|
||||
_isAir = vehicle player iskindof "Air";
|
||||
_inVehicle = (vehicle player != player);
|
||||
_dateNow = (DateToNumber date);
|
||||
_maxZombies = dayz_maxLocalZombies;
|
||||
_age = -1;
|
||||
diag_log ("Zed Started");
|
||||
_maxWildZombies = 3;
|
||||
|
||||
// If they just got out of a vehicle, boost their per-player zombie limit by 5 in hopes of allowing insta-spawn zombies
|
||||
if (dayz_inVehicle and !_inVehicle) then {
|
||||
@@ -14,80 +20,42 @@ if (dayz_inVehicle and !_inVehicle) then {
|
||||
dayz_inVehicle = _inVehicle;
|
||||
|
||||
|
||||
//diag_log("SPAWN CHECKING: Starting");
|
||||
_radius = 300;
|
||||
_locationstypes = ["NameCityCapital","NameCity","NameVillage","NameLocal"];
|
||||
_nearestCity = nearestLocations [getPos player, _locationstypes, _radius];
|
||||
|
||||
_position = getPosATL player;
|
||||
if ((count _nearestCity) > 0) then {
|
||||
_position = position (_nearestCity select 0);
|
||||
};
|
||||
|
||||
|
||||
_nearbytype = type (_nearestCity select 0);
|
||||
|
||||
switch (_nearbytype) do {
|
||||
case "NameLocal": {
|
||||
_radius = 200;
|
||||
_maxZombies = 30;
|
||||
};
|
||||
case "NameVillage": {
|
||||
_radius = 250;
|
||||
_maxZombies = 40;
|
||||
};
|
||||
case "NameCity": {
|
||||
_radius = 300;
|
||||
_maxZombies = 45;
|
||||
};
|
||||
case "NameCityCapital": {
|
||||
_radius = 400;
|
||||
_maxZombies = 50;
|
||||
};
|
||||
default {
|
||||
_radius = 180;
|
||||
_maxZombies = 20;
|
||||
};
|
||||
};
|
||||
if (_inVehicle) then {
|
||||
_maxZombies = _maxZombies / 2;
|
||||
_maxWildZombies = 0;
|
||||
};
|
||||
|
||||
_tooManyZs = count (_position nearEntities ["zZombie_Base",_radius]) > _maxZombies;
|
||||
_nearby = nearestObjects [player, ["Building"], _radius];
|
||||
//_nearby = _position nearObjects ["building",_radius];
|
||||
_spawnZombies = count (_position nearEntities ["zZombie_Base",_radius]) < _maxZombies;
|
||||
// _tooManyZs = count (_position nearEntities ["zZombie_Base",_radius]) > _maxZombies;
|
||||
// _tooManyWildZs = count (_position nearEntities ["zZombie_Base",_radius]) > _maxWildZombies;
|
||||
{
|
||||
_type = typeOf _x;
|
||||
_config = configFile >> "CfgBuildingLoot" >> _type;
|
||||
_canZombie = isClass (_config);
|
||||
_dis = _x distance player;
|
||||
|
||||
if (_canZombie) then {
|
||||
//if ((time - dayz_spawnWait) > dayz_spawnDelay) then {
|
||||
if (dayz_spawnZombies < _maxZombies) then {
|
||||
if (!_tooManyZs) then {
|
||||
private["_zombied"];
|
||||
_zombied = (_x getVariable ["zombieSpawn",-0.1]);
|
||||
_dateNow = (DateToNumber date);
|
||||
_age = (_dateNow - _zombied) * 525948;
|
||||
//diag_log(format["Date: %1 | ZombieSpawn: %2 | age: %3 | building: %4 (%5)", _dateNow, _zombied, _age, str(_x), _dis]);
|
||||
if (_age > 1) then {
|
||||
_bPos = getPosATL _x;
|
||||
_zombiesNum = count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
|
||||
_withinRange = _x distance player < _radius;
|
||||
//diag_log ("ZombiesNum: " +str(_zombiesNum));
|
||||
if ((_zombiesNum == 0) and _withinRange) then {
|
||||
//if (_zombiesNum == 0) then {
|
||||
//Randomize Zombies
|
||||
_x setVariable ["zombieSpawn",_dateNow,true];
|
||||
[_x] call building_spawnZombies;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
dayz_spawnWait = time;
|
||||
dayz_spawnZombies = count (_position nearEntities ["zZombie_Base",_radius]);
|
||||
};
|
||||
};
|
||||
if (dayz_spawnZombies > _maxZombies) exitwith {};
|
||||
_zombied = (_x getVariable ["zombieSpawn",-0.1]);
|
||||
_dateNow = (DateToNumber date);
|
||||
_age = (_dateNow - _zombied) * 525948;
|
||||
//diag_log(format["Date: %1 | ZombieSpawn: %2 | age: %3 | building: %4 (%5)", _dateNow, _zombied, _age, str(_x), _dis]);
|
||||
if (_age > 1) then {
|
||||
//_withinRange = _x distance player < 200;
|
||||
//if (_withinRange) then {
|
||||
_x setVariable ["zombieSpawn",_dateNow,true];
|
||||
[_x] call building_spawnZombies;
|
||||
//};
|
||||
};
|
||||
} forEach _nearby;
|
||||
_running = 0
|
||||
/*
|
||||
if ((count _nearby) < 1) then {
|
||||
diag_log ("1");
|
||||
_spawnWildZs = count (_position nearEntities ["zZombie_Base",_radius]);
|
||||
if (_spawnWildZs < _maxWildZombies) then {
|
||||
diag_log ("2");
|
||||
if (!_tooManyWildZs) then {
|
||||
diag_log ("3");
|
||||
_zombiesNum = count (_position nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
|
||||
//diag_log ("ZombiesNum: " +str(_zombiesNum));
|
||||
if (_zombiesNum == 0) then {
|
||||
diag_log ("4");
|
||||
[_position] call wild_spawnZombies;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
*/
|
||||
Reference in New Issue
Block a user