Inventory: Item(s) not appearing in player inventory

If you’re using “Add Item” to add items to the list, try using “Set List Items”, which takes the item array directly, so it should keep things from repeating.

Can you be specific? By that I mean is there a node called “set items list” or do you mean set array elem? If so, what would be the best way to use that?

There is a screenshot there where when you are creating the slots, your did not connect up the Index for the player inventory array and instead left it at 0. So when it creates the slots, for however many inventory slots you have, you are going through a loop and creating the item that is at index 0 over and over.

okay; Is it this one you’re referring to?

I mean “Set List Items”. Here’s an example:


example

So you call it whenever you make a change to the item array.

Thought that was intentional, but maybe not.

Yeah that last one was meant for someone else, sorry about that.

Okay I will do that.

Also, so then does this mean everything else is fine/ doesn’t need fixing? Because I also want to stack similar items and organize them based on Item type.

Okay I’m lost. Nothing I have seems to connect with it. What exactly do I use with it?

This is the image I was talking about:

2 Likes

It just takes an array of objects (any object or asset can go in it). The object is what the list item represents. In your case, your object array would contain all your inventory items, then the list item gets the information from that object. For instance, in my example, I just use assets, and the list item gets the name of the asset and displays it in the list. This is what I was saying about storing the data with the item.

Though, this is using the “List View” widget. Are you using that, or are you using something else?

I am using a vertical box to store the slots the items appear in.

I think you’ll want to use the list view widget instead. It supports scrolling whereas the vertical box does not; the text goes off the screen when the list is long. You also have to manage the children widgets yourself, whereas the list view you don’t.

The add won’t let me add anything. It says object reference but I don’t have anything for that. Just widgets, and a base item but that
didn’t work either.

the items information don’t show:

This one is from the in game menu that houses the inventory list:
If I replace the add child to vertical box with the add item, I get the same result as before:

Objects are any asset or actor (they’re basically everything), so you can put anything in there. The objects you put in the list view are what the list item/entry will represent. So your array just needs to be the objects (inventory items) themselves, no widgets or any extra stuff. The list view then takes care of all the widget stuff for you. You give it an “entry widget” (which is just the widget you want to use in the list), and it adds those automatically to the list. You can then access the object from the entry widget so you can show all the information in the list.

For example, in the entry widget in my example, this is all I do:


You can access any variable from the object, so it makes it really simple. Also, this and the last code I showed is literally all the code I used for my example; there’s nothing else, so it’s really simple and much simpler than your current setup.

Okay. Where exactly do I put this setup? And in the set list items, what exactly is the set list items target and in list items? I know you explained it already, I just have different variables so I’m trying to figure out what my equivalent of your exampled variables would be.

In the entry widget. To get that event, you need to add the interface “UserObjectListEntry” to the entry widget.
image
From there, you treat it like any other widget. To get information on the object, you use that event and read it from the object directly; you can cast it to the right class, too.

The target is a ListView widget and the items are just objects, so it can be anything; in my example, I used the assets themselves.
image

I admit I’m slipping. I was going over the notes you gave me earlier and realized You earlier said:

IF.

Looking back at my setup I realized there is no add item.

So now I feel like giving up because I assumed I was using add item somewhere but wasn’t.

Also I am not sure if this setup goes in the inventory widget that has the list view, or the entry widget?:

This is what I used for my entry widget:


Basically placed the inventory slot in add wanted to get the information of the item from the slot, like so:

That goes in the inventory widget that has the list view.

Also, in your second picture, you have the wrong interface. It’s supposed to be “UserObjectListEntry”, then you get the object from the “EventOnListItemObjectSet” node.


Honestly, I think at this point, you have too much mess to work with.

I would suggest just starting over. Trust me, it’s not as bad as it sounds (once again, I do it all the time). I would first try doing the tutorial again; I haven’t watched it, but I think you may have messed up somewhere when making it, so just try it again (it’s a big tutorial, so it’s understandable). Though, skimming through the first video, and there’s a lot of things that are not good or are overcomplicated. The only reason I’m suggesting you do it again is because it’s closest to what you’re trying to make.

While I do think listview is easier than what you’re doing from the tutorial, it only addresses the UI, which is only one part of the whole inventory system. So it may not solve whatever is causing your problem.

1 Like

Hello has anyone solved this? Im following the same channels tutorials and am having the same issue, the item picked up doesn’t appear in the inventory!

Link to tutorial series

I worked myself through Ryans Tutorials in the past Weeks.

I´ve done the Inventory tutorial (for UE4) around 4 Times, to understand the whole basics…
But they need much more optimization, than you expected when starting the Playlist.

  1. NEVER EVERY, Split a Struct… I´ve done it like Ryan in the first few trys… But changed everything after gathering enough knowledge, to use BREAK only.
    The Reason is the behaviour of Structs, to break the whole splitting code of Blueprints, whenever you change a Variable / Add a new variable / Remove a Variable or Move a Variable inside the Struct.
    Breaking a Struct helps a lot here.

  2. Get rid of nearly everything in the Slot Struct. You´ll always need the Item Class Reference, Whenever you need Item Variables, use the “GetClassDefaults” Node and plug in the Class Ref Variable of a Slot struct.
    This fixes the chaotic Wire drawings and helps on some breaking code, that comes with Struct usage.

  3. Only use this Tutorial (and his newer UE5 Tuts) as pure Learning Tutorials. Never use it as a 1:1 Code in your Product. His Tuts are made for specific situations only. You need to learn, how to adapt some specific Tasks to you own System.

  4. Keep in mind, that you need to know a whole bunch of Nodes about Array manipulation. An Inventory is nothing else, than an Array, holding many Structs, holding a Quantity and Class Ref.
    Means, every Action in this Interface and Widgets, is a simple:
    “SetArrayElement of Target, from Array.Get of Source, and then, overwrite Source Element with Empty.”
    That´s the whole Magic.

I would suggest not to use Sets and Maps here. Since you want multiple Items of the same type inside your Inventory (f.e. when a stack is full, or items are not stackable).
Keep it simple, use an Array.

So my Tip:
Start over again. If you didn´t get his idea behind a Step, start it over again, until you get it to work.
There are much simplier methods to create an Inventory… Some are using more efficient DataTables… Just use that Tut as a start for learning the basics in array, struct and interface manipulation.

1 Like

Hello! So I’m just gonna awkwardly pretend a huge amount of time didn’t pass since I posted and just continue like nothing happened hehe) May I ask if you could provide a few snapshots of your blueprint setup? I’d like to have some visual aid to understand what you were able to do to get it to work. Because I forgot that I did this tutorial before in a separate file, and it did work. As for starting again, I wanna know how far? because I added a system that allows the items to be spawned randomly and procedurally, and that requires the class variable. basically I’m saying I’m scared to do so because I have so many actors operating with this system implemented; it feels like taking a jenga piece away from the stack … except the stack is a tower … laced with dynamite slight_smile: