Jump to content
  • 0

Prevent Zombie Spawn in specific area


Voltan

Question

Hi all,

I am running a Tavi server and I wish to prevent zombies spawning anywhere on Salvation Island (Sector B), does anyone have a script for this? 

I was thinking something along the lines of I put in a worldspace coord for the middle of Sec B and a radius from there that zombies dont spawn in

Thanks 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

It's late in the night, I am tired but here you go, you could give that a try:

_pos = [yourposition];
_radius = 12345;

while {1337 == 1337} do {
	_zombies = _pos nearEntities ["zZombie_Base", _radius];

	{
        _x setDamage 1;
        hideObject _x;

		sleep 0.5;
		deleteVehicle _x;
	} forEach _zombies;
};

Edit: The formatting of the code is trash, but I can't fix it. I am on the phone, sorry

Link to comment
Share on other sites

  • 0
  • function zombie_generate looks like spawning zombies

    zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf";            //Server compile, used for loiter behaviours
so, disabling this function in the zone would also solve it

please try this function below like a safezone script:

Spoiler

private ["_pos","_radius","_zg"];
_pos = [(center position of the island)];
_radius = (radius of the island);

_zg = zombie_generate; //backup

while (true) do {

    if((player distance _pos) < _radius) then {//check in the area

        zombie_generate = {false}; //disable spawning zombies

    } else { //when out of island

        zombie_generate = _zg; //enable spawning zombies

    };

    sleep 5; //wait a bit to decrease cost

};

(btw, why does it check 1337 is equals to 1337 everytime killing the zombies around?)

Link to comment
Share on other sites

  • 0

@Schalldampfer

You are trying to disable the zombie spawn completely. My code just deletes them. There are many ways to do it I guess. Voltan should try which solution works for him.

It checks 1337 just because I can. You can do everything in the statement as long as it's true.

1337 == 1337 is the same as true

 

 

Link to comment
Share on other sites

  • 0

even easier would be something like this:

take the player_spawnCheck.sqf to the missionfile and edit it.

somewhere where it says:

if (getNumber(_config >> "zombieChance") > 0) then {

above add:

if (player distance [youcoordsarray) < 1000)  exitwith {};

1000 is roughly the islandsize from the middle of it (radius).

or do I have a mistake in my thinking there?

Link to comment
Share on other sites

  • 0
On 6/2/2018 at 8:48 AM, DAmNRelentless said:

It's late in the night, I am tired but here you go, you could give that a try:


_pos = [yourposition];
_radius = 12345;

while {1337 == 1337} do {
	_zombies = _pos nearEntities ["zZombie_Base", _radius];

	{
        _x setDamage 1;
        hideObject _x;

		sleep 0.5;
		deleteVehicle _x;
	} forEach _zombies;
};

Edit: The formatting of the code is trash, but I can't fix it. I am on the phone, sorry

is this called server side or client side, and where?

 

Link to comment
Share on other sites

  • 0
On 6/2/2018 at 6:21 PM, seelenapparat said:

even easier would be something like this:

take the player_spawnCheck.sqf to the missionfile and edit it.

somewhere where it says:

if (getNumber(_config >> "zombieChance") > 0) then {

above add:

if (player distance [youcoordsarray) < 1000)  exitwith {};

1000 is roughly the islandsize from the middle of it (radius).

or do I have a mistake in my thinking there?

So, like this?

if (player distance [22594,19635,0.001] < 1000)  exitwith {};
Link to comment
Share on other sites

  • 0
On 6/6/2018 at 1:25 PM, Voltan said:

This worked like a charm.

Thanks @seelenapparat

Thanks @seelenapparat  and @Voltan .

can confirm this works like a charm using epoch 1.0.6.2 and origins 1.8.3.

Incase anyone is looking for this solution this is what i did.

make a copy of the player_spawnCheck.sqf which is located;

\z\addons\dayz_code\compile\player_spawnCheck.sqf 

and move copy to your mission file, I put mine here.

missionfilename\dayz_code\compile\player_spawnCheck.sqf

as mentioned above by @seelenapparat

edit player_spawnCheck.sqf

where it says:

if (getNumber(_config >> "zombieChance") > 0) then {

above add:

if (player distance [youcoordsarray) < 1000)  exitwith {};

then in your custom compiles assuming you have one add this;

player_spawnCheck = compile preprocessFileLineNumbers "dayz_code\compile\player_spawnCheck.sqf";

below this;

if (!isDedicated) then {
    diag_log "Loading custom client compiles";

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...