Jump to content

1.6 [ Remake of Hotwire Safes/Lockboxes]


juandayz

Recommended Posts

INSTALL:

1-You need a custom fn_selfactions.sqf

Spoiler

A-

find:


//Allow owner to unlock vault
if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then {

Above it paste:


	//////////////hotwire
if (_typeOfCursorTarget in DZE_LockableStorage) then {	
	 if (s_player_hotwirevault < 0) then {                 	 
	     s_player_hotwirevault = player addaction [("<t color=""#B40404"">" + ("Hotwire Vault") +"</t>"), "scripts\forcevault.sqf",_cursorTarget, 0, false, true, "", ""];
          };				   
          } else {
           player removeAction s_player_hotwirevault;
           s_player_hotwirevault = -1;
           };	
	if (_typeOfCursorTarget in DZE_UnLockedStorage) then {
	 player removeAction s_player_hotwirevault;
     s_player_hotwirevault = -1;
	};
	//////////////hotwire

 

B-Near of bottom find:


} else {
	//Engineering

Paste below:


player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

2-In a custom variables.sqf

Spoiler

//Player self-action handles
dayz_resetSelfActions = {

paste below:


s_player_hotwirevault = -1;

3-Create forcevault.sqf (  drop into mpmissions\yourinstance\scripts\ )

Spoiler

/** ORIGINAL Author: SchwEde aka shinySonic **/
/** REWRITED BY juandayz and dedicated for Pillbox and NOVA :D **/
//Fixes by "a man" and "shawn" tnks guys for the help

private ["_Message","_ownerID","_hasitem","_vault","_isunlockable","_open","_SetChanceToFail"];

_vault = _this select 3;
_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked"));
_open= round(random 10);
_SetChanceToFail = 9;//1 chance to unlock /9 chance to cannot unlock
_hasitem = "ItemHotwireKit" in magazines player;
_ownerID = cursorTarget getVariable ["ownerPUID","0"];

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

if (!_hasitem) exitWith {
systemChat("You need a hotwire kit in your inventory");
};


dayz_actionInProgress = true;
player removeMagazine "ItemHotwireKit";


if (_isunlockable) then {

if (_open < _SetChanceToFail)  exitWith {
dayz_actionInProgress = false;
systemChat("Bad Luck, i could not open it and broke the Hotwire Kit");
_Message = format ["%1 (%2) IS TRYING TO BREAK INTO A SAFE OR LOCKBOX @ %3  Owner: %4",dayz_playerName,dayz_playerUID,(mapGridPosition getPos player),_ownerID];
["CrackSafe_log",_Message,true] call fnc_log;                            
};

systemChat("Done! I have opened the vault");

//call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_unlock.sqf";
dayz_combination = _vault getVariable["CharacterID","0"];
_vault spawn player_unlockVault;
dayz_actionInProgress = false;
_Message = format ["%1 (%2) HAS BROKEN INTO A SAFE OR LOCKBOX @ %3  Owner: %4",dayz_playerName,dayz_playerUID,(mapGridPosition getPos player),_ownerID];
["CrackSafe_log",_Message,true] call fnc_log;                             
};

 

and its done. Remember you need have a itemhotwire in your inventory.

Link to comment
Share on other sites

Haven't had time to test it yet, does anyone know if this has the dupe fix in it? I remember on a server I played on that used this script back a few years ago I found a dupe that you could get the scroll wheel option, put the hotwire kit in your backpack with the option to hotwire still, and then click the hotwire option and boom... duped.

Link to comment
Share on other sites

@PillBox_ Maybe I didn't explain correctly. (On the server I played on) After having it in your main inventory, you get the option to crack safe BUT do not click option yet. Then while still looking at the safe, open gear and put the hotwire kit in your backpack. Close your gear while still facing the safe and the option would still be there, then act as if it was there the whole time and still have a X% chance of opening...

In the old version of this

, someone reported the same dupe and I believe it was SchwEde or another user told him he must have installed it wrong because there was a check for that kind of dupe; yet, I saw the same dupe on the server I played on...

Link to comment
Share on other sites

  • 1 month later...

@PillBox_ and @looter809

If you have not fix it yet, just put a test if the player has a hotwire kit in the script at the beginning like that:

private ["_hasHotwire","_vault","_isunlockable","_open","_SetChanceToFail"];

_hasHotwire = "ItemHotwireKit" in magazines player;

if (!_hasHotwire) exitwith { dayz_actionInProgress = false; "You need a hotwire kit to crack a vault" call dayz_rollingMessages;};

.
.
.
...rest of the script

 

Link to comment
Share on other sites

On 10/3/2017 at 9:47 AM, A Man said:

@PillBox_ and @looter809

If you have not fix it yet, just put a test if the player has a hotwire kit in the script at the beginning like that:


private ["_hasHotwire","_vault","_isunlockable","_open","_SetChanceToFail"];

_hasHotwire = "ItemHotwireKit" in magazines player;

if (!_hasHotwire) exitwith { dayz_actionInProgress = false; "You need a hotwire kit to crack a vault" call dayz_rollingMessages;};

.
.
.
...rest of the script

 

the scroll menu in fn_selfactions have this restricttion... if thers no itemhotwire,, the option dsnt show... but anyway i think youre way its better. Cuz with the restriction on scroll menu the option to crack its hidden.. but if u put in on a client side script then allow everybody to know that the option to crack is allowed.

So a change for it:

in fn_selfactions

Spoiler

//////////////hotwire
if (_typeOfCursorTarget in DZE_LockableStorage) then {	
	 if (s_player_hotwirevault < 0) then {                 	 
	     s_player_hotwirevault = player addaction [("<t color=""#B40404"">" + ("Hotwire Vault") +"</t>"), "custom\forcevault.sqf",_cursorTarget, 0, false, true, "", ""];
          };				   
          } else {
           player removeAction s_player_hotwirevault;
           s_player_hotwirevault = -1;
           };	
	if (_typeOfCursorTarget in DZE_UnLockedStorage) then {
	 player removeAction s_player_hotwirevault;
     s_player_hotwirevault = -1;
	};
	//////////////hotwire

 

in forcevault.sqf

Spoiler

/** ORIGINAL Author: SchwEde aka shinySonic **/
/** REWRITED BY juandayz and dedicated for Pillbox :D **/

private ["_hasHotwire","_vault","_isunlockable","_open","_SetChanceToFail"];

_vault = _this select 3;
_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked"));
_open= round(random 10);
_SetChanceToFail = 9;//1 chance to unlock /9 chance to cannot unlock
_hasHotwire = "ItemHotwireKit" in magazines player;

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

if (!_hasHotwire) exitwith { 
dayz_actionInProgress = false; 
systemChat("You need a hotwire kit to crack a vault");
};


player removeMagazine "ItemHotwireKit";


if (_isunlockable) then {

if (_open < _SetChanceToFail)  exitWith {
dayz_actionInProgress = false;
systemChat("Bad Luck, i could not open it and broke the Hotwire Kit");
};

systemChat("Done! I have opened the vault");
call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_unlock.sqf";
dayz_actionInProgress = false;
};

 

 

Link to comment
Share on other sites

I was able to replicate the dupe, all I needed was the hot wire on me, and then quickly place it inside my backpack or drop it. It would give me the hot wire vault option for a millisecond, but once i hit it, I was able to hot wire the safe. To fix this, do exactly what @A Man said, just add a check to see if the player has a hot wire in their inventory.

if !("ItemHotwireKit" in magazines player) exitwith {    
	cutText [format["No hotwire in inventory."],"PLAIN DOWN"];
};

also, at the very end, add this:

dayz_combination = _vault getVariable["CharacterID","0"];
_vault spawn player_unlockVault;
DZE_ActionInProgress = false;

and remove:

call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_unlock.sqf";

so here's the fixed version:

private ["_vault","_isunlockable","_open","_SetChanceToFail"];

_vault = _this select 3;
_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked"));
_open= round(random 10);
_SetChanceToFail = 9;//Value*10 for percentage chance of failure

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

if !("ItemHotwireKit" in magazines player) exitwith {    
	_msg = "No hotwire in inventory."; 
	systemChat ("Server: "+str _msg);
};

dayz_actionInProgress = true;
player removeMagazine "ItemHotwireKit";

if (_isunlockable) then {

if (_open < _SetChanceToFail)  exitWith {
	dayz_actionInProgress = false;
	_msg = "Bad Luck, i could not open it and broke the Hotwire Kit."; 
	systemChat ("Server: "+str _msg);
};

_msg = "Done! I have opened the vault."; 
systemChat ("Server: "+str _msg);
dayz_combination = _vault getVariable["CharacterID","0"];
_vault spawn player_unlockVault;
DZE_ActionInProgress = false;
};

 

Link to comment
Share on other sites

  • 2 months later...
On 1/20/2017 at 4:55 PM, juandayz said:

This is a rewrite for the old Hotwire Safese/eLockboxes .. all credits for @SchwEde

Fixes by @A Man and @Shawn was added. (tnks guys)

And is fully dedicate for @PillBox_ remake it was his idea!

 

INSTALL:

1-You need a custom fn_selfactions.sqf

  Reveal hidden contents

A-

find:



//Allow owner to unlock vault
if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then {

Above it paste:



	//////////////hotwire
if (_typeOfCursorTarget in DZE_LockableStorage) then {	
	 if (s_player_hotwirevault < 0) then {                 	 
	     s_player_hotwirevault = player addaction [("<t color=""#B40404"">" + ("Hotwire Vault") +"</t>"), "custom\forcevault.sqf",_cursorTarget, 0, false, true, "", ""];
          };				   
          } else {
           player removeAction s_player_hotwirevault;
           s_player_hotwirevault = -1;
           };	
	if (_typeOfCursorTarget in DZE_UnLockedStorage) then {
	 player removeAction s_player_hotwirevault;
     s_player_hotwirevault = -1;
	};
	//////////////hotwire

 

B-Near of bottom find:



} else {
	//Engineering

Paste below:



player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

 

2-In a custom variables.sqf

  Reveal hidden contents

find:



//Player self-action handles
dayz_resetSelfActions = {

paste below:



s_player_hotwirevault = -1;

 

3-Create forcevault.sqf (  drop into mpmissions\yourinstance\custom )

  Reveal hidden contents


/** ORIGINAL Author: SchwEde aka shinySonic **/
/** REWRITED BY juandayz and dedicated for Pillbox :D **/
//Fixes by "a man" and "shawn" tnks guys for the help

private ["_hasitem","_vault","_isunlockable","_open","_SetChanceToFail"];

_vault = _this select 3;
_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked"));
_open= round(random 10);
_SetChanceToFail = 9;//1 chance to unlock /9 chance to cannot unlock
_hasitem = "ItemHotwireKit" in magazines player;

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

if (!_hasitem) exitWith {
systemChat("You need a hotwire kit in your inventory");
};


dayz_actionInProgress = true;
player removeMagazine "ItemHotwireKit";


if (_isunlockable) then {

if (_open < _SetChanceToFail)  exitWith {
dayz_actionInProgress = false;
systemChat("Bad Luck, i could not open it and broke the Hotwire Kit");
};

systemChat("Done! I have opened the vault");

//call compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_unlock.sqf";
dayz_combination = _vault getVariable["CharacterID","0"];
_vault spawn player_unlockVault;
dayz_actionInProgress = false;
};

 

and its done. Remember you need have a itemhotwire in your inventory.

See ya epoch communty im going on vacations

Is there a way to enable some sort of logging for when a player attempts/succeeds with this?

Link to comment
Share on other sites

  • 3 weeks later...

@DieTanx

If your using my bomb objects you can use the messages in player_bombobject.sqf

eg.

Spoiler

/** ORIGINAL Author: SchwEde aka shinySonic **/
/** REWRITED BY juandayz and dedicated for Pillbox :D **/
//Fixes by "a man" and "shawn" tnks guys for the help

private ["_hasitem","_vault","_isunlockable","_open","_SetChanceToFail","_ownerID","_Message"];

_vault = _this select 3;
_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked"));
_open= round(random 10);
_SetChanceToFail = 9;//1 chance to unlock /9 chance to cannot unlock
_hasitem = "ItemHotwireKit" in magazines player;
_ownerID = cursorTarget getVariable ["ownerPUID","0"];

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

if (!_hasitem) exitWith {
systemChat("You need a hotwire kit in your inventory");
};

dayz_actionInProgress = true;
player removeMagazine "ItemHotwireKit";

if (_isunlockable) then {
if (_open < _SetChanceToFail)  exitWith {
_Message = format ["%1 (%2) IS TRYING TO BREAK INTO A SAFE OR LOCKBOX @ %3  Owner: %4",dayz_playerName,dayz_playerUID,(mapGridPosition getPos player),_ownerID];
["CrackSafe_log",_Message,true] call fnc_log;
dayz_actionInProgress = false;
systemChat("Bad Luck, i could not open it and broke the Hotwire Kit");
};

systemChat("Done! I have opened the vault");
_Message = format ["%1 (%2) HAS BROKEN INTO A SAFE OR LOCKBOX @ %3  Owner: %4",dayz_playerName,dayz_playerUID,(mapGridPosition getPos player),_ownerID];
["CrackSafe_log",_Message,true] call fnc_log;
dayz_combination = _vault getVariable["CharacterID","0"];
_vault spawn player_unlockVault;
dayz_actionInProgress = false;
};

 

 

Link to comment
Share on other sites

28 minutes ago, oldmatechoc said:

@DieTanx

If your using my bomb objects you can use the messages in player_bombobject.sqf

eg.

  Hide contents


/** ORIGINAL Author: SchwEde aka shinySonic **/
/** REWRITED BY juandayz and dedicated for Pillbox :D **/
//Fixes by "a man" and "shawn" tnks guys for the help

private ["_hasitem","_vault","_isunlockable","_open","_SetChanceToFail","_ownerID","_Message"];

_vault = _this select 3;
_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked"));
_open= round(random 10);
_SetChanceToFail = 9;//1 chance to unlock /9 chance to cannot unlock
_hasitem = "ItemHotwireKit" in magazines player;
_ownerID = cursorTarget getVariable ["ownerPUID","0"];

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

if (!_hasitem) exitWith {
systemChat("You need a hotwire kit in your inventory");
};

dayz_actionInProgress = true;
player removeMagazine "ItemHotwireKit";

if (_isunlockable) then {
if (_open < _SetChanceToFail)  exitWith {
_Message = format ["%1 (%2) IS TRYING TO BREAK INTO A SAFE OR LOCKBOX @ %3  Owner: %4",dayz_playerName,dayz_playerUID,(mapGridPosition getPos player),_ownerID];
["CrackSafe_log",_Message,true] call fnc_log;
dayz_actionInProgress = false;
systemChat("Bad Luck, i could not open it and broke the Hotwire Kit");
};

systemChat("Done! I have opened the vault");
_Message = format ["%1 (%2) HAS BROKEN INTO A SAFE OR LOCKBOX @ %3  Owner: %4",dayz_playerName,dayz_playerUID,(mapGridPosition getPos player),_ownerID];
["CrackSafe_log",_Message,true] call fnc_log;
dayz_combination = _vault getVariable["CharacterID","0"];
_vault spawn player_unlockVault;
dayz_actionInProgress = false;
};

 

 

Cheers, this works great!
21:02:11 "[CRACKSAFE_LOG] SlashnDash (XXXXXXXXXXXXXXXXXX) IS TRYING TO BREAK INTO A SAFE OR LOCKBOX @ 070065  Owner: XXXXXXXXXXXXXXXXXX"
21:02:14 "[CRACKSAFE_LOG] SlashnDash (XXXXXXXXXXXXXXXXXX) IS TRYING TO BREAK INTO A SAFE OR LOCKBOX @ 070065  Owner: XXXXXXXXXXXXXXXXXX"
21:02:16 "[CRACKSAFE_LOG] SlashnDash (XXXXXXXXXXXXXXXXXX) HAS BROKEN INTO A SAFE OR LOCKBOX @ 070065  Owner: XXXXXXXXXXXXXXXXXX"

Link to comment
Share on other sites

  • 3 weeks later...

If anyone is looking for a version like Schwedes that had separate chances for hotwiring lockboxes and safes, I made a version that had that functionality:

Spoiler

/** ORIGINAL Author: SchwEde aka shinySonic **/
/** REWRITED BY juandayz and dedicated for Pillbox :D **/
//Fixes by "a man" and "shawn" tnks guys for the help
//Separate lockbox/safe functionality added by Smithy Jenkins

private ["_vault","_isunlockable", "_isSafe", "_isLockbox", "_openChance", "_safeFailChance", "_lockboxFailChance"];

_vault = _this select 3;

_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked"));

_isSafe = (typeOf _vault) == "VaultStorageLocked";
_isLockbox = (typeOf _vault) == "LockboxStorageLocked";

_openChance= round(random 100);		//Random rounded number out of 100

_safeFailChance = 0;
_lockboxFailChance = 0;

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

if !("ItemHotwireKit" in magazines player) exitwith {    
	_msg = "No Hotwire Kit found in inventory!"; 
	systemChat ("Server: "+str _msg);
};

dayz_actionInProgress = true;
player removeMagazine "ItemHotwireKit";

if (_isunlockable) then {
	if (_isSafe) then {
		if (_openChance < _safeFailChance)  exitWith {
			dayz_actionInProgress = false;
			_msg = "The Hotwire Kit breaks and the vault remains locked."; 
			systemChat ("Server: "+str _msg);
		};
		
		_msg = "The Hotwire Kit disintegrates as the vault unlocks."; 
		systemChat ("Server: "+str _msg);
		dayz_combination = _vault getVariable["CharacterID","0"];
		_vault spawn player_unlockVault;
		dayz_actionInProgress = false;
	} else {
		if (_isLockbox) then {
			if (_openChance < _lockboxFailChance)  exitWith {
				dayz_actionInProgress = false;
				_msg = "The Hotwire Kit breaks and the vault remains locked."; 
				systemChat ("Server: "+str _msg);
			};
			
			_msg = "The Hotwire Kit disintegrates as the vault unlocks.";
			systemChat ("Server: "+str _msg);
			dayz_combination = _vault getVariable["CharacterID","0"];
			_vault spawn player_unlockVault;
			dayz_actionInProgress = false;
		};
	};
};

 

Code may be a little unoptimized but hey, it works :)

Link to comment
Share on other sites

  • 2 months later...

Hey Juan, I added locked base doors to the vaults list/array not sure what to call it, but they don't work, any ideas on how I can get it to work on locked base doors the same way as safes? Here's how I edited the code, just added to it, the safes still work but nothing on the doors

_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked") || ((typeOf _vault) == "CinderWallDoorSmallLocked_DZ") || ((typeOf _vault) == "CinderWallDoorLocked_DZ"));

 

Before using the locked door classnames I tried itemComboLock with no luck

Could I add those classnames to this to make it work? --> _vault = _this select 3;

Link to comment
Share on other sites

35 minutes ago, _Lance_ said:

Hey Juan, I added locked base doors to the vaults list/array not sure what to call it, but they don't work, any ideas on how I can get it to work on locked base doors the same way as safes? Here's how I edited the code, just added to it, the safes still work but nothing on the doors

_isunlockable = (((typeOf _vault) == "VaultStorageLocked") || ((typeOf _vault) == "LockboxStorageLocked") || ((typeOf _vault) == "CinderWallDoorSmallLocked_DZ") || ((typeOf _vault) == "CinderWallDoorLocked_DZ"));

 

Before using the locked door classnames I tried itemComboLock with no luck

Could I add those classnames to this to make it work? --> _vault = _this select 3;

That wont work, doors use a different system to unlock.

Link to comment
Share on other sites

1 hour ago, juandayz said:

Remember a version for doors maded by oldmatechoc.

I thought about adding the doors to the "non-god-mode-base" array but on a full mili server it only takes 3 shots from an RPG to drop doors which is way too easy. I'll do some searching for oldmatechoc at lunch and hopefully I can update anything I find, I'll let you know how it turns out. Thanks Juan!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...