Create event from template
create_event_from_templateCreates a complete, ready-to-use RPG Maker MV map event at a chosen tile from a template such as chest, door, inn, shop, save point, or NPC in one write, validating bounds and occupancy.
Instructions
Creates a complete, ready-to-use map event at (x, y) from a template, in one write. Refuses out-of-bounds tiles, and refuses a tile that already holds an event unless allowStack is true. Graphics default to none: events are INVISIBLE in game until an image is supplied (chest: closedImage/openImage, npc: image; locked_door, inn, shop and save_point never get a graphic and are meant to sit on a tile that already looks right). Templates and their params: chest {reward: {gold?, item?: {type: item|weapon|armor, id, count?}}, message?, closedImage?, openImage?} (two pages: the action button opens it and sets self switch A, then an empty opened page; if only closedImage is given, openImage defaults to the same graphic with direction 8 - the opened-chest frame of the standard chest sheets); locked_door {keyItemId, destination: {mapId, x, y, direction?: 0|2|4|6|8}, lockedMessage?, consumeKey?} (transfers the player if the party holds the key); inn {price, greeting?} (Stay/Leave choice; staying charges gold, fades out, restores the party, fades in); shop {goods: [{type: item|weapon|armor, id, price?}] (1-40; price defaults to the database price), purchaseOnly?}; save_point {} (opens the save screen); npc {lines: string[], face?: {name, index}, image?}. Image = {characterName, characterIndex (0-7), direction?: 2|4|6|8, pattern?: 0|1|2}. Returns { eventId, name, pages }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| face | No | npc: face portrait { name, index } | |
| name | No | Event name; defaults to the template name (Chest, Door, Inn, Shop, Save Point, NPC) | |
| goods | No | shop: 1-40 entries { type: item|weapon|armor, id, price? }; omit price for the database price | |
| image | No | npc: the NPC's character graphic | |
| lines | No | npc: lines of dialogue (4 per message box) | |
| mapId | Yes | ||
| price | No | inn: gold per night (>= 0) | |
| reward | No | chest: { gold?: number, item?: {type: item|weapon|armor, id, count?} }, at least one | |
| message | No | chest: text shown when opened (default "You found treasure!") | |
| greeting | No | inn: text shown first | |
| template | Yes | Which template to build; the other fields depend on it | |
| keyItemId | No | locked_door: item id of the key | |
| openImage | No | chest: graphic after opening (default: closedImage facing up) | |
| allowStack | No | Allow placing the event on a tile that already has an event | |
| consumeKey | No | locked_door: remove one key on use | |
| closedImage | No | chest: graphic before opening | |
| destination | No | locked_door: { mapId, x, y, direction?: 0|2|4|6|8 } | |
| purchaseOnly | No | shop: disable selling | |
| lockedMessage | No | locked_door: text when the player has no key (default "It's locked.") |