I need help on a starting point to make a crafting system using blueprint. I have an inventory system made already with a rock and a log as 2 of my objects right now. Can someone please point me in the right direction on how to make it to where I can add those 2 together to make a simple hatchet. I have the hatchet as an item but its not coded yet for my inventory. If someone knows how to make one in C++ that will work as well.
Thanks,
Charles
Well it depends on what kind of crafting system you are looking for.
You could simply create a list of all craftable items and check if the player has the required items in his/her inventory.
If you want to go for a minecraft like one in which you will need to check an area if it is similar than one of the blueprints you defined.
Anyway I am not quite sure what you look/ask for…
Could you be a bit more specific?
Do you already have a visual inventory? What exactly do you understand under “crafting system”? And what kind of crafting system are you looking for?
It sounds to me as if your problem is a lack of detailed requirements.
Once you have a requirement in some amount of detail, you can then tackle each of those requirements to implement them.
For example, you might have the requirement “there needs to be a ‘craft items’ area where I can drag inventory items on the inventory GUI.”
Once you have that requirement, you can implement it.
Then, you might have the requirement “there needs to be a ‘craft item’ button next to the ‘craft items’ area. When pressing this button, if the items match a recipe, a new item is crafted.”
You can then implement this requirement, by looking for the items in the craft items area, comparing to the required items in all recipe blueprints, and if one matches, create an item described by the blueprint and deleting the original items.
Try this, if you need more hand-holding:
- Add two boxes to the side of inventory, call them “the crafting bench.”
- Make it so that the user can drag items into those boxes
- Add a button next to the “crafting bench” with the text “Craft”
- Make it so that, when pressing this button, a blueprint runs that gets the class of each of the items in the crafting bench
- Define a blueprint type called “recipe” which has two variables that are classes called “inputA” and “inputB,” and one variable that’s a class called “generated.”
- Make an array of classes in the button-press blueprint for the “Craft” button. Add instances of the blueprint class for recipes to this array
- When the “Craft” blueprint runs, iterate over the elements in the recipe array. Compare the class of the first item to inputA and the class of the second item to inputB, and if they both match, instantiate an actor of type “generated” and delete the first two items.
If “rock” and “log” have the same class, then use a unique name or tag on each input object to identify “what it is” for the recipe to read instead.
If you have any problems doing any one of these steps, please ask about those specific problems, with screen shots specific to the step you’re trying to take.
Yes I’m looking for a minecraft type crafting system. My inventory system is visual its a 20 slot inventory system that stacks and has 3 hotbars on the HUD. I really understand much on a crafting system.
Also with Jwatte’s answer. you could set the visibility when item is moved from inventory to crafting array. EG-StarWars Old Republic crafting.
Well a minecraft type crafting system requires you to have an area which looks which items are in it and how they are placed.
Then you will have to check a list in which all your recipes are stored and check if there is a match. If so display the item which is created by that match.
Minecraft got one file where all recipes are stored with the pattern and items you need and what item one will get from it.
Is this any help?
If you need more specific stuff we would need to see how your inventory works so far.
In my inventory right now I have it to were I can pick up, drop, move around in the inventory, move to hot bars from inventory, I don’t have them socketed yet to hands. Oh and I don’t have stacking haven’t figure that part out yet. Like I said all I have right now is a rock and log in my inventory, but I have a hatchet that I want to make from those 2 objects. But that’s how my inventory works so far.
any way you can make like a quick blueprint for just one of the objects really just need a visual example and I can possible run with it from there.
thanks for the help btw.
The problem is everything I can show you will result in something you will most certainly not be able to use.
Is your inventory in the HUD? Do you just need a new panel there?
There’s a lot of design choices and so on which majorly influence how you want to set it up.
Basically (though I did not use it yet) you could try to use the spreadsheet import which allows you to import stuff from an external sheet which would make it easier to add crafting recipes later on.
You need some way to identify what is where and check for similar figure and the same material. This can be done with a string simply containing one letter for each spot which is taken and keys for which those letters stand for. Some textures, name or some other kind of placeholder to set the materials.
Then you can check with that string if there is a recipe which looks like this and then check if the materials are correct.
This is obviously just one way to do this and there are some more better ways to do this.
Anyway what I want to say is: I can hardly give you any actual blueprints without having your construct. I don’t have an inventory system lying around and I don’t really want to put several hours into this.