In another scene “Food_items” ( Note that there are 4 scenes for 4 inventories), I want to add the apple I got from the scene “battle1” into one of the slots in “Food_items”. This is where I can’t get it right…
i say it because maybe is the reason why it is not working.
You could use the debugger to see the contents of inventory when scene changes
Maybe you could use layers instead of scenes
You are looking for an item called “fooditem” in the inventory and you are trying to create an object called “fooditem” but in the previous scene you called the inventory item as “fooditem_apple”. Isn’t this the problem?
Also you are creating “fooditem” in position of the slot, but you don’t set the Z order, so the item may be created below the slot? Make sure the Z order of the item is higher than the slot. Personally, I would use animations instead of creating objects. If apple is present in the inventory, find an empty slot and set animation of slot to apple.
I made an inventory example included with GD, most people find it extremely confusing but not sure if I could do it more simple than that. It is pretty straight forward, if there is a cherry in the inventory, find empty slot and set animation to cherry since the slot animations also using names, the same names as the items. Take a look.
Also, the inventory is global, so you don’t need the events at the bottom to add items to inventory using the slots.
The slots should only display items if any exist, you should not add items to inventory using the slots.
The order should be = item collected → add item to inventory → is item exist in inventory? → add item to slot
However, in the example I did not calculate with using the inventory across multiple scenes, it does not work like that out of the box but should be easy to fix that.
Finally, I would recommend to use more comments in your project especially when you are asking for help so we know for certain what is that you are trying to do exactly and where, using which events.
Thank you for your reply. I was learning from your template but I think overall I am confuse with GD inventory system. I would really appreciateif you can answer me a few questions to understand the inventory logic better. =)
Let say
If I have 2 Inventory: foodinventory, dishinventory. In food inventory, I have fooditem_apple, fooditem_orange, fooditem_banana. (Those items are added through killing monster in different scenes with the add an item features)
And I just want to have a text object to display all the items in the food inventory. What is the action and text for it in modified text/
Do I modified a text object to
=""+ToString(food inventory(fooditems))
Or
=““+ToString(InventoryTools::(“foodInventory”, “fooditems”))
Is it how it works and if the action is right?
In my logic right now“Inventory = Alternative GlobalVariable for items"
I could be wrong but I believe the only expression the inventory system has is the Count expression that return the quantity of selected item in the inventory.
Inventory::Count("inventory_name", "item_name")
So if you want to display a list of items, all you need to do is change the text of a text object and enter this expression and pass the inventory name and the item name you want to display in the list, also don’t forget to convert to string because the expression return a number.