Jump to content

[TUTORIAL] So you want to put bloodsuckers on your server...


Nemaconz

Recommended Posts

I have a question about "dzn_ns_bloodsucker_den". The range is 0 - 400. How does this number correlate with chances of spawning and number of bloodsuckers spawning? Is it a definitive number that sets how many are on the map?

 

Someone can correct me if I'm wrong but I believe that it selects a random number between 1 and 400. If the random number selected is within the spawn rate number you choose then it spawns. So if you set the spawn rate to 200 then any random number generated that's above 200 will not spawn a bloodsucker, any number that's below or is exactly 200 will spawn a bloodsucker. 400 = 100% spawn chance, 200 = 50% and so on.

Link to comment
Share on other sites

Someone can correct me if I'm wrong but I believe that it selects a random number between 1 and 400. If the random number selected is within the spawn rate number you choose then it spawns. So if you set the spawn rate to 200 then any random number generated that's above 200 will not spawn a bloodsucker, any number that's below or is exactly 200 will spawn a bloodsucker. 400 = 100% spawn chance, 200 = 50% and so on.

 

Thanks for the explanation. What makes it confusing is that during a Google search, some sites say that top number is 100 while others say 400 but no clear definition of how it works and I haven't taken the time to look through the code to figure it out.

Link to comment
Share on other sites

Hey there,

 

hope someone can help us here.

 

We have done everything step by step as explained above but to no avail.

 

There are no bloodsuckers there as well as there is no bloodsucker boss on the designated position (we took for this a player worldspace from the database)

 

Never mind ...it's working now.

how do you wordking? my sever is Type ns_bloodsucker is not VehicleType

Link to comment
Share on other sites

  • 2 years later...

building_spawnZombies for epoch 1.0.6.1

Otherwise everything else in this tutorial works fine, cheers

Spoiler

/*
        Created exclusively for ArmA2:OA - DayZMod.
        Please request permission to use/alter/distribute from project leader (R4Z0R49)
*/
private ["_wreck","_maxlocalspawned","_maxControlledZombies","_iPos","_nearByZed","_nearByPlayer","_rnd","_positions","_zombieChance","_unitTypes","_min","_max","_num","_clean","_obj","_type","_config","_canLoot","_originalPos","_fastRun","_enabled","_i","_Pos"];
_obj =             _this select 0;
_wreck = false;
if (count _this > 1) then {
    _wreck =             _this select 1;
};

_type =         typeOf _obj;
_config = missionConfigFile >> "CfgLoot" >> "Buildings" >> _type;
_canLoot =         isClass (_config);
_originalPos =     getPosATL _obj;

_maxlocalspawned = round(dayz_spawnZombies);
//Lets check if we need to divide the amount of zeds
if (r_player_divideinvehicle > 0) then {
    _maxlocalspawned = round(dayz_spawnZombies / r_player_divideinvehicle);
};

_maxControlledZombies = round(dayz_maxLocalZombies);
_enabled = false;

if (_canLoot ) then {
    //Get zombie class
    _unitTypes =     getArray (_config >> "zombieClass");
    _min =             getNumber (_config >> "minRoaming");
    _max =             getNumber (_config >> "maxRoaming");
    _zombieChance =    getNumber (_config >> "zombieChance");

    //Walking Zombies
    _num = (round(random _max)) max _min; // + round(_max / 3);
    //diag_log ("Class: " + _type + " / Zombies: " + str(_unitTypes) + " / Walking: " + str(_num));
    
    for "_i" from 0 to _num do
    {
        //_iPos = _obj modelToWorld _originalPos;
        if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
            [_originalPos,true,_unitTypes,_wreck] call zombie_generate;
        };
    };

    //Add Internal Zombies
    if ((random 1) < _zombieChance) then {
        _clean = {alive _x} count ((getPosATL _obj) nearEntities ["zZombie_Base",(sizeOf _type)]) == 0;
        if (_clean) then {
            _positions =    getArray (_config >> "zedPos");
            //diag_log format["Building: %1 / Positions: %2 / Chance: %3",_type,_positions,_zombieChance];
            {
                _Pos = [_x select 0, _x select 1, 0];
                _rnd = random 1;
                if (_rnd < _zombieChance) then {
                    _iPos = _obj modelToWorld _Pos;
                    _nearByZed = {alive _x} count (_iPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]) > 0;
                    _nearByPlayer = ({isPlayer _x} count (_iPos nearEntities ["CAManBase",30])) > 0;
                    //diag_log ("BUILDING: " + _type + " / " + str(_nearByZed) + " / " + str(_nearByPlayer));
                    if ((_maxlocalspawned < _maxControlledZombies) and (dayz_CurrentNearByZombies < dayz_maxNearByZombies) and (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
                        if (!_nearByPlayer and !_nearByZed) then {
                            [_iPos,false,_unitTypes,false] call zombie_generate;
                        };
                    };
                };
            } forEach _positions;
        };
    };
    
       //Add bloodsuckers
 if ((_type == "Land_bspawn" || _type == "Land_a_Stationhouse" || _type == "Land_Church_02a" || _type == "Land_Church_02" || _type == "Land_Church_03" || _type == "Land_Church_01" || _type == "Land_Hlidac_budka" || _type == "Land_kulna" || _type == "Land_Mil_Barracks_i") && dzn_ns_bloodsucker && ((random 400) < dzn_ns_bloodsucker_den)) then {
  private["_content", "_originalPosns"];
  _rnd = random 1;
  if (_rnd < 0.88562) then {
   _content = "this addweapon 'mut_heart'";
  } else {
   _content = "";
  };
  _originalPosns = getPos _obj;
  "ns_bloodsucker" createUnit [[(_originalPosns select 0) + (random 60), (_originalPosns select 1) - (random 60), 0], group sefik, _content, 1, "CORPORAL"];
 };
 
  dayz_buildingMonitor set [count dayz_buildingMonitor,_obj];
};

//diag_log ("2 end");

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...