# 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.

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

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

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)