Jump to content

[Release] No zombies in base 1.0.6.2


gle353

Recommended Posts

Ever tired of zombies in your base glitching trouth the walls and hit you while building?
Ever tried to stay safe for a short pipi-break at your base, come back and got eaten alive?

Stop it now, Here is the solution!

1. Open Init.sqf, serach for 

 

if (DZE_R3F_WEIGHT) then {execVM "\z\addons\dayz_code\external\R3F_Realism\R3F_Realism_Init.sqf";};

and post below:

 

	[] execVM "custom\base_SafeArea.sqf";

Save and close Init.sqf. Now create a folder called "custom" if you dont have one. Now create a new SQF-File called "base_SafeArea.sqf".
Open it and insert following code in it:
 

//---------------------------------------------------------------------
// Epoch Base Safe Area
// By MadMartyr
// Modified from generic ZombieShield code by felixberndt and meat
// http://opendayz.net/threads/prevent-zombie-spawning.8799/#post-32461
//---------------------------------------------------------------------

dayz_poleSafeArea = 40; //range of your plotpole safespace
while {true} do {
  sleep 5;


  // No Zeds near Plot Poles
  _playerPos = getPos player;
  _nearPole = nearestObject [_playerPos, "Plastic_Pole_EP1_DZ"]; //You can replace the Plastic_Pole by any other item. Usefull for gemcrating
  if (!isNull _nearPole) then {
    _pos2 = getPos _nearPole;
    _zombies2 = _pos2 nearEntities ["zZombie_Base", dayz_poleSafeArea];
    _count2 = count _zombies2;
    for "_i" from 0 to (_count2 -1) do
    {
      _zombie2 = _zombies2 select _i;
      deleteVehicle _zombie2;
    };
  };
};


You can change the Range by edit the dayz_poleSafeArea.
If you use Alchemical Crafting, you can change the "Plastic_Pole_EP1_DZ" in any other placeable.





All creadits goes to @MadMartyr for posting his code and @ebayShopper for adding the deleteVehicle idea, instead of porting away.

Original Post:
 

 

Link to comment
Share on other sites

12 hours ago, SKS.Goliath said:

you can also use this script for
no zombies at the trader
???

Of course. You just need to define the position of the trader and create a loop that checks the radius around it instead of the plot pole object.

But why would you need that? Nearly all safezone scripts have that included already.

Link to comment
Share on other sites

On 7/17/2018 at 11:59 AM, SKS.Goliath said:

you can also use this script for
no zombies at the trader
???

Just as Relentless say:

Any Safezonescript can handle this. And if you have custom traderzones, you can normaly add them very easy.

But if you want to do so, place a Plotpole in the traderzones via "Mission.SQM". So players cant destroy them (intend or not) and if the plotpole got run over, it is repaired after restart.

 

Link to comment
Share on other sites

6 hours ago, gle353 said:

Just as Relentless say:

Any Safezonescript can handle this. And if you have custom traderzones, you can normaly add them very easy.

But if you want to do so, place a Plotpole in the traderzones via "Mission.SQM". So players cant destroy them (intend or not) and if the plotpole got run over, it is repaired after restart.

 

Wow, that's way too complicated. He sent me a message and I modified the script for him so no worries. I guess it's solved.

Link to comment
Share on other sites

15 hours ago, inneedofhelp said:

any way to work this to remove AI from bases ? they tend to walk threw walls a lot lol

_poleRadius = 50;		//Radius (meters) the player has to be in (center is the plot pole)
_removeRadius = 50;		//Radius (meters) in which AI should be removed around the player

while {true} do {
	sleep 5;

	_object = "Plastic_Pole_EP1_DZ";
	_inRadius = player distance _object <= _poleRadius;

	if (_inRadius) then {
		{
			if ((!isNull group _x) && (getPlayerUID _x == '')) then {
				deleteVehicle _x;
			};
		} forEach (player nearEntities['Man', _removeRadius]);
	};
};

 

Link to comment
Share on other sites

44 minutes ago, Relentless said:

