Jump to content

[Release] Schwedes Hotwire Safes/Lockboxes


Recommended Posts

<==================== Schwedes Hotwire Lockboxes and Safes ====================>


What it does?
Gives player a chance to hotwire a Safe/Lockbox and steal everything inside.

WARNING!
For Admins without PP4L, once the safe/lockbox was cracked the player is allowed to pack the safe/lockbox and steal it too!

As allways, do not expect noob friendly tutorials ;P

What you need:
fn_selfactions.sqf
variables.sqf
vault_hotwire.sqf

Step 1

vault_hotwire.sqf

create a file named

vault_hotwire.sqf


with this content

/** Author: SchwEde aka shinySonic **/
private ["_vault","_message","_isSafe","_isLockBox","_chanceSafe","_chanceLockbox"];
_vault = _this select 3;
_chanceSafe = 5; //chance on Safe to succeed in % use only values between 0 - 100
_chanceLockbox = 10; //chance on Lockbox to succeed in % use only values between 0 - 100

player removeMagazine "ItemHotwireKit";

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

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

_failed = false;
DZE_ActionInProgress = true;
if (_isSafe) then {
if ((random 10) >= (_chanceSafe/10)) exitWith {
	_failed = true;
	_message = ["Damn, i did not manage to hotwire this thing","Oh no! The Hotwire Kit was broken","Bad Luck, i could not open it and broke the Hotwire Kit"] call BIS_fnc_selectRandom;
	};
		} else {
		if (_isLockBox) then {
			if ((random 10) >= (_chanceLockbox/10)) exitWith {
				_failed = true;
				_message = ["Damn, i did not manage to hotwire this thing","Oh no! The Hotwire Kit was broken","Bad Luck, i could not open it and broke the Hotwire Kit"] call BIS_fnc_selectRandom;
				};
			} else {
				_failed = true;
				_message = ["Damn, i did not manage to hotwire this thing","Oh no! The Hotwire Kit was broken","Bad Luck, i could not open it and broke the Hotwire Kit"] call BIS_fnc_selectRandom;
			};
		};
if (_failed) exitWith {cutText [_message, "PLAIN DOWN"];DZE_ActionInProgress = false;};
_message = ["I did it! Its should be open now","Got it. Now the vault is open","Done! I have opened the vault"] call BIS_fnc_selectRandom;
cutText [_message, "PLAIN DOWN"];

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

Place it somewhere in your mission folder

Step 2:

fn_selfaction

add this (change the path to this file!)
					if(_hasHotwireKit) then {
						 s_player_hotwirevault = player addaction [("<t color=""#B40404"">" + ("Hotwire Vault") +"</t>"), "Path_To\vault_hotwire.sqf",_cursorTarget, 0, false, true, "", ""];
						};
above
					_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];

After:
{player removeAction _x} count s_player_combi;s_player_combi = [];
		s_player_unlockvault = -1;
add this:
player removeAction s_player_hotwirevault;
		s_player_hotwirevault = -1;
Same for the near bottom:

this:
player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

before (or somewhere else in this section, its up to you)
player removeAction s_player_forceSave;
	s_player_forceSave = -1;
For PP4L Users to prevent stealing the Safe/Lockbox

remove this code
_characterID == dayz_combination || 
above this line
s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""];

Safe and done

Step 3:
variables.sqf

search for
dayz_resetSelfActions = {
and add this to this section
s_player_hotwirevault = -1;
Finish.

Like my work? Spend me a beer or a cheesburger :)
christmas-donate-button-300x125.png
Link to comment
Share on other sites

Should

