disable wild zombies

[DoC]dopey`

New Member
Hey guys,



Need some help disabling zombies wild zombies that spawn where you dont want them to spawn up.



I have some mission and ai city addons and the zombies tend to spawn on them.
I want to disable zombies that spawn in the middle of nowhere, in custom ai cities, and missions.

Missions: zombies tend to spawn in the middle of where all the ais are in the mission.

AI cities: when doing a custom ai city raid, zombies are spawning everywhere.
Zombie are spawning all over the custom cities so it kind of kills the immersion when zombies are all over the city with the AIs.

Wild Zombies: I want to get rid of zombies that spawn in the middle of nowhere. I only want zombies to spawn in cities and towns (expect for ai cities).



Does anyone have any suggestions??
 
I don't think you can disable them from spawning in the AI cities because the buildings are in the loot table and that spawns the loot and zombies. What you CAN do easily is setup a zombie shield script at those locations. Create that in the mission script too.
What mod are you running? Dayz? Epoch? Overpuke?

You want something like this ..
create a trigger that runs code when player is in the area, and stops the code when players leave. Just put this code into the missions and the custom cities. should make it a precompiled code and just execute that ..

untested and off the top of my head but close ...
Code:
_pos = [WHERE TO PLACE THIS];//put in some worldspce coords here
_trg=createTrigger["EmptyDetector",_pos];
_trg setTriggerArea[200,200,0,false];
_trg setTriggerActivation["ANY","PRESENT",true];
_trg setTriggerStatements ["this", "zshield = true", "zshield=false"]

while (zshield){
_zombies = _pos nearEntities ["zZombie_Base",200]; // change the radius to whats needed.
         {
          deletevehicle _x;
          } forEach _zombies;
sleep 1;
};
 
I don't think you can disable them from spawning in the AI cities because the buildings are in the loot table and that spawns the loot and zombies. What you CAN do easily is setup a zombie shield script at those locations. Create that in the mission script too.
What mod are you running? Dayz? Epoch? Overpuke?

You want something like this ..
create a trigger that runs code when player is in the area, and stops the code when players leave. Just put this code into the missions and the custom cities. should make it a precompiled code and just execute that ..

untested and off the top of my head but close ...
Code:
_pos = [WHERE TO PLACE THIS];//put in some worldspce coords here
_trg=createTrigger["EmptyDetector",_pos];
_trg setTriggerArea[200,200,0,false];
_trg setTriggerActivation["ANY","PRESENT",true];
_trg setTriggerStatements ["this", "zshield = true", "zshield=false"]

while (zshield){
_zombies = _pos nearEntities ["zZombie_Base",200]; // change the radius to whats needed.
         {
          deletevehicle _x;
          } forEach _zombies;
sleep 1;
};


I am currently running overpoch on my server.

Is there anyway I can disable the loot tables within the city and stop the zombies from spawning??

Zombies seem to spawn where ever you are in the map, even if you are in the middle of nowhere..
Is there any way to disable zombies from spawning in the wilderness like it is in the original dayz, where zombies only spawn up when you are in a city or in a town.

How do the coords work on the script and which sqf file does it go into?
If I put four coordinates will it create a square perimeter and prevent zombies from spawning in those zones?

Mind explaining how the script works a little bit further??

Thanks.
 
The loot tables spawn certain zombies and certain loot for each type of building. You can remove certain buildings from the buildinglootpos.hpp file (think thats the name) so that they NEVER spawn zombies, no matter where that building is.
Zombies spawning in the wild has been around for a while and was one of the better changes, methinks you are wrong for wanting to disable them. But you ALSO want to disable them in the cities? Its easy to disable zombies COMPLETELY if that is what you want. At the bottom of your init.sqf file put in
zombie_generate = {};
I don't have any zombies on my server but thats because I have aliens instead.

To disable wild zombies do this: Get notepad++ and learn to use the FIND IN FILES search. I typed in wild zombies
UUL8QHh.png

and it found this right here which I can click on and open that file
utbOt0v.png

So I would open up player_spawncheck.sqf and comment out line 80 and see what happens.
Code:
//[_position,true,0,true] call zombie_generate;
This file is in your dayz_code.pbo so you need to unpack that, copy the file to your mission along with your compiles.sqf. then in your init.sqf you need to change the location of compiles.sqf to where you put it inside your mission folder.
and then on line 19 of your compiles.sqf you change the location of player_spawncheck.sqf to where its now in your mission. If you want some real-time help, come to my website http://iaregameplayer.com and message me in the shoutbox. I check it rather often.


What I put up there really isn't a complete script and i didn't test it at all. But suppose you have a script that adds in your city like and that is executed in your dayz_server (i believe thats where it is in epoch). So you open up the script for each city and you paste that code at the end of the file. So the script will add all the buildings, then create a trigger that removes all the zombies from that area. And you would also add it into the missions files where it has the createunit line that spawns in the ai.
So lets go through the code one line at a time since it sounds like you are interested in learning how to do this stuff.
BTW .. a reference you should look to all the time is right here https://community.bistudio.com/wiki/Main_Page and in particular this page has a list of all scripting commands https://community.bistudio.com/wiki/Category:Scripting_Commands

Now to explain the code:
Code:
_pos = [WHERE TO PLACE THIS];//put in some worldspce coords here
Where do you want this to be in effect? You would put the AI cities center coordinates or the AI missions always have a random worldspace that is usually called _position. [4000,10000,0] is somewhere near nwab. https://community.bistudio.com/wiki/Position

Code:
_trg=createTrigger["EmptyDetector",_pos];
A trigger is an area that runs a script whenever a player or ai enter that area. It takes the worldspace position we defined above. https://community.bistudio.com/wiki/createTrigger

Code:
_trg setTriggerArea[200,200,0,false];
_trg setTriggerActivation["ANY","PRESENT",true];
These configure the trigger. There are more possible settings and if you look at the bottom of the createtrigger page it links all them with examples. What we are doing here is setting the trigger area to be an rectange that is 200x200m square. The 0 is the angle which is only significant if the area were oblong like 1000x100 .. what direction do you want the 1000 meter length to point. The TRUE means its a rectangle as opposed to an ellipse.
The activation means WHO will cause this trigger to activate (east, west or in this case ANYONE). And what condition triggers it, PRESENT means they enter the area, and it could be not-present like when they leave an area.

Code:
_trg setTriggerStatements ["this", "zshield = true", "zshield=false"]
Now what do we do when its activated (set zshield to true) and when deactivated (set zshield to false)

Code:
while (zshield){
_zombies = _pos nearEntities ["zZombie_Base",200]; // change the radius to whats needed.
         {
          deletevehicle _x;
          } forEach _zombies;
sleep 1;
};
And the part that actually does the work. So you wander into the AI city and the trigger activates and sets zshield to true. This code will loop as long as zhield is true because of the while(zshield) clause.
Then it gets an array of all the zombies within 200 meters of you worldspace _pos.
Now using the forEach https://community.bistudio.com/wiki/forEach to loop through each item in the array _zombies and deletes them. This uses the 'magic variable' _x which can be confusing. If you are using a loop with a list of items like this array of zombies, _x refers to the current object. Its worth reading and understanding this because its used A LOT. https://community.bistudio.com/wiki/Array look at looping to access elements
Then the script waits 1 second so other things can do their thing and it repeats until zshield is false.
When you leave the trigger area, zshield will be set to false. and the script stops running.

Note that this may contain errors and might not be 100% accurate as I haven't done this in a year. If you search for zombie shield you will find lots of scripts that do this type of thing but this is good because you can just copy/paste that into where you need it while most scripts are more specific to protecting bases or trader cities.
 
Back
Top