Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. private ["_wreck","_maxlocalspawned","_maxControlledZombies","_iPos","_nearByZed","_nearByPlayer","_rnd","_positions","_zombieChance","_unitTypes","_min","_max","_num","_clean","_obj","_type","_config","_canLoot","_originalPos","_fastRun","_enabled","_i","_Pos"];
  2. _obj = _this select 0;
  3. _wreck = false;
  4. if (count _this > 1) then {
  5. _wreck = _this select 1;
  6. };
  7.  
  8. _type = typeOf _obj;
  9. _config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type;
  10. _canLoot = isClass (_config);
  11. _originalPos = getPosATL _obj;
  12.  
  13. _maxlocalspawned = round(dayz_spawnZombies);
  14. //Lets check if we need to divide the amount of zeds
  15. if (r_player_divideinvehicle > 0) then {
  16. _maxlocalspawned = round(dayz_spawnZombies / r_player_divideinvehicle);
  17. };
  18.  
  19. _maxControlledZombies = round(dayz_maxLocalZombies);
  20. _enabled = false;
  21.  
  22. if (_canLoot && !([_originalPos] call DZE_SafeZonePosCheck)) then {
  23. //Get zombie class
  24. _unitTypes = getArray (_config >> "zombieClass");
  25. _min = getNumber (_config >> "minRoaming");
  26. _max = getNumber (_config >> "maxRoaming");
  27. _zombieChance = getNumber (_config >> "zombieChance");
  28.  
  29. //Walking Zombies
  30. _num = (round(random _max)) max _min; // + round(_max / 3);
  31. //diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
  32.  
  33. for "_i" from 0 to _num do
  34. {
  35. //_iPos = _obj modelToWorld _originalPos;
  36. if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
  37. [_originalPos,true,_unitTypes,_wreck] call zombie_generate;
  38. };
  39. };
  40.  
  41. if ((_type == "Land_bspawn" || _type == "HeliCrash" || _type == "HeliCrash_No50s" || _type == "Land_aii_upper_part" || _type == "Land_Mil_Barracks_i") && dzn_ns_bloodsucker && ((random 400) < dzn_ns_bloodsucker_den)) then {
  42. private["_content"];
  43. _rnd = random 1;
  44. if (_rnd < 0.18562) then {
  45. _content = "this addMagazine 'ItemBloodbag'";
  46. } else {
  47. _content = "";
  48. };
  49. "ns_bloodsucker" createUnit [[(_originalPos select 0) + (random 60), (_originalPos select 1) - (random 60), 0], group sefik, _content, 1, "CORPORAL"];
  50. };
  51.  
  52. //Add Internal Zombies
  53. if ((random 1) < _zombieChance) then {
  54. _clean = {alive _x} count ((getPosATL _obj) nearEntities ["zZombie_Base",(sizeOf _type)]) == 0;
  55. if (_clean) then {
  56. _positions = getArray (_config >> "zedPos");
  57. //diag_log format["Building: %1 / Positions: %2 / Chance: %3",_type,_positions,_zombieChance];
  58. {
  59. _Pos = [_x select 0, _x select 1, 0];
  60. _rnd = random 1;
  61. if (_rnd < _zombieChance) then {
  62. _iPos = _obj modelToWorld _Pos;
  63. _nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0;
  64. _nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
  65. //diag_log ("BUILDING: " + _type + " / " + str(_nearByZed) + " / " + str(_nearByPlayer));
  66. if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
  67. if (!_nearByPlayer and !_nearByZed) then {
  68. [_iPos,false,_unitTypes,false] call zombie_generate;
  69. };
  70. };
  71. };
  72. } forEach _positions;
  73. };
  74. };
  75. };
  76.  
  77. //diag_log ("2 end");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement