Inventory System Structure Variables

Hi all i was wondering how to create a simple inventory system using structure variables. Are there any tutorials or example code/json i could view to learn how to build one?

I want to avoid using Gdevelop5s Inventory system because it seems less flexible

Thanks in advance

there are so many ways to do it, that it would be very difficult to pinpoint a tutorial that is “right” for everyone.
it highly depends on your usage of it.

There are several question you should ask yourself about the usage of your inventory:
Do you want search functions? do you want sorting filters? do you have stackable items?
Randomized stats? enchantments and/or other effects for items the player can add?
the list goes on and on.

for some usages a simple array could do and for others (with stacks and filters) a deep structure is preferred.

So yeah, think about what you want to do with it, what it needs to accomplish and start working out your structure (i started on pan&paper to theorycraft how i want to structure my database for Görtan).

on how to use dynamic children for structures, you´ll find stuff here on the forum and the wiki, but maybe this topic here might be of interest for you:

there is one thing i can recommend for almost any inventory, and that it should have a mother variable for easy saving. Like Inventory.items and then stuff like inventory.items.count inventory.items.ATK and so on. Everything you want under the mother variable (inventory in this example) so that you can save the inventory as a json string and parse it back later.


thanks for the reply, for now im just creating an inventory with stackable items. Im still getting familiarized with which expressions to use. Ill check out the thread :slight_smile:

Hey guys just updating that I’ve found a tutorial on youtube which im following now which deals with creating an inventory using structure variables. Its about 2 hours long in total. But really helps in explaining how it works and to setup correctly. It might seem a little much to begin with but its palatable if you take it slow

1 Like