mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Function _cantSee should not be recompiled every time this file runs. fnc_fieldOfView is compiled in compiles.sqf and called here. Checking zombie counts in this file is redendant. It is already being done in player_spawnCheck and building_SpawnZombies. Variables "agentObject" and "BaseLocation" are unused. The createAgent command should not be used with a radius. This causes some of the zombies to be killed after being spawned into objects. Some of the walking zombies were spawning inside the building when they should not.
42 lines
1.5 KiB
Plaintext
42 lines
1.5 KiB
Plaintext
#include "\z\addons\dayz_code\loot\Loot.hpp"
|
|
|
|
private ["_radius","_isWreck","_position","_unitTypes","_agent","_doLoiter","_type","_favStance","_lootGroup"];
|
|
|
|
_position = _this select 0;
|
|
_doLoiter = _this select 1; // wander around
|
|
_unitTypes = _this select 2; // class of wanted models
|
|
_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 (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"};
|
|
_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";
|
|
if (isText _lootGroup) then {
|
|
_lootGroup = Loot_GetGroup(getText _lootGroup);
|
|
Loot_Insert(_agent, _lootGroup, 1);
|
|
};
|
|
};
|
|
};
|