_poleRadius = 50;		//Radius (meters) the player has to be in (center is the plot pole)
_removeRadius = 50;		//Radius (meters) in which AI should be removed around the player

while {true} do {
	sleep 5;

	_object = "Plastic_Pole_EP1_DZ";
	_inRadius = player distance _object <= _poleRadius;

	if (_inRadius) then {
		{
			if ((!isNull group _x) && (getPlayerUID _x == '')) then {
				deleteVehicle _x;
			};
		} forEach (player nearEntities['Man', _removeRadius]);
	};
};

 

Do not use deleteVehicle, WAI can't count deleted units as dead unit.

on_kill.sqf

Quote

//////

    
if (!isNil "_mission") then {
    if (typeName(wai_mission_data select _mission) == "ARRAY") then {
        wai_mission_data select _mission set [0, ((wai_mission_data select _mission) select 0) - 1];
    };
} else {
    wai_static_data set [0, ((wai_static_data select 0) - 1)];
};
 

/////////

functions.sqf

Quote

/////

wai_completion_check = {
    private ["_completionType","_complete","_position","_mission","_killpercent","_objectivetarget"];
    
    _mission = _this select 0;
    _completionType = _this select 1;
    _killpercent = _this select 2;
    _position = _this select 3;
    _complete = false;
    
    call
    {
        // If you have killed enough AI, then the mission will complete when you get within 20 meters of the mission center
        if (_completionType select 0 == "crate") exitWith {

            if(wai_kill_percent == 0) then {
                _complete = [_position,20] call isNearPlayer;
            } else {
                if(((wai_mission_data select _mission) select 0) <= _killpercent) then {
                    _complete = [_position,20] call isNearPlayer;
                };
            };
        };
        


    
//////

 

I think, "_x setDamage 1;" can solve it...If I'm not wrong

Link to comment
Share on other sites

On 7/23/2018 at 8:49 AM, Relentless said:

_poleRadius = 50;		//Radius (meters) the player has to be in (center is the plot pole)
_removeRadius = 50;		//Radius (meters) in which AI should be removed around the player

while {true} do {
	sleep 5;

	_object = "Plastic_Pole_EP1_DZ";
	_inRadius = player distance _object <= _poleRadius;

	if (_inRadius) then {
		{
			if ((!isNull group _x) && (getPlayerUID _x == '')) then {
				deleteVehicle _x;
			};
		} forEach (player nearEntities['Man', _removeRadius]);
	};
};

 

Is this called from init ? or dose it have to be placed inside a AI script ? got it in a file called airemover and called from init but noticed still got roaming AI in peoples plot areas

Link to comment
Share on other sites

You need to run it in a new thread so the loop doesn't interrupt. You can do that by execVM it or spawn it with an empty array.

Keep in mind that the AI will only be removed within the defined radius if a player is within the set radius of the plot pole.

Link to comment
Share on other sites

2 minutes ago, Relentless said:

You need to run it in a new thread so the loop doesn't interrupt. You can do that by execVM it or spawn it with an empty array.

Keep in mind that the AI will only be removed within the defined radius if a player is within the set radius of the plot pole.

I call it form my init near the bottom using this line [] execVM "airemove.sqf"; but have noticed ai are still getting inside some bases when players are there . Had a guy get killed inside his base earlier, AI walked with in 30 m of him 

Dose it need to be called higher up in the init ? in is dedicated or is server on anything ?

Link to comment
Share on other sites

2 minutes ago, Relentless said:

Hmm weird...
Maybe the deleteVehicle option isn't working. Try what Schalldampfer said. Use setDamage 1.

Like this ?

 

_poleRadius = 50;        //Radius (meters) the player has to be in (center is the plot pole)
_removeRadius = 100;        //Radius (meters) in which AI should be removed around the player

while {true} do {
    sleep 5;

    _object = "Plastic_Pole_EP1_DZ";
    _inRadius = player distance _object <= _poleRadius;

    if (_inRadius) then {
        {
            if ((!isNull group _x) && (getPlayerUID _x == '')) then {
                _x setDamage 1;
            };
        } forEach (player nearEntities['Man', _removeRadius]);
    };
};

Link to comment
Share on other sites

Hmm maybe the group is also a problem. Depends on what AI system you use.
Replace the whole file with:

_poleRadius = 50;		//Radius (meters) the player has to be in (center is the plot pole)
_removeRadius = 50;		//Radius (meters) in which AI should be removed around the player

_object = "Plastic_Pole_EP1_DZ";

while {true} do {
	sleep 5;
	_inRadius = player distance _object <= _poleRadius;

	if (_inRadius) then {
		{
			if ((getPlayerUID _x == '') && !(_x in playableUnits)) then {
				_x setDamage 1;
			};
		} forEach (player nearEntities['Man', _removeRadius]);
	};
};

Call it with execVM in your init.sqf at the bottom outside of the server or dedicated code block.

Link to comment
Share on other sites

The script is likely failing because you cannot take a distance from a classname.

I have written up a quick script for this below, please try it out and let me know how it works :)

private ["_noAI", "_noZeds"];

_noAI = true; // Remove AI within plot radius (true = enabled, false = disabled).
_noZeds = true; // Remove zombies within plot radius (true = enabled, false = disabled).

while {69 == 69} do {
	private "_plots";

	_plots = player nearEntities ["Plastic_Pole_EP1_DZ", DZE_PlotPole select 0];

	if (count _plots > 0) then {
		private "_plot";

		_plot = _plots select 0;

		if (_noZeds) then {
			{deleteVehicle _x} count (_plot nearEntities ["zZombie_Base", DZE_PlotPole select 0]);
		};

		if (_noAI) then {
			{
				if (!isPlayer _x && {_x distance _plot <= (DZE_PlotPole select 0)}) then {_x setDamage 1};
			} count allUnits;
		};
	};
	uiSleep 5;
};

Just name it whatever you would like, then call it from the !isDedicated section of the init.sqf, down at the bottom:

if (!isDedicated) then {
    // CODE FROM INIT HERE
    execVM "FILENAMEHERE.sqf";
};

 

Link to comment
Share on other sites

  • 11 months later...
On 7/25/2018 at 8:49 PM, BigEgg said:

The script is likely failing because you cannot take a distance from a classname.

I have written up a quick script for this below, please try it out and let me know how it works :)


