 Hey, what's up, everybody? I want to make a quick video showing my new crafting system that I'm building for my game. I have started over again with Unreal Engine 5, and I'm kind of starting from the ground up, building the basics out here. So I've decided to add a crafting system to my game, and this is how it works. I've kind of come to this code from a combination of looking at different tutorials online as well as kind of figuring out my own way from my normal computer programming skills. So anyway, this is a combination of Blueprints and C++. And so let me just get started and I'll show you how this works. So I've got my character. This is my fabricator, my crafting machine. And basically, the fabricator has the list of everything that it can fabricate, that it can craft. And there are items in the game, and an item can either be used to craft something or it can be craftable. And so let's see. These are green bushes. Let's just pick some leaves here. Let's get three of these. I'll go over to this. Even though that says red moss, I assure you. It is red, not green. So we'll go over to the fabricator. And so these are the two items that I have loaded into it. And I'll show in just a minute how I'm loading this in. And you can see here that I've got three green leaves. And so I can make this medicine. I've got three out of two green leaves and one red plant or red moss that's still working on these labels here. And so I can make either one of these right now. And so let's see. I'll make the medicine, fabricating it, adding it to inventory. I should show a little message here. It's been added to my character's inventory. So now I've used all three of my green leaves. And so I can't make this one anymore. I only have part of the ingredients. And so if I close this and go back, let's see here, I think I've got a couple more. I can grab that one and let's grab this one. And so now I can make this one because I have two more green leaves fabricating, adding the inventory, show a message. Great. And so if I detach from the character, I don't have an inventory screen just yet. So if I switch over to the character and let's see where is, here we go. So here's the inventory. And you can see that I've got one medicine item and one healing compound item, the two things I crafted. And I have none of the other things. They're in my inventory because I have had them at one point in time. And so there is still a map entry for them, but I have zero elements. And so my next step on this will be to have an inventory screen for the players so that I can see and use these things. But for now I can craft them. And so here's how this works. So all of the items, let's see, let's start with this leaf item here. These are pretty basic and they all come from this item base parent, which basically comes from this item base that I've created over in the C++ side of the project. And this has a couple of enumerators into like the rarity, the item type that it is. I'm still working on how these are actually going to fit in to my game. These make it changed, but this is the basics of how this can work. And so these show up in the editor so that I can change the information about them, the rarity or the item type or whatever. So these show up here from what I have created here in this class. And this just has some basic stuff that I'm holding onto here. The mesh, is it craftable? What the name is, the description, thumbnail, all of these things that I wanted to hold onto for this particular item. And then I just created a blueprint from that class. And so I inherit from that each time with this. Probably something I'll change maybe later today is I've currently got it to where you can mark an item as craftable. I probably will just make a second base class that is a craftable item that inherits from the item base. That way I just know that the base class of that is gonna be craftable. And I don't have to check this flag. That'll help me do this other thing, which is to, I use a basic struct and data table to keep track of the things that can be crafted for one of the fabricators or the crafting devices. The outpost in this game will probably have two or three of these and each one may be able to do different types of crafting. And so by splitting this out into a data table, I can easily say, here are the items that are able to be crafted by this device. And so basically I've got a couple of rows here and these are the two things that we're showing a few minutes ago in the crafting device. And that's just a basic structure right now. If I were to change and make a craftable item base, I would just change this to be that. And then it would only allow me to add new things that were inheriting from that base class. Sorry, if that's a little advanced for some people here, it's kind of come second nature to me as a standard object oriented programmer, all of that inherent stuff. So there's tons of videos. If you have any questions, make sure you ask them in the comments. I'll try to answer it or point you to other tutorials on YouTube that can teach you how to understand those types of things. But it's really important when you're making larger things to inherit from base classes, I even do the same thing with my buttons. This one in particular does not, but a different one, I have a base button so that any button in a menu that I use, I can change it in one place and it will change all of the buttons. This however is just the template that I'm using for the craftable buttons for the crafting widget. This was, you know, this is the UI that shows up whenever you go to one of the fabricators. This is just a standard, like a list view I believe it is and you know, I have these craftable items. So it shows one of these for every item that's in that data table. And let's see, I'll just show that. So here is the event graph flow for what happens when you interact with one of these devices. It will fill the craftable items from the data table. So this basically takes the data table that I am giving it, assigning it whenever I'm putting the blueprint into the world. And first of all, I'm clearing it and then I am getting all the road names. You do a four each loop on all the road names so that you can actually get the road. This is really weird the way this works but you know, it's just the way the blueprints work apparently. And then from there you want to break that apart so that you can get to the actual item of the row and that I'm adding unique to craftable items. So I'm pulling in from the data table. I'm looping through everything. I'm sticking it all in. And then when I'm finished with it, I'm returning back to the main execution flow here. And so then my craftable items has been populated with all of the things from the data table. And so then I create that widget. I give it all the craftable items. This should be over here, right? Yeah. And so I'm telling it, here's all the craftable items that you can use. And this is just where it loops through all of those. It checks to see how many the player already has in their inventory. And it creates those messages that I was showing on the screen at the beginning of this video. And so that's basically how all of this works. You can pause the video and look at my blueprints here if you like. If there is interest, let me know in the comments and maybe I will put copies of these blueprints out on the blueprint me site or whatever that is where you can map out blueprints. Let me know if you're interested in that type of thing. And let me just show all of this again. This is what happens when you click on the button to craft something. It's going through, it's finding the item. This is an interesting piece of using these base classes. Since we're storing class references and not object references, we have to get the class defaults for what's being used. And so these are all of those items that I had defined in the base class file over here in C++. So all of these things show up here on the class defaults and these are the actual settings for the item itself that's in the world. So in this case, I'm really only using the item name and the required components for this. And this is where I'm looping through, making sure that they can craft the item, that they have all of the things, actually craft the item, put it in their inventory and display those messages. This was another interesting thing that took me a second to figure out. But I'm using a widget switcher here for the different states. And so the base state of this is the button itself. And then there's a fabricating item overlay and then there is the adding to inventory. And so I just have a simple delay between changing these and then it rolls back to the base. And that just kind of gives some UX for the user so that the player so that they can see, you know, this is actually working and being added to your inventory along with the message. So that's basically how this works. So if you're interested in more details, let me know and I can do more of a breakdown. I'm probably gonna be improving this a little bit more. So I may do an update video with some of my improvements, you know, adding the new base class for the craftable item. And then I'll certainly do another overview once I pull this actually into the Outpost Meshes itself so that you can see how it's going to look in the game. But I'm pretty excited about the way that this is working out. So subscribe to the channel if you like this type of stuff. Got a lot more Unreal Engine 5 tutorial type things like this coming and breakdowns of how I'm building this game. So thanks for watching.