inventory events ?

How can i use inventory events in gdevelop 5 ?

Example is bundled with GDevelop 5 called Inventory System. It may look complicated but very simple really.
In GDevelop you can create an Inventory which is basically an array and you can name it to whatever you want, for example Player Inventory and Merchant Inventory. Then you can add, remove items by name to any inventory and check if an item exist in the Inventory and also check quantity of item by using it name. You can also flag items as equipped when you use them and check if an item is equipped. You can also set maximum count for an item and check if an item reached maximum count before add it to the inventory. Pretty straight forward I would think.

Can you include more picture in the tutorial.
I somehow cannot get my inventory system to work as I want
Trigger → add “item” to “itemInventory”
Has item “item” in “item …”-> quit game

Even this don’t work

What do you expect to happen exactly? What is not working?

The game quit after I collect the item(trigger)
This is just a silly example of I don’t understand the event. Can you just use inventory event? Or you need variable to. Plss give me simple example. You collect an item. Then add the item to player inventory. Check if there’s item in player inventory. The the game close.
I’ve seen inventory system template in gdevelop but it uses so many var. That the inventory event it self become small thing

You can use the inventory events only to handle the data, no need to use variables or anything else.

It is used to display the information using the UI, it is got nothing to do with the actual data.
You can think of the inventory as a type of variable or an array that store multiple information for you, the actual inventory data. Items and their quantity.

The example is not very good actually because it is made when there was no Inventory events and then it was updated later to use the Inventory events. So it is a little messy :wink:

So if you don’t need the UI to display an inventory, you can use the inventory events only to store the data.
And the example with variables just show one way to display the data using a UI but it is not the best way by any means.

Well, it sound right.
You added “item” to inventory “itemInventory”
And then you check if “item” exist in “itemInventory” and you quit the game.

Can you make it work and screenshot it to me. I’m not sure why the game still don’t quit.

You can download the project from here it works:

Actually I some able to make it work my self. Although I don’t change anything, which I don’t know what’s wrong, it somehow work this time. Also if I want to display. Seems like I have to use variable first. But tq

Maybe you misspelled the inventory name or item name.

As I mentioned to handle inventory data you don’t need variable and the inventory example show you how to display data using a UI (sprites). But for example if you wan to display the data only using text, you can use expression
ToString(Inventory::Count("inventoryName", "itemName"))

If you need one, I have uploaded an example here (display_inventory_data):