Trying to change zombie spawns from SPAWN to CALL

I found a simple yet effective way to have the "no-spawn" zone (aka "safe zone"), and prevent the cheesy log-off/on to get rid of the zombies while looting. This reduces the "no-spawn" zone for all newly logged in players from 450 to 1 for 30 seconds. So, it is a punishment to log in close to zombie spawn points (like in the middle of a town).

In dayz_code\compile\zombie_generate.sqf I changed this:
Code:
_isNoone =    {isPlayer _x} count (_position nearEntities ["AllVehicles",450]) == 0;

to this:
Code:
if (time > 30) then {
    _isNoone =    {isPlayer _x} count (_position nearEntities ["AllVehicles",450]) == 0;
} else {
    _isNoone =    {isPlayer _x} count (_position nearEntities ["AllVehicles",1]) == 0;
};
 
After more testing I found that CPU usage (both server & client) is within a few percentage points whether there is a 50 zombie max or 5000 zombie max. This testing was done actually seeing the zombies in-game. There is an obvious visual difference between 50 and 5000. If that is correct, then the numbers of zombies can be increased drastically as long as the "drip" technique described above is used. Can anyone confirm this?
 
Hi joikd

I help run the Rape Dungeon DayZ Taviana server and I'm very interested in your work here.

We run a busy 60 player server and are always looking at ways to increase the server population. Your redesign of the zombie spawn scripts looks like something we could use, as zombies are a major source of lag (as well as dead bodies).

Have you ever though of opening a a GitHub account so people can easily track your changes?

Also do you have any direct download links we can use?
 
Hey there, Knobbin.

I'm glad there is actually someone interested in changing zombie spawns. I think that makes three of us or so. :D

I don't think I'm ready for GitHub or anything like that. I'm really just like a kid who busted open a radio and is poking around inside (AKA I don't really know what the hell I'm doing!).

I have been uploading these files to RapidShare for one guy I know, so he could test when he was bored. If you used my edited dayz_code.pbo, all players on your server would have to use that pbo and all of the my bisign files as well (so you could prevent players without the edited file from playing). Is that something you would really be willing to do?
 
Hi joikd,

The changes you make are so far possible with mission edits (using simple variable hooks). If you're interested I'll show you how.

Instead of making more zombies, I'm interested in spawning far less as they greatly affect server performance in a negative way (particularly when player pop is 60+). Aside from this, smarter more lethal zombies and safe zones are great ideas.

Just be prepared to do a lot of re-coding in the next version of DayZ, as they are changing zombies a fair bit from what I've read.
 
Knobbin, I would like to know very much how to do this with mission edits!

Is the SA going to be able to be modded from day one of release?
 
