1.7.5.D1222

This commit is contained in:
A Clark
2012-12-24 10:33:50 -06:00
parent 6e664d72c2
commit de7f3a17d0
16 changed files with 330 additions and 288 deletions

View File

@@ -1,23 +1,42 @@
private["_obj","_type","_config","_canLoot","_originalPos","_unitTypes","_min","_max","_num","_clean","_positions","_zombieChance","_rnd","_iPos","_nearBy","_nearByPlayer"];_obj = _this select 0;
_obj = _this select 0;
_type = typeOf _obj;
_config = configFile >> "CfgBuildingLoot" >> _type;
_canLoot = isClass (_config);
_originalPos = getPosATL _obj;
if (_canLoot) then {
//Get zombie class
//Get zombie class
_unitTypes = getArray (_config >> "zombieClass");
_min = getNumber (_config >> "maxRoaming");
_max = getNumber (_config >> "minRoaming");
//Walking Zombies
_num = round(random _max) max _min; // + round(_max / 3);
//Walking Zombies
_num = round(random _max) max _min;
_config = configFile >> "CfgBuildingLoot" >> _type;
//Get zombie class
_zombieChance = getNumber (_config >> "zombieChance");
_rnd = random 1;
if (_rnd < _zombieChance) then {
_noPlayerNear = (count ((getPosATL _obj) nearEntities ["CAManBase",30])) == 0;
if (_noPlayerNear) then {
_position = _obj buildingExit 0;
if ((_position select 0) == 0) then {
_position = getPosATL _obj;
};
//diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
for "_i" from 1 to _num do
{
for "_i" from 1 to _num do
{
[_originalPos,_unitTypes] call zombie_generate;
};
};
};
/*
//Add Internal Zombies
_clean = count ((getPosATL _obj) nearEntities ["zZombie_Base",(sizeOf _type)]) == 0;
if (_clean) then {
@@ -30,8 +49,8 @@ if (_canLoot) then {
_iPos = _obj modelToWorld _x;
//_iPos = [_iPos,0,20,20,0,0,0] call BIS_fnc_findSafePos;
//_iPos = position (_obj);
_nearBy = count nearestObjects [_iPos, ["zZombie_Base"],1] > 0;
_nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
_nearBy = count nearestObjects [_iPos , ["zZombie_Base"],1] > 0;
_nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
//diag_log ("BUILDING: " + _type + " / " + str(_nearBy) + " / " + str(_nearByPlayer));
if (!_nearByPlayer and !_nearBy) then {
@@ -41,4 +60,5 @@ if (_canLoot) then {
} forEach _positions;
};
dayz_buildingMonitor set [count dayz_buildingMonitor,_obj];
*/
};

View File

@@ -117,7 +117,7 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4))
};
*/
//flip vehicle
if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2)) then {
if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2) and (count (crew cursorTarget))== 0 and ((vectorUp cursorTarget) select 2) < 0.5) then {
if (s_player_flipveh < 0) then {
s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",cursorTarget, 1, true, true, "", ""];
};

View File

@@ -1,114 +1,83 @@
private["_type","_isAir","_inVehicle","_dateNow","_maxZombies","_maxWildZombies","_age","_nearbyBuildings","_radius","_locationstypes","_nearestCity","_position","_nearbytype"];
_type = _this select 0;
_isAir = vehicle player iskindof "Air";
_inVehicle = (vehicle player != player);
_dateNow = (DateToNumber date);
_maxZombies = dayz_maxLocalZombies;
_maxWildZombies = 3;
_age = -1;
// If they just got out of a vehicle, boost their per-player zombie limit by 5 in hopes of allowing insta-spawn zombies
_nearbyBuildings = [];
diag_log ("Type: " +str(_type));
if (dayz_inVehicle and !_inVehicle) then {
dayz_spawnWait = -300;
//_maxZombies = _maxZombies + 2;
};
dayz_inVehicle = _inVehicle;
//if (((time - dayz_spawnWait) < dayz_spawnDelay) or ((time - dayz_lootWait) < dayz_lootDelay)) exitWith {diag_log("Skipping Check since neither loot or zombies are ready");};
//if (((time - dayz_spawnWait) < dayz_spawnDelay) and ((time - dayz_lootWait) < dayz_lootDelay)) exitWith {};
//diag_log("SPAWN CHECKING: Starting");
_radius = 300;
_locationstypes = ["NameCityCapital","NameCity","NameVillage","NameLocal"];
_nearestCity = nearestLocations [getPos player, _locationstypes, _radius];
//_nearestCity = [_locationstypes,[position player,600],false] call bis_fnc_locations;
//diag_log ("0: " +str(_nearestCity));
_position = getPosATL player;
if ((count _nearestCity) > 0) then {
_position = position (_nearestCity select 0);
};
_nearbytype = type (_nearestCity select 0);
_radius = 300;
_locationstypes = ["NameCityCapital","NameCity","NameVillage","NameLocal"];
_nearestCity = nearestLocations [getPos player, _locationstypes, _radius];
_townname = text (_nearestCity select 0);
_position = getPosATL player;
if ((count _nearestCity) > 0) then {
_position = position (_nearestCity select 0);
};
_nearbytype = type (_nearestCity select 0);
switch (_nearbytype) do {
case "Hill": {
_radius = 50;
case "NameLocal": {
_radius = 200;
_maxZombies = 30;
};
case "NameLocal": {
_radius = 100;
_maxZombies = 40;
};
case "NameVillage": {
_radius = 150;
_maxZombies = 60;
_radius = 250;
_maxZombies = 40;
};
case "NameCity": {
_radius = 200;
_maxZombies = 80;
_radius = 300;
_maxZombies = 45;
};
case "NameCityCapital": {
_radius = 300;
_maxZombies = 100;
_radius = 400;
_maxZombies = 50;
};
default {
_radius = 100;
_maxZombies = 40;
_radius = 200;
_maxZombies = 20;
};
};
_nearby = _position nearObjects ["Building",_radius];
if (_inVehicle) then {
_maxZombies = _maxZombies / 2;
/*
if ((count _nearestCity) > 0) then {
_markerstr = createMarker["markername_" +str (_townname), _position];
_markerstr setMarkerText _townname;
_markerstr setMarkerColor "ColorGreen";
_markerstr setMarkerShape "ELLIPSE";
_markerstr setMarkerBrush "Grid";
_markerstr setMarkerSize [_radius, _radius];
};
_tooManyZs = count (_position nearEntities ["zZombie_Base",_radius * 2]) > _maxZombies;
{
//diag_log("SPAWN CHECK: Start of Loop");
_type = typeOf _x;
_config = configFile >> "CfgBuildingLoot" >> _type;
_canZombie = isClass (_config);
_canLoot = ((count (getArray (_config >> "lootPos"))) > 0);
_dis = _x distance player;
//diag_log ("Type: " +str(sizeOf _type));
deleteMarker "Player_Marker_Radius";
_markerstr = createMarker["Player_Marker_Radius", getPosATL player];
_markerstr setMarkerColor "ColorRed";
_markerstr setMarkerShape "ELLIPSE";
_markerstr setMarkerBrush "Border";
_markerstr setMarkerSize [_radius, _radius];
*/
if ((!_inVehicle) and (_canLoot)) then {
_keepAwayDist = ((sizeOf _type)+5);
_isNoone = {isPlayer _x} count (_x nearEntities ["CAManBase",_keepAwayDist]) == 0;
if (_isNoone) then {
_looted = (_x getVariable ["looted",0.0]);
_cleared = (_x getVariable ["cleared",true]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
if (_age > 8) then {
_x setVariable ["looted",_dateNow,true];
[_x] call building_spawnLoot;
};
};
};
if (_canZombie) 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)]);
//diag_log ("ZombiesNum: " +str(_zombiesNum));
if (_zombiesNum == 0) then {
//Randomize Zombies
_x setVariable ["zombieSpawn",_dateNow,true];
[_x] call building_spawnZombies;
};
};
};
};
};
} forEach _nearby;
switch (_type) do {
case "Zeds": {
_spawnZombies = count (getPosATL player nearEntities ["zZombie_Base",_radius]) < _maxZombies;
if (_spawnZombies) then {
_nearbyBuildings = _position nearObjects ["building",_radius];
//_nearbyBuildings = nearestObjects [getPosATL player, dayz_ZombieBuildings, _radius]; //Cant be used Not all zones are covered yet (wrecks, Buildings outside towns)
[_radius, _position, _inVehicle, _dateNow, _age, _locationstypes, _nearestCity, _maxZombies, _nearbyBuildings] call player_spawnzedCheck;
};
};
case "Loot": {
_nearbyBuildings = _position nearObjects ["building",_radius];
//_nearbyBuildings = nearestObjects [_position, dayz_LootBuildings, _radius]; //Cant be used Not all zones are covered yet (wrecks, Buildings outside towns)
[_radius, _position, _inVehicle, _dateNow, _age, _locationstypes, _nearestCity, _nearbyBuildings] call player_spawnlootCheck;
};
};

