I have base destruction off on my server to limit base griefing slightly. However, I would still like there to be a less destructive method of breaking into another players base. So, I have been working on a "break in" script since last night. The concept of the script is to require a player to have a toolbox, crowbar and Sledge Hammer (in hands) to attempt to break in to a door. There is a 10% chance to break into cinder, a 20% chance to break into wood and a 20% chance to break (delete) each tool required. I, at one point, had the tool check in the beginning working perfectly. However, the rest of the script was not running properly. I edited it a bit and got the rest of the script working and then the tool check in the beginning stopped, haha. I am so tired at this point that the code is just blending together. I could really use a few more sets of eyes on this to steer me in the right direction. Thanks in advance.
private ["_tools","_crowbar","_toolbox","_sledge","_cinderChance","_woodChance","_toolBreakChance","_cursor","_typeCursor","_cinder"];
_tools = weapons player;
_crowbar = "ItemCrowbar";
_toolbox = "ItemToolbox";
_sledge = "MeleeSledge";
_cinderChance = 10;
_woodChance = 5;
_toolBreakChance = 5;
_cursor = cursorTarget;
_typeCursor = typeOf _cursor;
_cinder = ["CinderWallDoorLocked_DZ","CinderWallDoorSmallLocked_DZ"];
{
if !(_x in _tools) exitWith {
hint "You are missing one or more items required to break in. You must have a toolbox, crowbar and sledge hammer.";
};
} forEach [_crowbar, _toolbox, _sledge];
if (_typeCursor in _cinder) then {
if (random(_cinderChance) < 1) then {
_cursor lock false;
hint "You have broken in.";
{
_cursor animate [_x,1];
} forEach ["Open_hinge","Open_latch"];
} else {
hint "You have failed to break in.";
{
if (random(_toolBreakChance) < 1) then {
player removeWeapon _x;
};
} forEach [_crowbar, _toolbox, _sledge];
sleep 1;
{
if !(_x in _tools) then {
hint format["You have broken your %1.",_x];
sleep 2;
};
} forEach [_crowbar, _toolbox, _sledge];
};
} else {
if (random(_woodChance) < 1) then {
_cursor lock false;
hint "You have broken in.";
{
_cursor animate [_x,1];
} forEach ["Open_hinge","Open_latch"];
} else {
{
if (random(_toolBreakChance) < 1) then {
player removeWeapon _x;
};
} forEach [_crowbar, _toolbox, _sledge];
sleep 1;
{
if !(_x in _tools) then {
hint format["You have broken your %1.",_x];
sleep 2;
};
} forEach [_crowbar, _toolbox, _sledge];
};
}:
Question
FreakingFred
I have base destruction off on my server to limit base griefing slightly. However, I would still like there to be a less destructive method of breaking into another players base. So, I have been working on a "break in" script since last night. The concept of the script is to require a player to have a toolbox, crowbar and Sledge Hammer (in hands) to attempt to break in to a door. There is a 10% chance to break into cinder, a 20% chance to break into wood and a 20% chance to break (delete) each tool required. I, at one point, had the tool check in the beginning working perfectly. However, the rest of the script was not running properly. I edited it a bit and got the rest of the script working and then the tool check in the beginning stopped, haha. I am so tired at this point that the code is just blending together. I could really use a few more sets of eyes on this to steer me in the right direction. Thanks in advance.
Link to comment
Share on other sites
20 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now