Jump to content

Zombie Shield Generator


N340

Recommended Posts

  • 2 weeks later...

now im having an odd issue, installed this per the instructions and modified it to run off a plot pole,  that works fine.  You get the scroll wheel options to cycle it on and off but after you initially look at the pole and get the scroll wheel options they wont go away until you log out and back in, no matter the distance from object or wether you are looking at it or the sky.  i added  the             s_player_ZombieShield_on = -1;

            player removeAction s_player_ZombieShield_off;
            s_player_ZombieShield_off = -1;

 

in the self actions, so not sure what the issue is, i really like the option but just having a brain fart atm on it i guess.  any help from anyone is appreciated.  thanks.            [sSG]   SideShowFreak

 

 

 

EDIT:  it seems it actually does go away but it takes a few minutes to do so.  anyone have any idea on how to make it vanish when you look away?  like sooner that a few mintues?

Edited by SideShowFreak
Link to comment
Share on other sites

Anyone having an issue with this working on the latest 125548 patch?

 

I implemented it using and it works great!

 

 

now im having an odd issue, installed this per the instructions and modified it to run off a plot pole,  that works fine.  You get the scroll wheel options to cycle it on and off but after you initially look at the pole and get the scroll wheel options they wont go away until you log out and back in, no matter the distance from object or wether you are looking at it or the sky.  i added  the             s_player_ZombieShield_on = -1;

            player removeAction s_player_ZombieShield_off;

            s_player_ZombieShield_off = -1;

 

in the self actions, so not sure what the issue is, i really like the option but just having a brain fart atm on it i guess.  any help from anyone is appreciated.  thanks.            [sSG]   SideShowFreak

 

 

 

EDIT:  it seems it actually does go away but it takes a few minutes to do so.  anyone have any idea on how to make it vanish when you look away?  like sooner that a few mintues?

 

I am having the same issue. Menus sticks around for several minutes.

Link to comment
Share on other sites

I implemented it using and it works great!

 

 

 

I am having the same issue. Menus sticks around for several minutes.

Just noticed this xD to fix this i removed this from the force save section in tutorial

player removeAction s_player_ZombieShield_on;
s_player_ZombieShield_on = -1;
player removeAction s_player_ZombieShield_off;
s_player_ZombieShield_off = -1;

And moved it to the bottom of fn_self here

	player removeAction s_player_deleteBuild;
	s_player_deleteBuild = -1;
	player removeAction s_player_butcher;
	s_player_butcher = -1;
        //ZedShield
	player removeAction s_player_ZombieShield_on;
	s_player_ZombieShield_on = -1;
	player removeAction s_player_ZombieShield_off;
	s_player_ZombieShield_off = -1;
	player removeAction s_player_cook;
	s_player_cook = -1;
Link to comment
Share on other sites

So its just come to my attention that something in the 125548 patch has broken this, theres 2 scripts I've tried and it really doesn't work, I can build it and get the options to activate it but it doesn't activate it, it was working on 1.63.112555

Link to comment
Share on other sites

Hows your setup as its almost as if my fn_self code doesn't forward me onto the zedshield code

I use a custom folder to put all my custom stuff and overrides in; I have a custom compiles where I am overriding the call to fn_selfActions.sqf.

In my custom compiles.sqf:

 

if (!isDedicated) then {
	fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf";
};

In my init.sqf is where I call the custom compiles and variables:

 

//Load in compiled functions
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";				//Initilize the Variables (IMPORTANT: Must happen very early)
call compile preprocessFileLineNumbers "custom\variables.sqf";
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";				//Initilize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";	//Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";				//Compile regular functions
call compile preprocessFileLineNumbers "custom\compiles.sqf";
progressLoadingScreen 0.5;
call compile preprocessFileLineNumbers "server_traders.sqf";				//Compile trader configs
progressLoadingScreen 1.0;
Link to comment
Share on other sites

Hmm same here, is the rest the same in the tutorial? Everything up until clicking the activate option on sheildgens works, i just can't activate them anymore all of a sudden

I have this
 