View File

@@ -1,41 +1,28 @@
private["_isAir","_inVehicle","_dateNow","_age","_radius","_locationstypes","_nearestCity","_position","_nearby","_type","_config","_canZombie","_canLoot","_dis","_keepAwayDist","_isNoone","_looted","_cleared"];
_isAir = vehicle player iskindof "Air";
_inVehicle = (vehicle player != player);
_dateNow = (DateToNumber date);
_age = -1;
private["_radius","_position","_inVehicle","_dateNow","_age","_locationstypes","_nearestCity","_nearbyBuildings","_nearby","_type","_config","_canZombie","_canLoot","_dis","_keepAwayDist","_isNoone","_looted","_cleared"];//_radius, _position, _inVehicle, _dateNow, _age, _locationstypes, _nearestCity, _nearbyBuildings
_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);
};
_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;
_nearby = _this select 7;
//_nearby = _position nearObjects ["Building",_radius / 2];
_nearby = nearestObjects [_position, ["Building"], _radius];
{
//diag_log("SPAWN CHECK: Start of Loop");
_type = typeOf _x;
_config = configFile >> "CfgBuildingLoot" >> _type;
_canZombie = isClass (_config);
_canLoot = ((count (getArray (_config >> "lootPos"))) > 0);
_dis = _x distance player;
diag_log ("Loot Started");
if ((!_inVehicle) and (_canLoot)) then {
{
if (!_inVehicle) then {
_looted = (_x getVariable ["looted",-0.1]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
if (_age > 8) then {
_keepAwayDist = ((sizeOf _type) + 5);
_isNoone = {isPlayer _x} count (_x nearEntities ["CAManBase",_keepAwayDist]) == 0;
if (_isNoone) then {
_looted = (_x getVariable ["looted",0.0]);
_cleared = (_x getVariable ["cleared",true]);
_dateNow = (DateToNumber date);
_age = (_dateNow - _looted) * 525948;
if (_age > 8) then {
_x setVariable ["looted",_dateNow,true];
[_x] call building_spawnLoot;
};
_noPlayerNear = (count ((getPosATL _x) nearEntities ["CAManBase",_keepAwayDist])) == 0;
if (_noPlayerNear) then {
_x setVariable ["looted",_dateNow,true];
[_x] call building_spawnLoot;
};
};
} forEach _nearby;
};
} forEach _nearby;

View File

@@ -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;
};
};
};
};
*/

