create_chest
Places a treasure chest event on a map that gives an item, weapon, armor, or gold, and uses a self-switch to ensure it can only be looted once.
Instructions
Create a complete, placed treasure chest on a map in one call — the two-page self-switch idiom done correctly, so the chest can never be looted twice. Page 1 (closed) is an action-button, priority-same event that optionally shows text, gives the contents, then flips its self switch; page 2 (opened) is gated on that self switch, shows the opened graphic and does nothing. kind picks the payout: item/weapon/armor (needs id) or gold. On the RTP !Chest sheet the open/closed states are the direction rows of one character block (down = closed, up = open), which is what closedDirection/openedDirection default to. Throws if the item/weapon/armor id does not exist; warns (never blocks) on an unknown characterName or a chest with no graphic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X tile position | |
| y | Yes | Y tile position | |
| id | No | The item/weapon/armor ID to give (omit for kind "gold") | |
| kind | Yes | What the chest gives; item/weapon/armor require `id` | |
| name | No | Event name (editor label); default "Chest" | |
| text | No | Optional message shown on opening, e.g. ["Found a Potion!"] | |
| force | No | Write even if validation finds structural problems (wrong parameter count, unterminated command list). Off by default: such a write is refused and nothing is written. Advisory warnings never block regardless. | |
| mapId | Yes | The ID of the map to place the chest on | |
| amount | No | How many (or how much gold) to give; default 1 | |
| dryRun | No | Preview only: return a diff of what would change without writing to disk. | |
| selfSwitch | No | Self switch channel marking the chest looted; default "A" | |
| characterName | No | Chest sprite basename from list_assets("characters"), e.g. "!Chest" | |
| characterIndex | No | Which chest in the sheet (0-7); default 0 | |
| closedDirection | No | Direction row showing the CLOSED chest; default "down" | |
| openedDirection | No | Direction row showing the OPENED chest; default "up" |