In my post above (#21), time doesn't work properly. I didn't realize it gets the server time not the client time plus it gets the time whenever the script is called.

This seems to work:

place in dayz_code\init\variables.sqf:
Code:
player_zSpawn = 0;


dayz_code\system\player_spawn_2.sqf - place under "_isHero = false;"
Code:
[] spawn {
sleep 30;
player_zSpawn = 1;
};


dayz_code\compile\zombie_generate.sqf
Code:
private["_position","_unitTypes","_isNoone","_loot","_array","_agent","_type","_radius","_method","_myDest","_newDest","_rnd","_lootType","_id"];
_position =    _this select 0;
_unitTypes =    _this select 1;
_loot =    "";
_array =    [];
_agent =    objNull;
 
if (player_zSpawn > 0) then {
_isNoone ={isPlayer _x} count (_position nearEntities ["AllVehicles",400]) == 0;
} else {
_isNoone ={isPlayer _x} count (_position nearEntities ["AllVehicles",1]) == 0;
};
 
//Exit if a player is nearby
if (!_isNoone) exitWith {};
if (count _unitTypes == 0) then {
    _unitTypes =    []+ getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass");
};
_type = _unitTypes call BIS_fnc_selectRandom;
 
//Create the Group and populate it
_radius = 0;
_method = "CAN_COLLIDE";
_radius = 40;
_method = "NONE";
_agent = createAgent [_type, _position, [], _radius, _method];
_agent setPosATL _position;
_position = getPosATL _agent;
if (random 1 > 0.7) then {
    _agent setUnitPos "Middle";
};
_agent setPos _position;
_myDest = getPosATL _agent;
_newDest = getPosATL _agent;
_agent setVariable ["myDest",_myDest];
_agent setVariable ["newDest",_newDest];
 
//Add some loot
_rnd = random 1;
if (_rnd > 0.3) then {
    _lootType = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
    if (isText _lootType) then {
        _array = []+ getArray (configFile >> "cfgLoot" >> getText(_lootType));
        if (count _array > 0) then {
            _loot = _array call BIS_fnc_selectRandomWeighted;
            if(!isNil "_array") then {
                _agent addMagazine _loot;
            };
        };
    };
};
 
//Start behavior
_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";
 
hey all! love what you guys are doing here. here is my question.

all i want is zombies to spawn when people are in vehicles, how can i do that?
also in what pbo file do i file these zombie files at?
 
I am now taking the zombie-spawn-drip to the furthest it can go by spawning only one zombie at a time from each spawn point. By doing that I should, hopefully, be able to increase the spawning ring from 50 to much higher (200 or 300 outside the "safe zone").

I still need to see how this works with aircraft.
 
I'm interested in testing this. Any chance you can cleanup the first post and keep it updated with your latest work
 
hey all! love what you guys are doing here. here is my question.

all i want is zombies to spawn when people are in vehicles, how can i do that?
also in what pbo file do i file these zombie files at?

Change in dayz_code\compile\player_spawnCheck.sqf:

Code:
_inVehicle = (vehicle player != player);


to


Code:
_inVehicle = vehicle player isKindOf "player";
 
read all texts
all talk, but only increase spawning zombie
wanted to make a pvp server

I want to remove the zombie spawning
or decrease the maximum....

help?
 
Just comment out all of the zombie code in dayz_code\compiles\player_spawnCheck.sqf, and you will have zero zombies.

You could also probably gain some performance by editing the player_monitor.fsm to keep it from checking for zombies, but you would probably need to use an fsm editor for that.
 
You dont have to edit your dayz_code.pbo file you put the files in the mission.pbo then overwrite the old one by putting a new precompile command there.

Code:
if (!isDedicated) then {
    //stream_locationFill =        compile preprocessFileLineNumbers "fixes\stream_locationFill.sqf";
    xyberviri_testAction = -1;
    xyberviri_testAction2 = -1;
    fnc_usec_selfActions =        compile preprocessFileLineNumbers "fixes\fn_selfActions.sqf";
    0 fadeSound 0;
    0 cutText [(localize "STR_AUTHENTICATING"), "BLACK FADED",60];
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
    _playerMonitor =    [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
};

This moves my fn_selfActions.sqf to the mission file in the fixes folder i created inside my mission.

that way you dont have to modify the original code and your not going to break your bisigns.


Also there were some more people interested in changing zombie spawns, i just more interested in changing what side they they spawned as so my AI npcs can now shoot at them ^.^, I'm waiting to see how this turns out and if there is any usable code for my server also.


To disable zombies completely open up player_spawnCheck.sqf located in the dayz_code\compile folder and remove lines 46-70 ie this:
Code:
            if ((time - dayz_spawnWait) > dayz_spawnDelay) then {
                if (dayz_spawnZombies < dayz_maxLocalZombies) then {
                    if (!_tooManyZs) then {
                        private["_zombied"];
                        _zombied = (_x getVariable ["zombieSpawn",-0.1]);
                        _dateNow = (DateToNumber date);
                        _age = (_dateNow - _zombied) * 525948;
                        if (_age > 5) then {
                            _bPos = getPosATL _x;
                            _zombiesNum = {alive _x} count (_bPos nearEntities ["zZombie_Base",(((sizeOf _type) * 2) + 10)]);
                            if (_zombiesNum == 0) then {
                                //Randomize Zombies
                                _x setVariable ["zombieSpawn",_dateNow,true];
                                _handle = [_x,_fastRun] spawn building_spawnZombies;
                                waitUntil{scriptDone _handle};
                            //} else {
                                //_x setVariable ["zombieSpawn",_dateNow,true];
                            };
                        };
                    };
                } else {
                    dayz_spawnWait = time;
                    dayz_spawnZombies = 0;
                };
            };
 
Hello there.

I have a question regarding this modification that I've been dying to find (remove the zombie spawning completely).
This is for my personnal use only, I don't run a server. Instead I use the Daizy DayZ SP's version.

What I would like is to replace the dayz's original zombies and replace them by the Undead Mod zombies (much more dangerous and harder) and make a mission out of it, keeping everything else from DayZ (loot system, thirst/hunger, healing, equipping hatchet and melee, etc....)

So I did edit my player_spawnCheck.sqf like Xyberviri said (I extracted the dayz_code.pbo with Elitness, did the modification on the file), then created a new .pbo file. Then I replace the original dayz_code file with the new one created.
But now, it won't start the mission, even in the editor. Right from the start, when I open up DayZ, it says "Picture z\addons\dayz_code\gui\dayz_logo_ca.paa not found". Then when I launch the editor, I get a similar message. I use the default mission provided by Daizy's version of the game, but it gets stuck when I try to preview at the "creating character" thing and never actually starts.

Now I know (I think) it is related to folders and path, but what am I doing wrong here ? In other words, how do you replace a .pbo file of the original arma2\@addon folder properly ?
 
I am interested in both the player safe zone, and increasing zombie spawn numbers ... I think DayZ should go back to being more about zombie terror ... or at least annoyance you cannot ignore. I run a Taviana.eu server, and adding something like this on top of headshot only zombies would be great.

The thing is, I understand what you've done, joikd, but not really how to put it all together. I know that all of the sqfs you've put up in this post can be done as DayZ code overrides in the server mission PBO, but I am not really certain how to write the code hooks to execute them.
 
Back
Top