private ["_noAI", "_noZeds"];

_noAI = true; // Remove AI within plot radius (true = enabled, false = disabled).
_noZeds = true; // Remove zombies within plot radius (true = enabled, false = disabled).

while {69 == 69} do {
	private "_plots";

	_plots = player nearEntities ["Plastic_Pole_EP1_DZ", DZE_PlotPole select 0];

	if (count _plots > 0) then {
		private "_plot";

		_plot = _plots select 0;

		if (_noZeds) then {
			{deleteVehicle _x} count (_plot nearEntities ["zZombie_Base", DZE_PlotPole select 0]);
		};

		if (_noAI) then {
			{
				if (!isPlayer _x && {_x distance _plot <= (DZE_PlotPole select 0)}) then {_x setDamage 1};
			} count allUnits;
		};
	};
	uiSleep 5;
};

Just name it whatever you would like, then call it from the !isDedicated section of the init.sqf, down at the bottom:


if (!isDedicated) then {
    // CODE FROM INIT HERE
    execVM "FILENAMEHERE.sqf";
};

 

hello was just wondering with this script does it use the plotpole size as dictated in the init.sqf?

if so is there a way to change it so the distance around the object can be increased?

basically i want to use this to make a zed free sector B

Link to comment
Share on other sites

3 hours ago, don2k7 said:

hello was just wondering with this script does it use the plotpole size as dictated in the init.sqf?

if so is there a way to change it so the distance around the object can be increased?

basically i want to use this to make a zed free sector B

See post by seelenapparat in this thread to create a zombie free sector B.

https://epochmod.com/forum/topic/45136-prevent-zombie-spawn-in-specific-area/

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
  • Discord

×
×
  • Create New...