> For the complete documentation index, see [llms.txt](https://infinitypbr.gitbook.io/magic-pig-games/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infinitypbr.gitbook.io/magic-pig-games/game-modules-4/module-documentation/loot.md).

# Loot

<figure><img src="/files/GgLl3nha1CsuJDxMbf7H" alt=""><figcaption></figcaption></figure>

## Overview

The **Loot** module aims to make randomized yet predictable Loot Boxes easy. It works perfectly with the **Items** module, and can easily sync with the **Inventory** system as well, if you're using it.

{% hint style="info" %}
The Loot module is used in the Quest module to provide rewards. You can use the Loot module on your enemies as well, to handle item drops and more.
{% endhint %}

Start with a **Loot Items** object, which lets you populate a group of "Potential Items". You can create as many of these as you need, with any combinations of `ItemObjects`. Then, create `LootBox` objects, which allow you to bring in your `LootItem` objects, as many as you'd like, and for each one, select any number of individual `ItemObjects` that the system will attempt to spawn.

There are plenty of options including randomizing the `ItemObject` and the variety of `ItemAttributes` (including selecting none), or forcing a specific `ItemObject` to spawn -- perfect for quest items you want to ensure the player gets.

The end result is a group of items which can be as random as you'd like, and provide interesting results for players. Attach `LootBox` items to anything that has "stuff" in it. Treasure chests, enemies, drawers and boxes, or even the top of a counter, where a merchant is displaying their wares.

The **Loot** module is designed to help you create the contents of loot, but how you display it, and how you handle it, is entirely up to you.

There are virtual and other methods which let you customize the selection process, and handle the loot once it is generated as well. This way, if you'd like to inject specific logic that changes the odds of getting specific loot, or more loot, or better loot, you can do so.
