# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://infinitypbr.gitbook.io/magic-pig-games/game-modules-4/module-documentation/loot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
