Jump to content

[Release] Door ESC bug fix


itsatrap

Recommended Posts

Hi all

 

Worked on this problem most of weekend and have found a solution that requires little change in the code

 

copy this files from the dayz_code

 

player_unlockDoor.sqf and player_changeCombo.sqf and place them in your mission file.

folder 

dayz_code\compile\

in your compiles.sqf add

player_unlockDoor   = compile preprocessFileLineNumbers "dayz_code\compile\player_unlockDoor.sqf";
player_changeCombo   = compile preprocessFileLineNumbers "dayz_code\compile\player_changeCombo.sqf";

FILE: player_unlockDoor.sqf

 

inset this code

DZE_Lock_Door = CGG_Lock_Door;

under 

_objectCharacterID 	= _obj getVariable ["CharacterID","0"];

should look like this

_objectCharacterID   = _obj getVariable ["CharacterID","0"];
DZE_Lock_Door = CGG_Lock_Door;

at the bottom

 

add this code as the second last line

CGG_Lock_Door = "0";

DZE_DYN_UnlockDoorInprogress = nil;

FILE: player_changeCombo.sqf

 

replace this code:

 

last line in file

//DZE_Lock_Door = format["%1%2%3",DZE_topCombo,DZE_midCombo,DZE_botCombo];
CGG_Lock_Door = format["%1%2%3",DZE_topCombo,DZE_midCombo,DZE_botCombo];
Link to comment
Share on other sites

when you open the door combolook gui, you can set the code of the door, press ESC you can now unlock the door with having pressed the unlock button in the GUI, which means you have infinity attempts 

 

so a player can use a macro to unlock, had one on my server do it, he found the door key in 4 min, and the key was 487..

Link to comment
Share on other sites

I use this to prevent brute forcing but it doesnt work with your fix.

