Crafting System

Are
you runnning the blur anti-hax or another anti-hax maybe? You need to add the allowed action override along with the repair s_player_repairActions as mentioned in a previous post.


If thats not the case, please check that you have the proper directory structure and files linked together.

Not running any anti hax.

I got it working, I made it so it only shows industrial menu, cause I only want vehicle parts. When crafting an item, or attempting to, afterwards, the crafting menu disappears, and no longer shows until a relog. How to fix this?
 
Not running any anti hax.

I got it working, I made it so it only shows industrial menu, cause I only want vehicle parts. When crafting an item, or attempting to, afterwards, the crafting menu disappears, and no longer shows until a relog. How to fix this?


You probably need to add this:
player removeAction s_player_smeltItems;
s_player_smeltItems = -1;

near the bottom of of the fn_selfActions, (You will see a large list of different varations of variables following this pattern, add it in there.).

 
Heres a question that came up from my server. Most of my players have no experience with Scripting so they have no idea what PartGeneric is. Is it possible to change the text when it shows what parts they need to show a custom text, Scrap Metal instead of the class name?


Yup, Probably the easiest way to do this is to just rename the part for the output message of required parts. This way you dont need to edit all of the menus and what not.

In the oven.sqf, find this:
// the players gear does not match
_neededString = [];
{
_itemClass3 = _x select 1;
_itemQty3 = _x select 2;
_inUserInv3 = {_x == _itemClass3} count magazines player;
_neededString set [count _neededString, format["%1/%2 %3",_inUserInv3,_itemQty3,_itemClass3]];

} forEach _neededItems;

So this loop populates the _neededString array, in the loop instance that the itemClass3 = PartGeneric, then we just rename it to something else like "ScrapMetal", that way, only the output string of required parts will show ScrapMetal instead of PartGeneric.

You can make the changes as follows:

// the players gear does not match
_neededString = [];
{
_itemClass3 = _x select 1;
_itemQty3 = _x select 2;
_inUserInv3 = {_x == _itemClass3} count magazines player;

if (_itemClass3 == "PartGeneric") then {
_itemClass3 = "ScrapMetal";
};

_neededString set [count _neededString, format["%1/%2 %3",_inUserInv3,_itemQty3,_itemClass3]];

} forEach _neededItems;
 
You probably need to add this:
player removeAction s_player_smeltItems;
s_player_smeltItems = -1;
near the bottom of of the fn_selfActions, (You will see a large list of different varations of variables following this pattern, add it in there.).

It's already in there.

Code:
    player removeAction s_player_followdog;
    s_player_followdog = -1;
    player removeAction s_player_smeltItems;
    s_player_smeltItems = -1;
 
Sure, its a bit ugly, but it will work.. I say ugly because you'll have to make a new block for each restriction you want to have.

Lets say in order to create a wire kit, you must have a tool box.

Within the oven.sqf
just under this part:
// get all the parameters
_parameters = _this select 3;
_makeItem = _parameters select 0;
_neededItems = _parameters select 1;
_makeItemType = _makeItem select 0;
_makeItemName = _makeItem select 1;
_makeItemClass = _makeItem select 2;
_makeItemQty = _makeItem select 3;

you can add something like this:
if (_makeItemClass == "ItemWire") then {
// check to see if the player has a toolbox, otherwise, exit with message.
_hasToolbox = "ItemToolbox" in items player;
if (!(_hasToolbox)) exitWith {
disableUserInput false;
cutText [format ["You must have a Toolbox to craft a Wire Kit."], "PLAIN DOWN",1];
};
};
 
It's already in there.

Code:
    player removeAction s_player_followdog;
    s_player_followdog = -1;
    player removeAction s_player_smeltItems;
    s_player_smeltItems = -1;


Alright!, so.... just thinking out laud.

You're able to open the Menu, so I can assume that the variable
crafting_menu_open = false; was indeed set somewhere...

