How would I Create an Inventory System with Blueprints?

1 - Put the inventory in a different class (or Blueprint) of its own. Blueprints are technically equivalent to C++ classes in UE4, so the same Object-Oriented design rules apply here as well.

2 - Your array should contain “inventory items”. This will, again, be a new class, which specific items will inherit from.

3 - Hundreds is nowhere near big enough to start considering databases. If you have tens or hundreds of thousands, it might be a different story though.

4 - Create an inventory variable in your player class (that is, a variable of the inventory type you defined in 1). Redirect interactions with objects to that inventory object.

End of the day, what you’re asking here is: “how do I handle this or that object”? The answer to that question has been the subject of much debate in the field of object-oriented computer programming. I would strongly recommend against attempting anything too big with Blueprints if you’re not familiar (at least to some extent) with Object-Oriented programming. I’d recommend you to learn a bit about it first. Even if you don’t want to do that, keep this one rule in mind: your code must represent, as closely as possible, real world objects and their interactions, including their different functionalities.

I’m a complete noob when it comes to programming or game design.

I intend to create an inventory system in the vein of the STALKER series, it will be limited by weight and item size.

From what little I do understand I will need to create an array then add to it and remove items as well then eventually tie it all to a UI. But I want to get the logic down before I get into that.

I guess my questions are:

  • Should my inventory array be in a separate blueprint or in my character blueprint and not in my GameMode? (probably a silly place)
  • Should my array contain just actors?
  • Will I need some sort of database to organise potentially hundreds of items?
  • What is the best way to connect my inventory to my character so when I pick up an item it is added to my array?

Quick question, should my inventory BP be an actor class or is that just Epic’s set up? When creating a BP it asks you for a parent class.

To the best of my understanding, that is “just epic’s setup”. I think it might have something to do with networking, but I’ve never invested much time in multiplayer games, so I wouldn’t know. However, the fact remains that Epic’s guys know how best to use their own engine, so I try to do everything like they do, believing they had a reason for doing it the way they did.

Looking on old inventory apis from UE3 might give you some ideas <-item class <-inventory menager, which is kind of like backpack class

Where should I put the array?

I’m not sure if anyone has linked this yet, but a fellow by the name of Tom Looman has released a two part tutorial on object interaction/basic inventory system. Very much worth the time it takes to walk through it. Hope this helps!