> For the complete documentation index, see [llms.txt](https://picnic-in-the-oblivion.gitbook.io/assets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://picnic-in-the-oblivion.gitbook.io/assets/modding/how-to-add-new-stashes.md).

# How to add new stashes

Files & folders needed:

> assets/gameplay/loot\_containers.json
>
> assets/scripts/p\_game.gd

Here is JSON structure of regular container:

{% code title="loot\_containers.json" %}

```json
"loot_battery":{
    "name": "shelf",
    "caption": "box",
    "items_casual":[
        "medkit",
        "medkit"
    ],
    "items": [
	"af_battery",
	"medkit_army"
    ]
}
```

{% endcode %}

<pre class="language-ini" data-title="Properties description"><code class="lang-ini"><strong>loot_battery = container ID, must be unique
</strong>name = Any text or language key from lang_*.json
caption = cut-off feature, just leave blank
items_casual = (optional) list of items IDs that will be spawned in easy mode
items = array of items IDs
</code></pre>

Create new container copy with ID "my\_loot\_container" and add there few medkits and antirads.

```json
"my_loot_container":{
    "name": "box",
    "caption": "",
    "items": [
	"medkit",
	"medkit_army",
	"antirad"
    ]
}
```

How to test it? Well... We can do some trick. If you look into source code project, it has level\_editor folder there.

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

&#x20;Inside it, there will be prefabs that can be used in Godot Engine level editor but we can trick it with external scripts that inside game build path <mark style="color:orange;">assets/scripts/</mark>.

<figure><img src="/files/uOknQxVKfSRENutfnVnq" alt="" width="430"><figcaption></figcaption></figure>

Remember the path to the prefab: \
(in game root directory -> res\://) <mark style="color:orange;">/level\_editor/usable\_triggers/items\_loot\_trigger.tscn</mark>&#x20;

{% code title="items\_loot\_trigger.tscn" %}

```gdscript
# this file contains keys parameter and you can change invisible state or loot id
# by scripts using: *Prefab_Node_When_Instantiated*.keys["key"] = ...
keys = {
    "invisible": true,
    "loot_id": "id_from_assets_gameplay_loot_containers_json"
}
```

{% endcode %}

Open <mark style="color:orange;">assets/scripts/p\_game.gd</mark> script and at the start of the game [(level intro)](#user-content-fn-1)[^1] add this code:

```gdscript
"intro":
    # preload and spawn object to the scene tree
    var my_container_prefab = preload("res://level_editor/usable_triggers/items_loot_trigger.tscn").instantiate()
    # set stash ID with meds
    my_container_prefab.keys["loot_id"] = "my_loot_container"
    # always generate colliders and visibility for that type of prefabs
    # or you can use only GameManager.generate_collider(my_container_prefab or *other node*)
    GM._visibility_collision_generation(my_container_prefab)
    # add trigger zone to the current level
    GM.current_level.add_child(my_container_prefab)
```

Run the new game and look at the middle between corpses:

<figure><img src="/files/TAepwXVgPoeTLMi7WZTo" alt=""><figcaption><p>Loot trigger at the (0, 0, 0) position coordinates (because we don't change position when spawn)</p></figcaption></figure>

<figure><img src="/files/lLkPa222CUof4Z3bWcxH" alt=""><figcaption><p>Loo are there! Good job!</p></figcaption></figure>

[^1]: {% code title="p\_game.gd" %}

    ```gdscript
    func on_level_changed(level_id):
    ```

    {% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://picnic-in-the-oblivion.gitbook.io/assets/modding/how-to-add-new-stashes.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.