//Zombie Shield
if (_cursorTarget isKindof TypeOfZShield) then {
if (EnableZShield == 1) then {
if (s_player_ZombieShield_on < 0) then {
s_player_ZombieShield_on = player addAction [format[("<t color="#FFF700"">" + ("Zombie Shield On") +"</t>"),_adminText], "custom\dayz_code\actions\ZombieShield.sqf", [_lever, true], 6, true, true, "", "];
};
if (s_player_ZombieShield_off < 0) then {
s_player_ZombieShield_off = player addAction [format[("<t color="#FFF700"">" + ("Zombie Shield Off") +"</t>"),_adminText], "custom\dayz_code\actions\ZombieShield.sqf", [_lever, false], 6, false, true, "", "];
};
} else {
if (s_player_ZombieShield_on < 0) then {
s_player_ZombieShield_on = player addAction [format[("<t color="#FFF700"">" + ("Zombie Shields are disabled on this server") +"</t>"),_adminText], "", [], 6, false, true, "", "];
};
player removeAction s_player_ZombieShield_off;
s_player_ZombieShield_off = -1;
};
} else {
player removeAction s_player_ZombieShield_on;
s_player_ZombieShield_on = -1;
player removeAction s_player_ZombieShield_off;
s_player_ZombieShield_off = -1;
};
//End Shield

under

if(_player_deleteBuild) then {
if (s_player_deleteBuild < 0) then {
s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "custom\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
};
} else {
player removeAction s_player_deleteBuild;
s_player_deleteBuild = -1;
};

the code that the tutorial says to put in variables is in the exact same place, no changes and there is no changes to the ZedShields.sqf.
 
Before hand i could select the activate option and i'd get the message saying it was activating now it just does nothing after hitting the option
Link to comment
Share on other sites

Hmm same here, is the rest the same in the tutorial? Everything up until clicking the activate option on sheildgens works, i just can't activate them anymore all of a sudden

Yep, everything apart from that is the same for me. I did have to add an exception to my AH to keep from getting kicked when activating/deactivating.

BTW, your fix for the menu items hanging around worked as well.

Link to comment
Share on other sites

anyone able to help me add this to my server, im a complete noob when it comes to things like this

I can guide you I suppose although it is pretty straight forward.

Do you have any other mods installed that would cause you to already have a custom compiles and/or variables override?

Link to comment
Share on other sites

Kami  double check your paths to          "custom\dayz_code\actions\ZombieShield.sqf"

Personally i use a  "Custom\Scripts\ZombieShield.sqf"  location 

Unless you have the ZombieShield.sqf inside a folder named actions inside a folder named dayz_code inside a folder named custom in your mission file.  If you know what i mean

Link to comment
Share on other sites

i just took the original code and altered it, the hook into player build listed wasn;t quite right and when i fixed the line it would lock you in building, so i altered it to be a generator and then altered it some more so it only works when the generator is running. That way it makes noise and players can track a player down using the generator.

Link to comment
Share on other sites

i just took the original code and altered it, the hook into player build listed wasn;t quite right and when i fixed the line it would lock you in building, so i altered it to be a generator and then altered it some more so it only works when the generator is running. That way it makes noise and players can track a player down using the generator.

 

Care to share your altered script?

Link to comment
Share on other sites

Yep, everything apart from that is the same for me. I did have to add an exception to my AH to keep from getting kicked when activating/deactivating.

BTW, your fix for the menu items hanging around worked as well.

LOL DERP! I missed out the _lever = cursorTarget; line above the zed shield statement

 

_lever = cursorTarget;

//Zombie Shield
	if (_cursorTarget isKindof TypeOfZShield) then {

Hopefully it'll work now

Link to comment
Share on other sites

Sure:

 

fn_self Actions:

 

Under:

if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.

add (for undefined variable error):

_lever = -1; 

Under:

	} else {
		player removeAction s_player_deleteBuild;
		s_player_deleteBuild = -1;
	};
	_lever = _cursorTarget;
	
	//Zombie Shield
		if(_cursorTarget isKindOf "Generator_DZ"&& (_lever getVariable ["GeneratorRunning", false])) then {
			if (s_player_ZombieShield_on < 0 && !zshieldActive) then {
				s_player_ZombieShield_on = player addAction [format[("<t color=""#FFF700"">" + ("Zombie Shield On") +"</t>"),_adminText], "shield\ZombieShield.sqf", [_lever, true], 6, true, true, "", ""];
			};
			if (s_player_ZombieShield_off < 0 && zshieldActive) then {
				s_player_ZombieShield_off = player addAction [format[("<t color=""#FFF700"">" + ("Zombie Shield Off") +"</t>"),_adminText], "shield\ZombieShield.sqf", [_lever, false], 6, false, true, "", ""];
			};
		} else {
			player removeAction s_player_ZombieShield_on;
			player removeAction s_player_ZombieShield_off;
			s_player_ZombieShield_on = -1;
			s_player_ZombieShield_off = -1;
		};
	//End Shield	

In the //Engineering section near bottom:

	player removeAction s_player_ZombieShield_off;
	player removeAction s_player_ZombieShield_on;
	s_player_ZombieShield_on = -1;
	s_player_ZombieShield_off = -1;

 

shield\ZombieShield.sqf:

//This script is used to toggle the zombie shield on/off

private ["_id","_shieldGen",_doZombieShield,"_generator","_shieldRadius","_doShield","_zombieFreaks","_zombieFreak","_count","_shieldGenStatus"];
_id = _this select 2;
_shieldGen = _this select 3 select 0;
_doZombieShield = _this select 3 select 1;
//_shieldGen removeAction _id;
_shieldRadius = ZShieldRadius;
zshieldActive = _this select 3 select 1;

_func_zombie_shield = {
//diag_log ["Stage 3 here"];
	if (_doShield) then {
		//diag_log ["Stage 4 here"];
		_shieldGen = _this select 0;
		_shieldGen setVariable ["ZombieShield", "true", true];
		[nil,_shieldGen,rSAY,["engine_12s", _shieldRadius]] call RE;
		while {(_shieldGen getVariable ["ZombieShield","false"]) == "true"} do {
			//diag_log ["Stage 5 here"];
			//_staticSounds = ["PMC_ElectricBlast1","PMC_ElectricBlast2"] call BIS_fnc_selectRandom;
			//[nil,_shieldGen,rSAY,[_staticSounds,_shieldRadius]] call RE;
			_zombieFreaks = (position _shieldGen) nearEntities ["zZombie_Base", _shieldRadius];
			_count = count _zombieFreaks;
			for "_i" from 0 to (_count -1) do {
				if((_shieldGen getVariable ["GeneratorRunning", false])) then {
					_zombieFreak = _zombieFreaks select _i;
					if (ZShieldClean == 1) then {
						deleteVehicle _zombieFreak;
					} else {
						_zombieFreak setDamage 1;
					};
					sleep 1;
				} else {
					_doShield = false;
					s_player_ZombieShield_on = -1;
					player removeAction s_player_ZombieShield_off;
					_i = 0;
					zshieldActive = false;
					_shieldGen setVariable ["ZombieShield", "false", true];
				};
			};
		};
	} else {
		//diag_log ["Stage 4.5 here"];
		_shieldGen = _this select 0;
		_shieldGen setVariable ["ZombieShield", "false", true];
	};
};

 

Variables.sqf:

in dayz_resetSelfActions = { put:

	s_player_ZombieShield_on = -1;
	s_player_ZombieShield_off = -1;

at bottom (some of these values are usless but i just left them as is):

/**************************************************** Zombie Shield Generator Settings ****************************************************/
	EnableZShield				= 1; 
	TypeOfZShield				= "Generator_DZ";
	AllZShieldTypes				= ["CDF_WarfareBUAVterminal","Generator_DZ"];
	MaxZShields					= 1; 
	ZShieldRadius				= 50;
	ZShieldClean				= 0; 
	zshieldActive 				= false;

 

The only issue i found in the bit of testing i did was if multiple players started messing with the generator some players would get some of the actions stuck in their scroll menu until relog. You only get the option to start zshield when generator is running, if you shut off the generator it will automatically shut off the zshield. if anyone wants to run with this and fix it up a bit more for multiple players go right ahead.

Link to comment
Share on other sites

  • 3 weeks later...

should give some credits to the original zombie-shield, Freaking Fred, I "believe" its his work that was used in the base building

http://opendayz.net/threads/release-freds-anti-zombie-frequency-emitter-aka-zombie-shield.12340/

 

I actually wrote this one and it did take a bit of trial and error. This code is pulled straight from my Base Building 1.3 code for the zombie shield, just with a file name change and the BB 1.3 flag and generator checks removed. You can still see all my diag_log entries which are commented out from when I was testing to make sure it progressed through each stage as it should. It even includes variables which aren't being used because it's missing huge chunks of the relevant code needed for them.

 

TypeOfZShield - That will work, but the BB 1.3 code includes an entry in the server_monitor.sqf tied to the next variable

 

AllZShieldTypes - Used in conjunction with the server_monitor code, it looks for all items in that list during startup with an owner ID tied to them, and if it finds any then it checks to see if they match the current 'TypeOfZShield' and if they don't it'll change them to the current type so they still work. 

 

MaxZShields - That wont do anything without the BB 1.3 base code in which I stored the playerUID to the inventory slots of the database for base building items. In BB 1.3 the script runs a check across all other ZShield generators in the DB for the players UID and if it finds a match >= to the value of the variable then it wont let them build another. 

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
×
×
  • Create New...