From de7f3a17d04fc81f0bfbec10146ab98b96b5abf5 Mon Sep 17 00:00:00 2001 From: A Clark Date: Mon, 24 Dec 2012 10:33:50 -0600 Subject: [PATCH] 1.7.5.D1222 --- dayz_code/compile/building_spawnZombies.sqf | 36 ++++- dayz_code/compile/fn_selfActions.sqf | 2 +- dayz_code/compile/player_spawnCheck.sqf | 147 +++++++----------- dayz_code/compile/player_spawnlootCheck.sqf | 57 +++---- dayz_code/compile/player_spawnzedCheck.sqf | 124 ++++++--------- dayz_code/compile/zombie_generate.sqf | 38 ++--- dayz_code/config.cpp | 62 +++++++- dayz_code/init/compiles.sqf | 6 +- dayz_code/init/loot_init.sqf | 21 ++- dayz_code/init/variables.sqf | 6 +- dayz_code/rscTitles.hpp | 2 +- dayz_code/system/player_monitor.fsm | 16 +- dayz_code/system/zombie_agent.fsm | 33 ++-- .../compile/server_onPlayerDisconnect.sqf | 3 +- dayz_server/compile/server_spawnCrashSite.sqf | 49 ++++-- dayz_server/system/server_monitor.sqf | 16 +- 16 files changed, 330 insertions(+), 288 deletions(-) diff --git a/dayz_code/compile/building_spawnZombies.sqf b/dayz_code/compile/building_spawnZombies.sqf index 1be474246..a2f884c95 100644 --- a/dayz_code/compile/building_spawnZombies.sqf +++ b/dayz_code/compile/building_spawnZombies.sqf @@ -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]; +*/ }; \ No newline at end of file diff --git a/dayz_code/compile/fn_selfActions.sqf b/dayz_code/compile/fn_selfActions.sqf index 2186490f3..9e0a97fcb 100644 --- a/dayz_code/compile/fn_selfActions.sqf +++ b/dayz_code/compile/fn_selfActions.sqf @@ -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, "", ""]; }; diff --git a/dayz_code/compile/player_spawnCheck.sqf b/dayz_code/compile/player_spawnCheck.sqf index ea261dc86..1f951c35f 100644 --- a/dayz_code/compile/player_spawnCheck.sqf +++ b/dayz_code/compile/player_spawnCheck.sqf @@ -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; \ No newline at end of file +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; + }; +}; \ No newline at end of file diff --git a/dayz_code/compile/player_spawnlootCheck.sqf b/dayz_code/compile/player_spawnlootCheck.sqf index 29e9def2d..9f464c3b5 100644 --- a/dayz_code/compile/player_spawnlootCheck.sqf +++ b/dayz_code/compile/player_spawnlootCheck.sqf @@ -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; \ No newline at end of file + }; +} forEach _nearby; \ No newline at end of file diff --git a/dayz_code/compile/player_spawnzedCheck.sqf b/dayz_code/compile/player_spawnzedCheck.sqf index 2946c2d69..1347db1f9 100644 --- a/dayz_code/compile/player_spawnzedCheck.sqf +++ b/dayz_code/compile/player_spawnzedCheck.sqf @@ -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 \ No newline at end of file +/* + 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; + }; + }; + }; + }; +*/ \ No newline at end of file diff --git a/dayz_code/compile/zombie_generate.sqf b/dayz_code/compile/zombie_generate.sqf index ee4cf0557..fa1bc57d8 100644 --- a/dayz_code/compile/zombie_generate.sqf +++ b/dayz_code/compile/zombie_generate.sqf @@ -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; diff --git a/dayz_code/config.cpp b/dayz_code/config.cpp index a1f2f4238..0e03f2c0a 100644 --- a/dayz_code/config.cpp +++ b/dayz_code/config.cpp @@ -33,7 +33,7 @@ class CfgMods hidePicture = 0; hideName = 0; action = "http://www.dayzmod.com"; - version = "1.7.5.D1216"; + version = "1.7.5.D1222"; hiveVersion = 0.96; //0.93 }; }; @@ -406,6 +406,66 @@ class CfgBuildingLoot { 0.05 }; }; +class HeliCrash_No50s: Default { + zombieChance = 0; + maxRoaming = 2; + zombieClass[] = {"z_soldier_pilot"}; + lootChance = 0.5; + lootPos[] = {}; + itemType[] = { + {"FN_FAL","weapon"}, + {"bizon_silenced","weapon"}, + {"M14_EP1","weapon"}, + {"FN_FAL_ANPVS4","weapon"}, +// {"M107_DZ","weapon"}, +// {"BAF_AS50_scoped","weapon"}, + {"Mk_48_DZ","weapon"}, + {"M249_DZ","weapon"}, + //{"BAF_L85A2_RIS_CWS","weapon"}, + {"BAF_L85A2_RIS_Holo","weapon"}, + {"DMR","weapon"}, + {"","military"}, + {"","medical"}, + {"MedBox0","object"}, + {"NVGoggles","weapon"}, + {"AmmoBoxSmall_556","object"}, + {"AmmoBoxSmall_762","object"}, + {"Skin_Camo1_DZ","magazine"}, + {"Skin_Sniper1_DZ","magazine"}, + {"G36C","weapon"}, + {"G36C_camo","weapon"}, + //{"G36_C_SD_camo","weapon"}, + {"G36A_camo","weapon"}, + {"G36K_camo","weapon"}, + {"100Rnd_762x54_PK","magazine"} + }; + itemChance[] = { + 0.02, //{"FN_FAL","weapon"}, + 0.05, //{"bizon_silenced","weapon"}, + 0.05, //{"M14_EP1","weapon"}, + 0.02, //{"FN_FAL_ANPVS4","weapon"}, +// 0.02, //{"m107","weapon"}, +// 0.01, //{"BAF_AS50_scoped","weapon"}, + 0.03, //{"Mk_48_DZ","weapon"}, + 0.05, //{"M249_DZ","weapon"}, + 0.01, //{"BAF_L85A2_RIS_CWS","weapon"}, BAF_L85A2_RIS_Holo + 0.06, //{"DMR","weapon"}, + 1, //{"","military"}, + 0.5, //{"","medical"}, + 0.1, //{"MedBox0","object"}, + 0.02, //{"NVGoggles","weapon"} + 0.1, //AmmoBoxSmall_556 + 0.1, //AmmoBoxSmall_762 + 0.08, //Skin_Camo1_DZ + 0.05, //Skin_Sniper1_DZ + 0.03, //G36C" + 0.02, //G36C_camo + //0.01, //G36_C_SD_camo + 0.02, //G36A_camo + 0.02, //G36K_camo + 0.01 //("100Rnd_762x54_PK","magazine"} + }; + }; class Hospital: Default { zombieChance = 0.4; minRoaming = 2; diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf index 465157768..ec2d1b01f 100644 --- a/dayz_code/init/compiles.sqf +++ b/dayz_code/init/compiles.sqf @@ -19,6 +19,7 @@ if (!isDedicated) then { player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf"; player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf"; + player_spawnCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf"; player_spawnLootCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnlootCheck.sqf"; player_spawnZedCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnzedCheck.sqf"; building_spawnLoot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnLoot.sqf"; @@ -49,7 +50,6 @@ if (!isDedicated) then { player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf"; player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf"; player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf"; - player_combatCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_combatCheck.sqf"; //Objects object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf"; @@ -60,6 +60,10 @@ if (!isDedicated) then { zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour + //Wild + //wild_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\wild_spawnZombies.sqf"; + + // dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf"; // Vehicle damage fix diff --git a/dayz_code/init/loot_init.sqf b/dayz_code/init/loot_init.sqf index 922c4243e..df2ca2801 100644 --- a/dayz_code/init/loot_init.sqf +++ b/dayz_code/init/loot_init.sqf @@ -1,4 +1,4 @@ -private["_cfgCount","_i","_j","_k","_l","_config","_defaultCfg","_itemTypes","_itemChances","_itemCount","_weighted","_weight"]; +private["_cfgCount","_config","_i","_itemChances","_itemCount","_weighted","_j","_weight","_l","_k","_type","_canZombie","_canLoot"]; dayz_CBLChances = []; dayz_CBLCounts = []; @@ -41,3 +41,22 @@ for "_i" from 0 to ((count (_config)) - 1) do { dayz_CLBase set [count dayz_CLBase, configName (_config select _i)]; dayz_CLChances set [count dayz_CLChances, _weighted]; }; + +private["_i","_type","_config","_canZombie","_canLoot"]; +dayz_ZombieBuildings = []; +dayz_LootBuildings = []; +for "_i" from 0 to (count (configFile >> "CfgBuildingLoot") - 1) do { + _type = (configFile >> "CfgBuildingLoot") select _i; + _canZombie = getNumber (_type >> "zombieChance") > 0; + _canLoot = getNumber (_type >> "lootChance") > 0; + if(_canZombie) then { + if(!((configName _type) in dayz_ZombieBuildings)) then { + dayz_ZombieBuildings set [count dayz_ZombieBuildings, configName _type]; + }; + }; + if(_canLoot) then { + if(!((configName _type) in dayz_LootBuildings)) then { + dayz_LootBuildings set [count dayz_LootBuildings, configName _type]; + }; + }; +}; diff --git a/dayz_code/init/variables.sqf b/dayz_code/init/variables.sqf index 1192326d5..91aa87f99 100644 --- a/dayz_code/init/variables.sqf +++ b/dayz_code/init/variables.sqf @@ -230,11 +230,7 @@ dayz_maxAnimals = 5; DAYZ_agentnumber = 0; dayz_animalDistance = 800; dayz_zSpawnDistance = 1000; - -if(isnil "dayz_maxLocalZombies") then { - dayz_maxLocalZombies = 40; -}; - +dayz_maxLocalZombies = 40; dayz_spawnPos = getPosATL player; //init global arrays for Loot Chances diff --git a/dayz_code/rscTitles.hpp b/dayz_code/rscTitles.hpp index 84a76909d..b49621e34 100644 --- a/dayz_code/rscTitles.hpp +++ b/dayz_code/rscTitles.hpp @@ -87,7 +87,7 @@ class RscDisplayMain : RscStandardDisplay class DAYZ_Version : CA_Version { idc = -1; - text = "DayZ 1.7.5.D1216"; + text = "DayZ 1.7.5.D1222"; y = "(SafeZoneH + SafeZoneY) - (1 - 0.95)"; }; class CA_TitleMainMenu; diff --git a/dayz_code/system/player_monitor.fsm b/dayz_code/system/player_monitor.fsm index 8ce45e13e..edf74ea67 100644 --- a/dayz_code/system/player_monitor.fsm +++ b/dayz_code/system/player_monitor.fsm @@ -1,4 +1,4 @@ -/*%FSM*/ +/*%FSM*/ /*%FSM*/ /* item0[] = {"init",0,250,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"init"}; @@ -36,7 +36,7 @@ item31[] = {"ERROR__Bad_Versi",2,250,175.000000,650.000000,275.000000,700.000000 item32[] = {"Display_Ready",4,218,-175.000000,900.000000,-75.000000,950.000000,0.000000,"Display" \n "Ready"}; item33[] = {"Preload_Display",2,250,-75.000000,950.000000,25.000000,1000.000000,0.000000,"Preload" \n "Display"}; item34[] = {"Preload_Done",4,218,-175.000000,1000.000000,-75.000000,1050.000000,0.000000,"Preload" \n "Done"}; -item35[] = {"Initialize",2,250,-75.000000,1050.000000,25.000000,1100.000000,0.000000,"Initialize"}; +item35[] = {"Initialize",2,4346,-75.000000,1050.000000,25.000000,1100.000000,0.000000,"Initialize"}; item36[] = {"Finish",1,250,-75.000000,1150.000000,25.000000,1200.000000,0.000000,"Finish"}; item37[] = {"True",8,218,25.000000,1100.000000,125.000000,1150.000000,0.000000,"True"}; item38[] = {"Too_Long",4,218,300.000000,150.000000,400.000000,200.000000,0.000000,"Too" \n "Long"}; @@ -1101,14 +1101,14 @@ class FSM "" \n "dayz_lootCheck = [] spawn {" \n " while {true} do {" \n - " call player_spawnLootCheck;" \n + " [""Loot""] call player_spawnCheck;" \n " sleep 10;" \n " };" \n "};" \n "dayz_zedCheck = [] spawn {" \n " while {true} do {" \n - " call player_spawnZedCheck; " \n - " sleep 7;" \n + " [""Zeds""] call player_spawnCheck; " \n + " sleep 8;" \n " };" \n "};" \n "dayz_locationCheck = [] spawn {" \n @@ -1117,12 +1117,6 @@ class FSM " sleep 2;" \n " };" \n "};" \n - "dayz_combatCheck = [] spawn {" \n - " while {true} do {" \n - " call player_combatCheck;" \n - " sleep 5;" \n - " };" \n - "};" \n "// TODO: questionably" \n "{ _x call fnc_vehicleEventHandler; } forEach vehicles;" \n "" \n diff --git a/dayz_code/system/zombie_agent.fsm b/dayz_code/system/zombie_agent.fsm index da890db88..8972b02be 100644 --- a/dayz_code/system/zombie_agent.fsm +++ b/dayz_code/system/zombie_agent.fsm @@ -14,7 +14,7 @@ item9[] = {"true",8,218,-300.000000,-175.000000,-200.000000,-125.000000,0.000000 item10[] = {"Begin",2,250,-300.000000,-100.000000,-200.000000,-50.000000,0.000000,"Begin"}; item11[] = {"",7,210,-254.000046,-29.000004,-245.999954,-20.999996,0.000000,""}; item12[] = {"",7,210,-204.000046,146.000000,-195.999954,154.000000,0.000000,""}; -item13[] = {"Has_Target",4,218,-150.000000,225.000000,-50.000000,275.000000,1.000000,"Has" \n "Target"}; +item13[] = {"Has_Target",4,4314,-150.000000,225.000000,-50.000000,275.000000,1.000000,"Has" \n "Target"}; item14[] = {"Chase",2,250,-150.000000,300.000000,-50.000000,350.000000,0.000000,"Chase"}; item15[] = {"",7,210,-29.000006,146.000000,-20.999996,154.000000,0.000000,""}; item16[] = {"",7,210,-29.000006,196.000000,-20.999996,204.000000,0.000000,""}; @@ -46,8 +46,8 @@ item41[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""}; item42[] = {"too_long",4,218,-425.000000,600.000000,-325.000000,650.000000,0.000000,"too long"}; item43[] = {"",7,210,-229.000000,621.000000,-221.000000,629.000000,0.000000,""}; item44[] = {"",7,210,-479.000000,621.000000,-471.000000,629.000000,0.000000,""}; -item45[] = {"Reset_Targeting",2,4346,-525.000000,325.000000,-425.000000,375.000000,0.000000,"Reset" \n "Targeting"}; -item46[] = {"true",8,218,-525.000000,250.000000,-425.000000,300.000000,0.000000,"true"}; +item45[] = {"Reset_Targeting",2,250,-525.000000,325.000000,-425.000000,375.000000,0.000000,"Reset" \n "Targeting"}; +item46[] = {"No_target",4,218,-525.000000,250.000000,-425.000000,300.000000,0.000000,"No target"}; item47[] = {"deleted",4,218,425.000000,-25.000000,525.000000,25.000000,0.000000,"deleted"}; item48[] = {"",7,210,471.000000,-79.000000,479.000000,-71.000000,0.000000,""}; item49[] = {"",7,210,471.000000,95.999977,479.000000,104.000023,0.000000,""}; @@ -122,8 +122,8 @@ link64[] = {49,47}; link65[] = {50,28}; link66[] = {51,5}; link67[] = {52,1}; -globals[] = {25.000000,1,0,0,0,640,480,1,99,6316128,1,-558.318542,127.785744,629.057495,-6.630199,626,580,1}; -window[] = {0,-1,-1,-32000,-32000,712,46,1254,1,1,643}; +globals[] = {25.000000,1,0,0,0,640,480,1,99,6316128,1,-558.318542,127.785744,597.327209,-38.360462,626,580,1}; +window[] = {0,-1,-1,-1,-1,755,44,1252,44,1,643}; *//*%FSM*/ class FSM { @@ -249,6 +249,12 @@ class FSM "if (!_hasMoved) then {" \n " _agent setVariable[""doLoiter"",true,true];" \n "};" \n + "if (!moveToCompleted _agent) then {" \n + " _agent moveTo (position _agent);" \n + "};" \n + "" \n + "//Enable combat timer." \n + "_target setVariable[""startcombattimer"", 1, true];" \n "" \n "_countr = 0;" \n "_losCheck = 0;" \n @@ -560,7 +566,10 @@ class FSM class Reset_Targeting { name = "Reset_Targeting"; - init = /*%FSM*/"if (!isNull _target) then {" \n + init = /*%FSM*/"_isAlive = alive _agent;" \n + "_target = _agent call zombie_findTargetAgent;" \n + "" \n + "if (!isNull _target) then {" \n " _targetPos = getPosATL _target;" \n " _agent setVariable [""myDest"",_targetPos];" \n " _agent moveTo _targetPos;" \n @@ -586,19 +595,25 @@ class FSM "if (!_hasMoved) then {" \n " _agent setVariable[""doLoiter"",true,true];" \n "};" \n + "if (!moveToCompleted _agent) then {" \n + " _agent moveTo (position _agent);" \n + "};" \n + "" \n + "//Enable combat timer." \n + "_target setVariable[""startcombattimer"", 1, true];" \n "" \n "_countr = 0;" \n "_losCheck = 0;" \n "_cantSee = false;"/*%FSM*/; }; /*%FSM*/ - /*%FSM*/ - class true + /*%FSM*/ + class No_target { priority = 0.000000; to="Loiter"; precondition = /*%FSM*/""/*%FSM*/; - condition=/*%FSM*/"true"/*%FSM*/; + condition=/*%FSM*/"(isNull _target)"/*%FSM*/; action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ diff --git a/dayz_server/compile/server_onPlayerDisconnect.sqf b/dayz_server/compile/server_onPlayerDisconnect.sqf index 22c677c66..d3f250b25 100644 --- a/dayz_server/compile/server_onPlayerDisconnect.sqf +++ b/dayz_server/compile/server_onPlayerDisconnect.sqf @@ -22,7 +22,7 @@ if ((_timeout - time) > 0) then { }; diag_log format["DISCONNECT: %1 (%2) Object: %3, _characterID: %4", _playerName,_playerID,_object,_characterID]; - +_id = [_playerID,_characterID,2] spawn dayz_recordLogin; dayz_disco = dayz_disco - [_playerID]; if (!isNull _object) then { //Update Vehicle @@ -30,7 +30,6 @@ if (!isNull _object) then { (nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage", "VaultStorage"], 10]); if (alive _object) then { [_object,[],true] call server_playerSync; - _id = [_playerID,_characterID,2] spawn dayz_recordLogin; _myGroup = group _object; deleteVehicle _object; deleteGroup _myGroup; diff --git a/dayz_server/compile/server_spawnCrashSite.sqf b/dayz_server/compile/server_spawnCrashSite.sqf index 48d8eedc6..4983c04c9 100644 --- a/dayz_server/compile/server_spawnCrashSite.sqf +++ b/dayz_server/compile/server_spawnCrashSite.sqf @@ -2,27 +2,38 @@ private["_position","_num","_config","_itemType","_itemChance","_weights","_inde waitUntil{!isNil "BIS_fnc_selectRandom"}; -_crashModel = _this select 0; -_lootTable = _this select 1; -_guaranteedLoot = _this select 2; -_randomizedLoot = _this select 3; -_frequency = _this select 4; -_variance = _this select 5; -_spawnChance = _this select 6; -_spawnMarker = _this select 7; -_spawnRadius = _this select 8; -_spawnFire = _this select 9; -_fadeFire = _this select 10; +//_crashModel = _this select 0; +//_lootTable = _this select 1; +_guaranteedLoot = _this select 0; +_randomizedLoot = _this select 1; +_frequency = _this select 2; +_variance = _this select 3; +_spawnChance = _this select 4; +_spawnMarker = _this select 5; +_spawnRadius = _this select 6; +_spawnFire = _this select 7; +_fadeFire = _this select 8; -_crashName = getText (configFile >> "CfgVehicles" >> _crashModel >> "displayName"); -diag_log(format["CRASHSPAWNER: Starting spawn logic for '%1' with loot table '%2'", _crashName, _lootTable]); +diag_log("CRASHSPAWNER: Starting spawn logic for Crash Spawner"); while {true} do { private["_timeAdjust","_timeToSpawn","_spawnRoll","_crash","_hasAdjustment","_newHeight","_adjustedPos"]; // Allows the variance to act as +/- from the spawn frequency timer _timeAdjust = round(random(_variance * 2) - _variance); _timeToSpawn = time + _frequency + _timeAdjust; + + //Adding some Random systems + _crashModel = ["UH60Wreck_DZ","UH1Wreck_DZ"] call BIS_fnc_selectRandom; + + //Crash loot just uncomment the one you wish to use by default with 50cals is enabled. + //Table including 50 cals + _lootTable = ["Military","HeliCrash","MilitarySpecial"] call BIS_fnc_selectRandom; + //Table without 50 cals + //_lootTable = ["Military","HeliCrash_No50s","MilitarySpecial"] call BIS_fnc_selectRandom; + + + _crashName = getText (configFile >> "CfgVehicles" >> _crashModel >> "displayName"); diag_log(format["CRASHSPAWNER: %1%2 chance to spawn '%3' with loot table '%4' at %5", round(_spawnChance * 100), '%', _crashName, _lootTable, _timeToSpawn]); @@ -41,6 +52,16 @@ while {true} do { diag_log(format["CRASHSPAWNER: Spawning '%1' with loot table '%2' NOW! (%3) at: %4", _crashName, _lootTable, time, str(_position)]); _crash = createVehicle [_crashModel,_position, [], 0, "CAN_COLLIDE"]; + + deleteMarker "Secure Helicopter Wreck"; + ///Add crash site markers + _crashmarker = createMarker["Secure Helicopter Wreck",_position]; + _crashmarker setMarkerColor "ColorRed"; + _crashmarker setMarkerType "Flag"; + //_crashmarker setMarkerShape "ELLIPSE"; + //_crashmarker setMarkerBrush "Grid"; + _crashmarker setMarkerText "Secure Helicopter"; + _crashmarker setMarkerSize [1, 1]; // Randomize the direction the wreck is facing _crash setDir round(random 360); @@ -100,7 +121,5 @@ while {true} do { } forEach _nearBy; }; - } else { - diag_log(format["CRASHSPAWNER: Roll chance to spawn '%1' with loot table '%2' failed", _crashName, _lootTable]); }; }; \ No newline at end of file diff --git a/dayz_server/system/server_monitor.sqf b/dayz_server/system/server_monitor.sqf index e00b23c1d..e2b06ea2b 100644 --- a/dayz_server/system/server_monitor.sqf +++ b/dayz_server/system/server_monitor.sqf @@ -231,18 +231,10 @@ for "_x" from 1 to MaxDynamicDebris do { //waitUntil{scriptDone _id}; }; -//Spawn crashed helos -//for "_x" from 1 to MaxHeliCrashes do { - //_id = [] spawn spawn_heliCrash; - //waitUntil{scriptDone _id}; -//}; - -// Allow connection after road debris spawns - allowConnection = true; -_randomcrashmodel = ["UH60Wreck_DZ","UH1Wreck_DZ","UH60Wreck_DZ","UH1Wreck_DZ"] call BIS_fnc_selectRandom; -_randomcrashloot = ["Military","HeliCrash","MilitarySpecial","Military","HeliCrash","MilitarySpecial"] call BIS_fnc_selectRandom; -// [_crashModel, _lootTable, _guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire] -nul = [_randomcrashmodel, _randomcrashloot, 3, 4, (50 * 60), (15 * 60), 0.75, 'center', 4000, true, false] spawn server_spawnCrashSite; \ No newline at end of file + +// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire] +nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', 4000, true, false] spawn server_spawnCrashSite; +