if ((random 10) >= (_chanceSafe/10)) exitWith {

not be

if ((random 10) <= (_chanceSafe/10)) exitWith {

? And the same for the lockboxes?

Otherwise you're giving the player a 90 or 95% chance that they will break the safe.

 

That is the chance to fail. Read the code again

Link to comment
Share on other sites

That is the chance to fail. Read the code again

 

if ((random 10) >= (_chanceSafe/10)) exitWith {

 

When _chanceSafe/10 = 9.5, the code says for any random float from 9.5-10.0 it will fail. Meaning a float generated from 0-9.4 it will pass. Therefore it has a 94% pass rate. Should be the other way around.

Link to comment
Share on other sites

Should

if ((random 10) >= (_chanceSafe/10)) exitWith {

not be

if ((random 10) <= (_chanceSafe/10)) exitWith {

? And the same for the lockboxes?

Otherwise you're giving the player a 90 or 95% chance that they will break the safe.

 

you are right.

i have tested the original code and i can open every vault.

 

i changed this

_chanceSafe = 95; //chance on Safe to fail in % use only values between 0 - 100
_chanceLockbox = 90; //chance on Lockbox to fail in % use only values between 0 - 100

to this

_chanceSafe = 5; //chance on Safe to fail in % use only values between 0 - 100
_chanceLockbox = 10; //chance on Lockbox to fail in % use only values between 0 - 100

and now i need ~15 attempts to open one safe

Link to comment
Share on other sites

Nice, and again one of the more usefull scripts. Will definitely add this to our server!

 

What do you think of

  • adding a humanity-check which will affect the chance of failure/success.
  • adding the option to open locked doors.
Link to comment
Share on other sites

that's up to you, if you want just do some simple scripting and math and you should be good to go.

For the Open Doors, well for me it's not logical to crack a lock like on the doors with a hotwirekit.

But it's almost the same steps, so go ahead and make it ;)

Link to comment
Share on other sites

  • 8 months later...

Hey man, loving what you made here!

But I did find a bug which is a major issue. When one scrolls and gets the option to "hotwire vault", they can then quickly put the hotwire into their backpack, and the option is still there. This means that safes can be opened without using the hotwire. Essentially, all safes can be opened with 1 hotwire. Could you possibly make a fix for this?

Thanks!

Link to comment
Share on other sites

On 5/28/2015 at 0:27 AM, SchwEde said:

that's up to you, if you want just do some simple scripting and math and you should be good to go.

 

For the Open Doors, well for me it's not logical to crack a lock like on the doors with a hotwirekit.

But it's almost the same steps, so go ahead and make it ;)

you should make it for Door locks players use a Crowbar

To Open Doors players should use a sledge hammer  

For failed attempts remove Tool Item say hint you broke your tool

would be nice to Raid Bases by busting the door lock then the door then with your hotwire kit rob the safe/lockbox

Link to comment
Share on other sites

On ‎1‎-‎2‎-‎2016 at 10:51 AM, Shawn said:

Hey man, loving what you made here!

But I did find a bug which is a major issue. When one scrolls and gets the option to "hotwire vault", they can then quickly put the hotwire into their backpack, and the option is still there. This means that safes can be opened without using the hotwire. Essentially, all safes can be opened with 1 hotwire. Could you possibly make a fix for this?

Thanks!

 

 

Edited by creativv
Shawn put the removeaction on the wrong spot :)
Link to comment
Share on other sites

  • 4 weeks later...

There is a fix for the unlimited hotwire vault glitch if anyone wanted.

/** Author: SchwEde aka shinySonic **/
/** Edited by Shawn **/
private ["_vault","_message","_isSafe","_isLockBox","_chanceSafe","_chanceLockbox","_mags"];
_vault = _this select 3;
_chanceSafe = 5; //chance on Safe to succeed in % use only values between 0 - 100
_chanceLockbox = 10; //chance on Lockbox to succeed in % use only values between 0 - 100
if !("ItemHotwireKit" in magazines player) exitWith {    
	cutText [format["No hotwire in inventory."],"PLAIN DOWN"];
	_failed = true;
	DZE_ActionInProgress = false;
};
player removeMagazine "ItemHotwireKit";

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

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

_failed = false;
DZE_ActionInProgress = true;
if (_isSafe) then {
if ((random 10) >= (_chanceSafe/10)) exitWith {
	_failed = true;
	_message = ["Woops. Yep, I broke it.","Oh no! The Hotwire Kit broke!","Welp, can't get it open and broke it."] call BIS_fnc_selectRandom;
	};
		} else {
		if (_isLockBox) then {
			if ((random 10) >= (_chanceLockbox/10)) exitWith {
				_failed = true;
				_message = ["Woops. Yep, I broke it.","Oh no! The Hotwire Kit broke!","Welp, can't get it open and broke it."] call BIS_fnc_selectRandom;
				};
			} else {
				_failed = true;
				_message = ["Woops. Yep, I broke it.","Oh no! The Hotwire Kit broke!","Welp, can't get it open and broke it."] call BIS_fnc_selectRandom;
			};
		};
if (_failed) exitWith {cutText [_message, "PLAIN DOWN"];DZE_ActionInProgress = false;};
_message = ["I did it! It should be open now.","Got it. Now the vault is open!","Done! I have opened the vault!"] call BIS_fnc_selectRandom;
cutText [_message, "PLAIN DOWN"];

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

 

Link to comment
Share on other sites

11 hours ago, Shawn said:

There is a fix for the unlimited hotwire vault glitch if anyone wanted.


/** Author: SchwEde aka shinySonic **/
/** Edited by Shawn **/
private ["_vault","_message","_isSafe","_isLockBox","_chanceSafe","_chanceLockbox","_mags"];
_vault = _this select 3;
_chanceSafe = 5; //chance on Safe to succeed in % use only values between 0 - 100
_chanceLockbox = 10; //chance on Lockbox to succeed in % use only values between 0 - 100
if !("ItemHotwireKit" in magazines player) exitWith {    
	cutText [format["No hotwire in inventory."],"PLAIN DOWN"];
	_failed = true;
	DZE_ActionInProgress = false;
};
player removeMagazine "ItemHotwireKit";

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

player removeAction s_player_hotwirevault;
s_player_hotwirevault = -1;

_failed = false;
DZE_ActionInProgress = true;
if (_isSafe) then {
if ((random 10) >= (_chanceSafe/10)) exitWith {
	_failed = true;
	_message = ["Woops. Yep, I broke it.","Oh no! The Hotwire Kit broke!","Welp, can't get it open and broke it."] call BIS_fnc_selectRandom;
	};
		} else {
		if (_isLockBox) then {
			if ((random 10) >= (_chanceLockbox/10)) exitWith {
				_failed = true;
				_message = ["Woops. Yep, I broke it.","Oh no! The Hotwire Kit broke!","Welp, can't get it open and broke it."] call BIS_fnc_selectRandom;
				};
			} else {
				_failed = true;
				_message = ["Woops. Yep, I broke it.","Oh no! The Hotwire Kit broke!","Welp, can't get it open and broke it."] call BIS_fnc_selectRandom;
			};
		};
if (_failed) exitWith {cutText [_message, "PLAIN DOWN"];DZE_ActionInProgress = false;};
_message = ["I did it! It should be open now.","Got it. Now the vault is open!","Done! I have opened the vault!"] call BIS_fnc_selectRandom;
cutText [_message, "PLAIN DOWN"];

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

 

Not really needed i think you have a mistake in your fn_selfactions , there is already a check if the player has a _HotwireKit  if not then player removeAction s_player_hotwirevault;

Link to comment
Share on other sites

  • 1 year later...
1 hour ago, Snowbell said:

Hi there, I am unable to locate a hotwire kit at all when in my server, I cant even use infistar to spawn one in. There is also no hotwire kit in the traders. It seems as if my entire server doesnt know about the hotwire kit even though I am running the latest version of Epoch.

ItemHotwireKit

By default you wont find anywhere but on Zombies. (Military, Police, and Pilot Zombies). You must add them to your traders if you wish to buy and sell.

BTW this is the old version of the script for Epoch 1051.

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

×
×
  • Create New...