View File

@@ -3,7 +3,7 @@ _position = _this select 0;
_unitTypes = _this select 1;
_doLoiter = true;
_isNoone = {isPlayer _x} count (_position nearEntities ["AllVehicles",30]) == 0;
_isNoone = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) == 0;
_loot = "";
_array = [];
_agent = objNull;
@@ -24,26 +24,21 @@ if (_doLoiter) then {
_radius = 40;
_method = "NONE";
};
_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30])) > 0;
//diag_log ("Spawned: " + str([_type, _position, [], _radius, _method]));
if (_nearByPlayer) then {
_position = [_position,25,80,10,0,0,0] call BIS_fnc_findSafePos;
};
_agent = createAgent [_type, _position, [], _radius, _method];
if (_doLoiter) then {
//_agent setPosATL _position;
_agent setPosATL _position;
//_agent setVariable ["doLoiter",true,true];
_agent setDir round(random 180);
} else {
_agent setVariable ["doLoiter",false,true];
};
dayz_spawnZombies = dayz_spawnZombies + 1;
//diag_log ("CREATE INFECTED: " + str(_this));
//_position = getPosATL _agent;
//_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30])) > 0;
_position = getPosATL _agent;
_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30])) > 0;
if (random 1 > 0.7) then {
_agent setUnitPos "Middle";
@@ -51,24 +46,29 @@ if (random 1 > 0.7) then {
//diag_log ("CREATED: " + str(_agent));
/*
//_agent setVariable["host",player,true];
if (!_doLoiter) then {
_agent setPosATL _position;
_agent setDir round(random 180);
_agent setVariable ["doLoiter",false,true];
if (_nearByPlayer) then {
deleteVehicle _agent;
};
} else {
if (_nearByPlayer) then {
_attempt = 0;
while {_nearByPlayer} do {
_position = [_position,40,80,10,0,20,0] call BIS_fnc_findSafePos;
_agent switchmove AidlPpneMstpSnonWnonDnon_SleepA_layDown;
_position = [_position,0,20,10,0,20,0] call BIS_fnc_findSafePos;
_agent setPos _position;
_nearByPlayer = ({isPlayer _x} count (_position nearEntities ["CAManBase",30])) > 0;
_attempt = _attempt + 1;
if (_attempt > 10) exitWith {};
} else {
_position = [_position,0,20,10,0,20,0] call BIS_fnc_findSafePos;
_agent setPosATL _position;
};
_agent setPos _position;
};
};
*/
if (isNull _agent) exitWith {
dayz_spawnZombies = dayz_spawnZombies - 1;