Hello. I need to set up a simple inventory system for NPC’s/containers.
Each character in the game, including the player, has 9 inventory slots that are shown on the UI layer. All objects in the game can either be in the character’s inventory or be placed on the map.
Each NPC has 9 variables that are assigned a random value when spawning, for example, Slot 1 - “none”, Slot 2 - “Knife”, Slot 3 - “credit card”, etc.
I need to understand how to display the items that an NPC has.
How to make it so that the player can only loot 1 NPC / container at a time.
In a situation where there are two lootable NPCs in the player’s reach, how can I display and switch their inventory? (The player stands between two dead characters, clicks on one - the UI displays the loot he has. Clicks on the second, the displayed loot changes to the corresponding one)