Suggestions on how to make a shop system (Using Resources)

Godot Version

4.3

Question

I’m new to inventories, made a drag and drop inventory system by following a tutorial online - ‘RPG Inventory System from Scratch’ on youtube but in 2d and it is managed only by buttons, there is no player character, so you click trade - inventory and shop opens up, you click inventory - inventory opens up. It uses resources, by first creating an ItemData resource, a SlotData resource, and then an InventoryResource. I made an external inventory, which is basically a copy of the player inventory scene and using the same resources, which now acts as a shop inventory, I am able to stack items even if they’re from different inventories, but I want to make it so that the game notifies you whether you’re dropping an item in either the player inventory or the shop inventory, so that I can increase/decrease the player gold amount according to whether something is bought or sold. Since both inventories use the same resource for Slot Data and InventoryData, im wondering if I have to make a new InventoryData or a SlotData resource or whether I can edit the existing scenes/resources to make it work.

I tried assigning a data key to the InventoryData resource, so that each inventorydata created has a different key, but still I couldn’t find a way to make it work and would appreciate any suggestions

You explained what ItemData resource, SlotData resource and InventoryResource are, but what is InventoryData?

When you say you couldn’t make it work, what do you mean? Are there any errors or maybe there are functions that are not executing?

You can make a shop_item_dropped and a inventory_item_dropped signal, and have the player inventory and the shop inventory fire these signals. You’d then have to connect them to the script that manages the player’s gold.

It would help if you can share you scene layout and your scripts so there’s more detail and your question can be answered. Personally I’m using an addon called gloot which could save you some work.but it might not fit your project.

the shop and the character should have the same inventory system with different results attached to each. you should make a signal for items dragged out side of a inventory, then connect that signal to a func that removes gold for shops, or connect that signal to a func that adds gold if removing from character in to a shop. that’s how I would do it so I would not have make a lot of different inventories for each treasure chest. so when they take the cursed ring that can never be taken off they trigger a quest with the signal.