Help with inventory system

i need an inventory that has stackable objects
i have tried using lists but they failed
@CodeAlpaca

Well that’s too bad, because lists are still needed for this.

There are 2 ways of going about this.

  1. Use a single list and have it something like “4.76” with 4 being the item, and 76 being the amount.
  2. Use 2 lists, one that contains the item and another that contains the amount.

Personally, I would go with the first option, but it’s up to preference.
So you basically want something like a Minecraft inventory correct? If not, it’s important to know the design specifics.

1 Like

Oh, saw your post that you are leaving, do you still need help with this?

1 Like

no im not leaving my computer is not enough ram to run unreal im staying

yes im making a big survival game for the flow jam
if you can can give an example

1 Like

Flow jam is in a specific two week time period, not rn

2 Likes

Ok, so how to work through this problem. Also, thinking about this further, I think the easiest thing for you would be to use 2 lists. It makes things much simpler, otherwise, it can get overly complex for you to understand.


  1. Find out what you want

“You want to make an inventory of items that are stackable.”

So, whenever working with large groups of things you’ll want to be using a List. Is there any other information about the behaviors needed? Not really, so you’ll just need to work with that.


  1. Move the goalpost.

So obviously you don’t know how to make the entire system, that’s the point of going through the steps like this.

Break it down into something easier that you can make. Make an inventory that can contain items, but that aren’t stackable.

This should be a relatively easy task, you just need to add items to a List.

Okay, so now you need to figure out why it does not work on the larger picture of the system.
Well, the problem is items don’t stack. If you had 1 dirt, your list might look like [1], but with this system, if you had 2 dirt it would be [1, 1]. That can work, but displaying it takes extra steps and is overall messier.


  1. Identify what parts are missing.

So you have a basic inventory now. The part that is missing is actually making them “stack”.

Well, we can split this into 2 parts, the 1st List is for the items, and the 2nd List is for the number of them.

1 Like

And yeah, Flowjam isn’t happening. You’ll need to wait about 4-5 months for the next one, and you only have 2 weeks (14 days) to develop your game.

I need to get ready for school now, hopefully this is a rough draft for you to get started and experiment. This should also give you a format to try and figure it out yourself.

If you still need help, I should be able to message back in a few hours, but I really do encourage you to really try yourself. Doing it and experimenting is honestly the best way to learn.

2 Likes

its not working

Can you send a link to the game so I can check the code?

1 Like

i just deleted half of it :laughing:

It’s kind of hard for me to believe anything you say. It seems you’re going about this all wrong.

The inventory blocks shouldn’t be controlling the inventory, that’s how you interact with it. There should be a main controller for the inventory.

ik im testing the block

Well if you know this, you didn’t delete half the code. You deleted all the code and the object it was in.

no look

click the blocks :slightly_smiling_face:

What I’m saying is that you shouldn’t have the code for the inventory in those blocks. Those are basically to display it. What I’m seeing in that imagine isn’t related at all to the inventory system itself.

To make a proper test, make an object. When that object is clicked, add it to the inventory.
Then create an Inventory Controller which will manage this.

now i just need to code the inven

when the block gets the message it will add the object the inven manager will send the message

now try (i will add the inven manager later)