Jump to content

Craft Walls and Floors Directly from Packs


js2k6

Recommended Posts

Hi everyone,

This is just a really basic script i made for the guys on my server who were always at the wholesalers buying lumber and ply packs. Just to save them a little time.
i made this to work with extra right click options Which can be found here
 

What the script does:
This allows people to right click on a plywood or lumber pack. and convert the items directly into a 1/3 wall, full wall, 1/2, 1/4 or full floor/ceiling

without the need to unpack the item
then craft 3 x 1/3 walls, then craft them into a full wall etc

Cons: Can only craft 1 item at a time (however this is still much faster than the alternative)

 

Step 1: Add the following code to extra_rc.hpp  beneath

class ExtraRc {

class PartPlankPack {
		class thirdwall {
			text = "Craft 1/3 Wood Wall";
			script = "[""thirdwall""] execVM ""custom\fn_craftable.sqf"";";
		};
		class wall {
			text = "Craft Wood Wall";
			script = "[""wall""] execVM ""custom\fn_craftable.sqf"";";
		};
		class quartfloor {
			text = "Craft 1/4 Wood Floor";
			script = "[""quartfloor""] execVM ""custom\fn_craftable.sqf"";";
		};
		class halffloor {
			text = "Craft 1/2 Wood Floor";
			script = "[""halffloor""] execVM ""custom\fn_craftable.sqf"";";
		};
		class floor {
			text = "Craft Wood Floor";
			script = "[""floor""] execVM ""custom\fn_craftable.sqf"";";
		};
	};
	
	class PartPlywoodPack {
		class thirdwall {
			text = "Craft 1/3 Wood Wall";
			script = "[""thirdwall""] execVM ""custom\fn_craftable.sqf"";";
		};
		class wall {
			text = "Craft Wood Wall";
			script = "[""wall""] execVM ""custom\fn_craftable.sqf"";";
		};
		class quartfloor {
			text = "Craft 1/4 Wood Floor";
			script = "[""quartfloor""] execVM ""custom\fn_craftable.sqf"";";
		};
		class halffloor {
			text = "Craft 1/2 Wood Floor";
			script = "[""halffloor""] execVM ""custom\fn_craftable.sqf"";";
		};
		class floor {
			text = "Craft Wood Floor";
			script = "[""floor""] execVM ""custom\fn_craftable.sqf"";";
		};
	};

 

 

Step 2:

Create a file called fn_craftable.sqf in a folder called custom in your mission.pbo

/*
	File : fn_craftable.sqf
	Desc: Craft walls and floors directly from lumber / ply packs
	Auth: JakeHekesFists[DMD]
*/
private["_toolBox","_crowBar","_option"];

_option = _this select 0;
_toolBox =		"ItemToolbox" in items player;
_crowBar =		"ItemCrowbar" in items player;

_dmdLumber = {_x == "PartPlankPack"} count magazines player;
_dmdPlywood = {_x == "PartPlywoodPack"} count magazines player;
 
if (!_toolBox) exitWith {cutText [format["You need a toolbox to craft"], "PLAIN DOWN"];};
if (!_crowBar) exitWith {cutText [format["You need a crowbar to craft"], "PLAIN DOWN"];};

if (dayz_combat == 1) exitWith {cutText [format["you cannot craft while you are in combat!"], "PLAIN DOWN"];};

switch (_option) do 
	{
		case "thirdwall": 
		{ 
			if ((_dmdLumber >= 1) && (_dmdPlywood >= 1)) then 
				{
					player playActionNow "Medic";
					r_interrupt = false;
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlywoodPack";
					_dis=10;
					_sfx = "repair";
					[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
					[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
				   	sleep 6;				   
					player addMagazine "ItemWoodWallThird";
					cutText [format["You have crafted a 1/3 Wood Wall."], "PLAIN DOWN"];				   
					r_interrupt = false;
					player switchMove "";
					player playActionNow "stop";
				} 
				else
				{
					cutText [format["You need 1 Lumber Pack and 1 Plywood Pack to craft a 1/3 Wood Wall"], "PLAIN DOWN"];
				};
		};
		case "wall": 
		{
			if ((_dmdLumber >= 3) && (_dmdPlywood >= 3)) then 
				{
					player playActionNow "Medic";
					r_interrupt = false;
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlywoodPack";
					player removeMagazine "PartPlywoodPack";
					player removeMagazine "PartPlywoodPack";
					_dis=10;
					_sfx = "repair";
					[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
					[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
				   	sleep 6;				   
					player addMagazine "ItemWoodWall";
					cutText [format["You have crafted a Wood Wall."], "PLAIN DOWN"];				   
					r_interrupt = false;
					player switchMove "";
					player playActionNow "stop";
				} 
				else
				{
					cutText [format["You need 3 Lumber Pack and 3 Plywood Pack to craft a Wood Wall"], "PLAIN DOWN"];
				};
		};
		case "quartfloor": 
		{
			if ((_dmdLumber >= 1) && (_dmdPlywood >= 1)) then 
				{
					player playActionNow "Medic";
					r_interrupt = false;
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlywoodPack";
					_dis=10;
					_sfx = "repair";
					[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
					[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
				   	sleep 6;				   
					player addMagazine "ItemWoodFloorQuarter";
					cutText [format["You have crafted a 1/4 Wood Floor."], "PLAIN DOWN"];				   
					r_interrupt = false;
					player switchMove "";
					player playActionNow "stop";
				} 
				else
				{
					cutText [format["You need 1 Lumber Pack and 1 Plywood Pack to craft a 1/4 Wood Floor"], "PLAIN DOWN"];
				};
		};
		case "halffloor": 
		{
			if ((_dmdLumber >= 2) && (_dmdPlywood >= 2)) then 
				{
					player playActionNow "Medic";
					r_interrupt = false;
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlywoodPack";
					player removeMagazine "PartPlywoodPack";
					_dis=10;
					_sfx = "repair";
					[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
					[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
				   	sleep 6;				   
					player addMagazine "ItemWoodFloorHalf";
					cutText [format["You have crafted a 1/2 Wood Floor."], "PLAIN DOWN"];				   
					r_interrupt = false;
					player switchMove "";
					player playActionNow "stop";
				} 
				else
				{
					cutText [format["You need 2 Lumber Pack and 2 Plywood Pack to craft a 1/2 Wood Floor"], "PLAIN DOWN"];
				};
		};
		case "floor": 
		{
			if ((_dmdLumber >= 4) && (_dmdPlywood >= 4)) then 
				{
					player playActionNow "Medic";
					r_interrupt = false;
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlankPack";
					player removeMagazine "PartPlywoodPack";
					player removeMagazine "PartPlywoodPack";
					player removeMagazine "PartPlywoodPack";
					player removeMagazine "PartPlywoodPack";
					_dis=10;
					_sfx = "repair";
					[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
					[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
				   	sleep 6;				   
					player addMagazine "ItemWoodFloor";
					cutText [format["You have crafted a Wood Floor."], "PLAIN DOWN"];				   
					r_interrupt = false;
					player switchMove "";
					player playActionNow "stop";
				} 
				else
				{
					cutText [format["You need 4 Lumber Pack and 4 Plywood Pack to craft a Wood Floor/Ceiling"], "PLAIN DOWN"];
				};
		};
		case default {hint "Error! nothing selected!!!"};
	};

 

Originally there was a distance requirement, which required a person to be x meters from a craft table which i removed on request. i dont have the original file still however

Link to comment
Share on other sites

  • 5 months later...

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