The requirements for the Crafting Menu to open require you to look into a fire and be within a close range of that fire afterwards.

You can access the categories....

And craft....

Then you you cannot open the menu again?

If the above is correct, then the only think of not letting you open the menu again afterwards is the
crafting_menu_open variable and how it changes over time.

So once you initially open the menu, craftmenu.sqf, the variable is now set to true (around line 5).
from there, you open some category,

Each menu and category also have the restriction: _restriction = "count ((position player) nearObjects ['Land_fire', 10]) > 0";

So you need to be near a fire to use any of the menus.

The categories dont modify the crafting_menu_open variable, but if you choose to close, closemenu.sqf, that will set that variable back.

And lastly, once you craft something, oven.sqf,
_nil = execVM "crafting\closemenu.sqf";
That line there near the top runs the closemenu.sqf in order to change the crafting_menu_open back to false.

I'm going to guess there might be a problem with the crafting\closemenu.sqf directory link within the oven.sqf maybe?
 
It isn't possible to dismount/mount sight from/on weapons right?

It is, check the weapon crafting of an M24 to an M24 Desert,
you can do something similar, say (Assume you have toilet paper on your server) you can take an M9, take a trash tin can, take 4 or 6 toilet paper, and convert that into an M9SD.

Shove the toilet paper into the can, shove the gun into the can.. LOL,.. you can do similar things for sights and what not. BAsically its just a weapon conversion and it'll take items required.
 
you can add something like this:
if (_makeItemClass == "ItemWire") then {
// check to see if the player has a toolbox, otherwise, exit with message.
_hasToolbox = "ItemToolbox" in items player;
if (!(_hasToolbox)) exitWith {
disableUserInput false;
cutText [format ["You must have a Toolbox to craft a Wire Kit."], "PLAIN DOWN",1];
};
};


Can I do this:

if (_makeItemClass == "ItemWire") then {
if (_makeItemClass == "ItemHatchet") then {
if (_makeItemClass == "ItemTankTrap") then {
// check to see if the player has a toolbox, otherwise, exit with message.

etc, with a "makeItemClass" for each item that I want to require a toolbox for?
 
I added the ability to make a crowbar but after I crafted one, it didn't show up in my inventory. I added this line to survival.sqf:

manatee_craft_menu_sur set [count manatee_craft_menu_sur, player addaction [("<t color=""#FFC726"">" + (" Crowbar") +"</t>"),"crafting\oven.sqf",[[0,"Crowbar","MeleeCrowbar",1],[[0,"PartGeneric",3]]],94,false,false,"",_restriction]];

After it was done crafting, I checked my inventory, but no crowbar. Did I do something wrong? The only other item I tried crafting was scrap metal and that worked fine.

*EDIT* Apparently I have the wrong name for the Crowbar. It must not be MeleeCrowbar. anyone know what is it?

Also, how could I make it so fire is only required for certain items? It seems silly to require a fire to make a bandage. I'm sure there's other things I'd like to craft without requiring fire.
 
Instead of MeleeCrowbar, use ItemCrowbar, that puts it into the toolbelt.

From your previous post:
if (_makeItemClass == "ItemWire") then {
if (_makeItemClass == "ItemHatchet") then {
if (_makeItemClass == "ItemTankTrap") then {
// check to see if the player has a toolbox, otherwise, exit with message.

That wont work, but you can do it this way:
_itemsNeedToolbox = ["ItemWire","ItemHatchet","ItemTankTrap"];
if (_makeItemClass in _itemsNeedToolbox) then {
// check to see if the player has a toolbox....

So you create an array of itemsClasses that you want to require the toolbox,
Then you just check if the _makeItemClass is inside that array of items.
 
Instead of MeleeCrowbar, use ItemCrowbar, that puts it into the toolbelt.

From your previous post:
if (_makeItemClass == "ItemWire") then {
if (_makeItemClass == "ItemHatchet") then {
if (_makeItemClass == "ItemTankTrap") then {
// check to see if the player has a toolbox, otherwise, exit with message.

That wont work, but you can do it this way:
_itemsNeedToolbox = ["ItemWire","ItemHatchet","ItemTankTrap"];
if (_makeItemClass in _itemsNeedToolbox) then {
// check to see if the player has a toolbox....

So you create an array of itemsClasses that you want to require the toolbox,
Then you just check if the _makeItemClass is inside that array of items.


Thank you! Fantastic script BTW. I've got so many ideas for this. Any idea about my other question, regarding the fire?
 
I changed the crowbar to "ItemCrowbar" and it still doesn't show up in my inventory:

manatee_craft_menu_sur set [count manatee_craft_menu_sur, player addaction [("<t color=""#FFC726"">" + (" Crowbar") +"</t>"),"crafting\oven.sqf",[[0,"Crowbar","ItemCrowbar",1],[[0,"PartGeneric",3]]],94,false,false,"",_restriction]];

Also, I dropped my toolbox but was still able to "create" a Crowbar (which, as I said, failed to appear in my inventory). Here's what I put in the oven.sqf:

_itemsNeedToolbox = ["ItemWire","ItemHatchet","ItemTankTrap","BoltSteel","PartGeneric","PartGlass","ItemJerrycanEmpty","ItemHatchet","ItemTent","ItemCrowbar"];
if (_makeItemClass in _itemsNeedToolbox) then {
// check to see if the player has a toolbox, otherwise, exit with message.
_hasToolbox = "ItemToolbox" in items player;
if (!(_hasToolbox)) exitWith {
disableUserInput false;
cutText [format ["You must have a Toolbox to craft that item."], "PLAIN DOWN",1];
};
};
 
_hasToolbox = "ItemToolbox" in items player;

Try changing this to

_hasToolbox = "ItemToolbox" in weapons player;

As for the crowbar, I'm not too sure - since I know some maps are a little bit funky with the crowbar.. They have the Melee version that you can pick up, but not put it into the toolbelt, so no ItemCrowbar exists.
 
_hasToolbox = "ItemToolbox" in items player;

Try changing this to

_hasToolbox = "ItemToolbox" in weapons player;

As for the crowbar, I'm not too sure - since I know some maps are a little bit funky with the crowbar.. They have the Melee version that you can pick up, but not put it into the toolbelt, so no ItemCrowbar exists.


Still not working. Dropped my toolbox, went to the fire and was able to craft a Steel Bolt. Thanks for the replies. It's nice that you support people modifying your work. :)
 
mm, the reason your crowbar isn't coming into your inventory, ItemCrowbar is a weapon, not a magazine :p so you need to change the 0 to a 1 in the array part.
[1,"Crowbar","ItemCrowbar",1]

As for requiring a toolbox, That should have worked......
Unless the if statement is wrong.

_itemsNeedToolbox = ["ItemWire","ItemHatchet" ...];
if (_makeItemClass in _itemsNeedToolbox) then {
// check to see if the player has a toolbox, otherwise, exit with message.
_hasToolbox = "ItemToolbox" in items player; // this should be correct.. so error is possibly below.
if (!(_hasToolbox)) exitWith {
disableUserInput false;
cutText [format ["You must have a Toolbox to craft that item."], "PLAIN DOWN",1];
};
};

Try it without the extra () arond _hasToolBox

_itemsNeedToolbox = ["ItemWire","ItemHatchet" ...];
if (_makeItemClass in _itemsNeedToolbox) then {
// check to see if the player has a toolbox, otherwise, exit with message.
_hasToolbox = "ItemToolbox" in items player;
if (!_hasToolbox) exitWith {
disableUserInput false;
cutText [format ["You must have a Toolbox to craft that item."], "PLAIN DOWN",1];
};
};

not really sure why that wouldn't work..

maybe you can also try
if (_hasToolbox == false) exitWith
 
Back
Top