Slime dropped 5 coins and 1 Rusted Sword
Looting is an integral part of any RPG game and is one of those things game designers never stop tweaking during the development of the game, because its relies on player progression and a misplaced item could make the Player overpowered at the beginning of them game.
(Screenshot from Diablo III, loot scattered after defeating an enemy)
That's why we wanted to create a looting system that was easy to debug and tweak.
Loot Tables allow to easily define what items will be dropped after doing a certain task and with which probability these items will be dropped (if any at all).
(Simple Loot Table for a Common Enemy)
To create a Loot Table object, right click on the Project Panel and select
Create → Game Creator → Inventory → Loot Table. This will create a Loot Table object you can place anywhere you want in your project.
For example, if two items have the following probability weights:
- Item A: 3
- Item B: 1
The probability of dropping Item A is 75% while dropping Item B is only 25%
Once you have created a Loot Table, using it is very simple. All that needs to be done is call the Use Loot Table Action and drag and drop the Loot Table object onto its field.
(Loot Table Action using the Common Enemy table)
This will execute the Loot Table and give the Player a random item picked from the Table (if any). You can also send the randomly picked item into a Container, instead of the Player Inventory.