Download

Looking for direction in creating an RPG inventory.

So I’m looking for help in creating an inventory system, I’m not really looking for anyone to do it for me I’d just like someone to point me in the right direction with what kinda things I’d put together to make it. I’ve already made my item system with all of them being children of each other so the needed variables carry over and a system for picking them up. Documentation links and applicable tutorials would be greatly appreciated :slight_smile:

Thanks, leon.

I wrote up a quick outline of my own Inventory code for Unity here: http://mindflock.com/2014/04/how-to-code-an-inventory-system/

If there’s anything specific you want to ask I’m happy to explain. I’ll be making an inventory system for Unreal as soon as a viable UI system shows up or the existing slate stuff gets a bit of documentation.

Just post a reply here and I’ll answer any questions.

This should be helpful, thanks! and yeah, I don’t plan on fully implementing it until we get more information on using slate, I just want to get the base system down for now :slight_smile:

You want to do this completely in blueprint? If you were doing this in C++ I could give you some advice, as I am currently doing an inventory system.

Yes, I’d MUCH prefer to do it in blueprint. I can code and know more about it compared to most non-programmers but compared to actual programmers I suck real bad :stuck_out_tongue: I’ve been getting much better results with blueprint than I did when I was trying to do it in Unity in C#.

So I’ve done a fair bit but I’ve hit a snag and need some help! I’ll post what I have so far for critique and in case anyone needs help doing the same :slight_smile: If you don’t really care then just jump to the very last paragraph.

This is how I’m targeting the item and also what I use to interact with doors and anything else I want the player to be able to interact with. It’s along the trace channel “visibility” so it collides with anything seeable by the player and sets whatever it sees to be the “targetted actor” variable. The branch is required to clear the variable when you’re not actually looking at anything to prevent weird behaviour. The targetted actor is then used for an interface message so whatever is being targetted knows. As you can see in the top right if you press the Interact button (mapped to F) it sends an Interact event to the targetted actor.

So that covers interacting with items but what about the actual items? This bit is somewhat basic. Basically I made a StaticMeshActor to be the root of all of the items and inside of that I set up the things that are going to be across all of the items including a cost variable, the targetting interface and all of the things required for picking them up (I’ll explain it at the end because I’m doing something wrong with it and it’s causing my editor to crash the next time I start up). Then the different item types/categories are created as children of that with the variables needed for the different types and then the individual items off of them again. This is way changing something up stream effects absolutely every item.
16af3faddcea266c386c21a2ad9f5edb69b10ae3.png

Next is storing the actual item which is the main point of an inventory. To do this I created a variable in myCharacter called “Container”. It’s an array set to hold items of type “ItemRoot_C” so from how I understand it that makes it only able to hold ItemRoot and all of its children that are inheriting from it (the rest of the items). The same thing can be repeated for containers/chests.
c42dbad7b215aae284ad096600399a1b15e8ae0f.png

So at this point I have items that I can interact with and store (but not actually pick up). The problem I’m having is with the item pickup event on the items. I’ve built it into the ItemRoot and it works fine but next time I start up the editor it full on crashes and I have to delete all of the items from the project files just to launch it again :frowning: It successfully adds the item to the players inventory so I really don’t understand why it’s causing so much trouble :frowning: Please help! :slight_smile:


9f5a18fbf0ce9f3f170ffea46aa6bd91a1295ae5.png