Update loot and zombie spawn, change some count/foreach

This commit is contained in:
A Man
2020-04-07 16:33:19 +02:00
parent dfe80e75c4
commit 2b98eb1fd5
5 changed files with 24 additions and 24 deletions

View File

@@ -2,7 +2,7 @@
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 ["_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; _obj = _this select 0;
_objPos = _this select 1; _objPos = _this select 1;
_config = _this select 2; _config = _this select 2;
@@ -17,7 +17,7 @@ if (!([_objPos] call DZE_SafeZonePosCheck)) then {
_zombieChance = getNumber (_config >> "zombieChance"); _zombieChance = getNumber (_config >> "zombieChance");
_num = round(random(_max - _min) + _min); _num = round(random(_max - _min) + _min);
_minDist = (sizeOf _type); _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 // Walking Zombies
for "_i" from 0 to _num do { for "_i" from 0 to _num do {

View File

@@ -34,6 +34,6 @@ _zPos set [2, (_zPos select 2) + 1.7];
}; };
}; };
if (!_isOk) exitWith {false}; if (!_isOk) exitWith {false};
} forEach playableUnits; } count playableUnits;
_isOk _isOk

View File

@@ -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; _age = -1;
_position = [player] call fnc_getPos; _position = [player] call fnc_getPos;
_radius = 200; // distance from player to perform checks. _radius = 200; // distance from player to perform checks.
@@ -37,7 +37,7 @@ if (_inVehicle) then {
_Controlledzeddivided = 2; _Controlledzeddivided = 2;
//Dont allow driver to spawn if we have other crew members. //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 { } else {
_Controlledzeddivided = 4; _Controlledzeddivided = 4;
}; };
@@ -149,4 +149,4 @@ _serverTime = serverTime; // Get the current time once per cycle.
}; };
}; };
}; };
} forEach _nearby; } count _nearby;

View File

@@ -1,6 +1,6 @@
#include "\z\addons\dayz_code\loot\Loot.hpp" #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; _position = _this select 0;
_doLoiter = _this select 1; // wander around _doLoiter = _this select 1; // wander around
@@ -9,7 +9,7 @@ _isWreck = _this select 3;
if (surfaceIsWater _position) exitWith { diag_log "Zombie_Generate: Location is in Water Abort"; }; 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 { if (count _unitTypes == 0) then {
_unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass"); _unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass");
@@ -20,7 +20,7 @@ if (_isWreck || {([_position, 15, 10, 70] call fnc_fieldOfView)}) then {
_agent = createAgent [_type, _position, [], 0, "CAN_COLLIDE"]; _agent = createAgent [_type, _position, [], 0, "CAN_COLLIDE"];
_agent setDir (random 360); _agent setDir (random 360);
_agent setPosATL _position; _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 setUnitPos _favStance;
_agent setVariable ["stance", _favStance]; _agent setVariable ["stance", _favStance];
_agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still _agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still

View File

@@ -50,4 +50,4 @@ if (!local _unit) exitWith {
}; };
}; };
}; };
} count Loot_Select(_group,_count); } foreach Loot_Select(_group,_count);