Add a chest that pays out once
make_chestCreate an RPG Maker MZ chest event with closed and opened pages, message, loot, self-switch handling, and optional lock condition, since MZ has no chest command.
Instructions
Place a chest: the closed graphic, the line it says, what it gives, and the opened page that replaces it afterwards. MZ has no chest command, so this writes the two pages the engine does read — page 0 hands out the contents and sets self switch A, page 1 is conditioned on self switch A and shows the open chest. Because a self switch is keyed to the event id, copy_event of this chest gives a second chest that is closed again. requires gates the payout with a Conditional Branch rather than a page, so a locked chest stays openable once the key condition arrives instead of silently becoming an unlocked one. The contents are checked before anything is written: an id that is a blank slot, or gold that would make this a tax, fails the call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| name | No | ||
| mapId | Yes | ||
| sound | No | SE played on opening; default Chest1 | |
| graphic | No | Defaults to the !Chest sheet every MZ project ships, closed at index 0 and open at index 1 | |
| message | No | Said as it is opened, e.g. "Inside is a lantern and 40 gold." | |
| replace | No | ||
| contents | Yes | What the chest gives when opened | |
| requires | No | What the player must have or have done first, e.g. {switch: 4} or {item: 3}. A condition is one of {switch: id, value?}, {selfSwitch: "A".."D", value?}, {variable: id, op?: "=="|">="|"<="|">"|"<"|"!=", value: n or {variable: id}} (op defaults to ">="), {item: id}, {weapon: id}, {armor: id}, {gold: n} (at least n), {actor: id, state?|skill?}, {button: "ok", pressed?}, or {code: 111, parameters: [...]} to write the engine's own shape. | |
| lockedMessage | No | Said when `requires` is not met; default "It is locked." |