if (!isDedicated) then {
	player_unlockDoor = {
		private ["_ok"];
		if (!isNull dayz_selectedDoor) then
		{
			_obj = dayz_selectedDoor;
			_objectCharacterID 	= _obj getVariable ["CharacterID","0"];
			if (DZE_Lock_Door == _objectCharacterID) then
			{
				[player,"combo_unlock",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				if(_obj animationPhase "Open_hinge" == 0) then
				{
					_obj animate ["Open_hinge", 1];
				};
				if(_obj animationPhase "Open_latch" == 0) then
				{
					_obj animate ["Open_latch", 1];
				};
			}
			else
			{
				DZE_Lock_Door = "";
				[player,"combo_locked",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				
				cutText ["WRONG CODE ENTERED - WAIT 30 SECONDS", "PLAIN DOWN"];
				if (isNil 'KeyCodeTry') then {KeyCodeTry = true;};
				[] spawn {sleep 30;KeyCodeTry = nil;};
				[] spawn {
					while {KeyCodeTry} do
					{
					disableSerialization;
						_display = findDisplay 41144;
						_display closeDisplay 3000;
						sleep 0.1;
					};
				};
			};
		}
		else
		{
		disableSerialization;
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		};
	};
};

I'm trying a few things but while I do maybe you know how to make it work with this? As I get wrong code entered when I try it with your fix.

 

Edit:

 

This works:

if (!isDedicated) then {
	player_unlockDoor = {
		private ["_ok"];
		if (!isNull dayz_selectedDoor) then
		{
			_obj = dayz_selectedDoor;
			_objectCharacterID 	= _obj getVariable ["CharacterID","0"];
			DZE_Lock_Door = CGG_Lock_Door;
			if (DZE_Lock_Door == _objectCharacterID) then
			{
				[player,"combo_unlock",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				if(_obj animationPhase "Open_hinge" == 0) then
				{
					_obj animate ["Open_hinge", 1];
				};
				if(_obj animationPhase "Open_latch" == 0) then
				{
					_obj animate ["Open_latch", 1];
				};
			}
			else
			{
				DZE_Lock_Door = "";
				[player,"combo_locked",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				
				cutText ["WRONG CODE ENTERED - WAIT 30 SECONDS", "PLAIN DOWN"];
				if (isNil 'KeyCodeTry') then {KeyCodeTry = true;};
				[] spawn {sleep 30;KeyCodeTry = nil;};
				[] spawn {
					while {KeyCodeTry} do
					{
					disableSerialization;
						_display = findDisplay 41144;
						_display closeDisplay 3000;
						sleep 0.1;
					};
				};
			};
		}
		else
		{
		disableSerialization;
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		};
	};
};
Link to comment
Share on other sites

 

I use this to prevent brute forcing but it doesnt work with your fix.

if (!isDedicated) then {
	player_unlockDoor = {
		private ["_ok"];
		if (!isNull dayz_selectedDoor) then
		{
			_obj = dayz_selectedDoor;
			_objectCharacterID 	= _obj getVariable ["CharacterID","0"];
			if (DZE_Lock_Door == _objectCharacterID) then
			{
				[player,"combo_unlock",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				if(_obj animationPhase "Open_hinge" == 0) then
				{
					_obj animate ["Open_hinge", 1];
				};
				if(_obj animationPhase "Open_latch" == 0) then
				{
					_obj animate ["Open_latch", 1];
				};
			}
			else
			{
				DZE_Lock_Door = "";
				[player,"combo_locked",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				
				cutText ["WRONG CODE ENTERED - WAIT 30 SECONDS", "PLAIN DOWN"];
				if (isNil 'KeyCodeTry') then {KeyCodeTry = true;};
				[] spawn {sleep 30;KeyCodeTry = nil;};
				[] spawn {
					while {KeyCodeTry} do
					{
					disableSerialization;
						_display = findDisplay 41144;
						_display closeDisplay 3000;
						sleep 0.1;
					};
				};
			};
		}
		else
		{
		disableSerialization;
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		};
	};
};

I'm trying a few things but while I do maybe you know how to make it work with this? As I get wrong code entered when I try it with your fix.

 

Edit:

 

This works:

if (!isDedicated) then {
	player_unlockDoor = {
		private ["_ok"];
		if (!isNull dayz_selectedDoor) then
		{
			_obj = dayz_selectedDoor;
			_objectCharacterID 	= _obj getVariable ["CharacterID","0"];
			DZE_Lock_Door = CGG_Lock_Door;
			if (DZE_Lock_Door == _objectCharacterID) then
			{
				[player,"combo_unlock",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				if(_obj animationPhase "Open_hinge" == 0) then
				{
					_obj animate ["Open_hinge", 1];
				};
				if(_obj animationPhase "Open_latch" == 0) then
				{
					_obj animate ["Open_latch", 1];
				};
			}
			else
			{
				DZE_Lock_Door = "";
				[player,"combo_locked",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				
				cutText ["WRONG CODE ENTERED - WAIT 30 SECONDS", "PLAIN DOWN"];
				if (isNil 'KeyCodeTry') then {KeyCodeTry = true;};
				[] spawn {sleep 30;KeyCodeTry = nil;};
				[] spawn {
					while {KeyCodeTry} do
					{
					disableSerialization;
						_display = findDisplay 41144;
						_display closeDisplay 3000;
						sleep 0.1;
					};
				};
			};
		}
		else
		{
		disableSerialization;
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		};
	};
};

so i just need to add these code in the compiles or what ?

Link to comment
Share on other sites

Fix: characterID is a string not an integer.

 

Find:

CGG_Lock_Door = 0;

Change 2:

CGG_Lock_Door = "0";

 

anyway if you really want to block the escape button check my post out.

 

 

this line is only used to reset the varible.

[] spawn {
waitUntil

takes more resources, thats why i was looking for an solution with no wait or spawn

Link to comment
Share on other sites

this line is only used to reset the varible.

[] spawn {
waitUntil

takes more resources, thats why i was looking for an solution with no wait or spawn

 

not on your server and the sleep command in it slows it a bit down.

been using this without problems over a year now. considering it is inside unsheduled environment it

does not affect the overal processing time of all other code that needs to run constantly.

_objectCharacterID 	= _obj getVariable ["CharacterID","0"];
			DZE_Lock_Door = CGG_Lock_Door;
			if (DZE_Lock_Door == _objectCharacterID) then

think about it, you setting your variable to an integer and that part checking for a string

the result is a "Generic Error"

 

However i found that it creates a bug that forces the player to go back to lobby and respawn

to get the unlock door option again so this can go 2 ways...

Link to comment
Share on other sites

  • 2 months later...

 

I use this to prevent brute forcing but it doesnt work with your fix.

if (!isDedicated) then {
	player_unlockDoor = {
		private ["_ok"];
		if (!isNull dayz_selectedDoor) then
		{
			_obj = dayz_selectedDoor;
			_objectCharacterID 	= _obj getVariable ["CharacterID","0"];
			if (DZE_Lock_Door == _objectCharacterID) then
			{
				[player,"combo_unlock",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				if(_obj animationPhase "Open_hinge" == 0) then
				{
					_obj animate ["Open_hinge", 1];
				};
				if(_obj animationPhase "Open_latch" == 0) then
				{
					_obj animate ["Open_latch", 1];
				};
			}
			else
			{
				DZE_Lock_Door = "";
				[player,"combo_locked",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				
				cutText ["WRONG CODE ENTERED - WAIT 30 SECONDS", "PLAIN DOWN"];
				if (isNil 'KeyCodeTry') then {KeyCodeTry = true;};
				[] spawn {sleep 30;KeyCodeTry = nil;};
				[] spawn {
					while {KeyCodeTry} do
					{
					disableSerialization;
						_display = findDisplay 41144;
						_display closeDisplay 3000;
						sleep 0.1;
					};
				};
			};
		}
		else
		{
		disableSerialization;
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		};
	};
};

I'm trying a few things but while I do maybe you know how to make it work with this? As I get wrong code entered when I try it with your fix.

 

Edit:

 

This works:

if (!isDedicated) then {
	player_unlockDoor = {
		private ["_ok"];
		if (!isNull dayz_selectedDoor) then
		{
			_obj = dayz_selectedDoor;
			_objectCharacterID 	= _obj getVariable ["CharacterID","0"];
			DZE_Lock_Door = CGG_Lock_Door;
			if (DZE_Lock_Door == _objectCharacterID) then
			{
				[player,"combo_unlock",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				if(_obj animationPhase "Open_hinge" == 0) then
				{
					_obj animate ["Open_hinge", 1];
				};
				if(_obj animationPhase "Open_latch" == 0) then
				{
					_obj animate ["Open_latch", 1];
				};
			}
			else
			{
				DZE_Lock_Door = "";
				[player,"combo_locked",0,false] call dayz_zombieSpeak;
				disableSerialization;
				_display = findDisplay 41144;
				_display closeDisplay 3000;
				
				cutText ["WRONG CODE ENTERED - WAIT 30 SECONDS", "PLAIN DOWN"];
				if (isNil 'KeyCodeTry') then {KeyCodeTry = true;};
				[] spawn {sleep 30;KeyCodeTry = nil;};
				[] spawn {
					while {KeyCodeTry} do
					{
					disableSerialization;
						_display = findDisplay 41144;
						_display closeDisplay 3000;
						sleep 0.1;
					};
				};
			};
		}
		else
		{
		disableSerialization;
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		};
	};
};

Hi chaps,

 

like both your work here... :)

 

Quick question, ToejaM, when I use your edited (2nd) version above with itsatrap's code merged in, I'm finding that if you enter the correct code, you have to click unlock 4 times before the lock dialog goes away and the open door option comes up on the scrollwheel....are you getting that too?

 

Thanks

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...