manage_map_event
Create, update, convert, or delete RPG Maker MV map events, including NPCs, chests, doors, shops, inns, bosses, and puzzles; map file saves immediately.
Instructions
Create, change or remove map events; the map file is written immediately. action "create" without preset makes a bare event at x/y (empty page unless pages; then use add_command or insert_event_commands). With preset it builds a ready event: "npc" {name, dialogues[], characterName?, characterIndex?}; "chest" one-time loot {items: [{type item|weapon|armor, id, amount}]}; "teleport" walk-on transfer {destMapId, destX, destY, trigger?}; "door" action-button warp {destMapId, destX, destY, characterName?, characterIndex?, trigger?, lockedSwitchId?, lockedMessage?}, locked until that switch is ON; "shop" {goods: [[type 0 item/1 weapon/2 armor, id, priceType 0 standard/1 custom, price]]}; "inn" {cost?}; "boss" {troopId} one-time battle, game over on loss; "puzzle_switch" {switchX, switchY, doorX, doorY, gameSwitchId, switchName?, doorName?} makes two linked events. IDs and destinations are not validated (check with query_database and query_map). "update" overwrites only fields. "convert" keeps an event's id, position, name and sprite but replaces its behaviour via kind: "merchant" (options.goods, or options.items [{type, id}], options.greeting?), "inn" (options.cost?), "sign" (options.text). "delete" removes it (destructive). "add_command" appends one command before a page's end. "populate" scatters N npc/chest/boss events at random positions (walkability not checked; check with query_map "ascii"). Returns the event(s) with ids; fails if the map or event does not exist.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Tile X position (0-based; create/presets except puzzle_switch) | |
| y | No | Tile Y position (0-based) | |
| cost | No | preset "inn": gold charged for a full recovery (default 50) | |
| kind | No | action "convert": what to turn the existing event into | |
| name | No | Event name shown in the editor | |
| opts | No | action "populate": overrides {name, troopId, x, y} | |
| count | No | action "populate": how many events (default 3) | |
| destX | No | preset "teleport"/"door": destination tile X (should be walkable) | |
| destY | No | preset "teleport"/"door": destination tile Y | |
| doorX | No | preset "puzzle_switch": door tile X | |
| doorY | No | preset "puzzle_switch": door tile Y | |
| goods | No | preset "shop": wares [[type, id, priceType, price]] — priceType 1 uses the custom price, 0 the database price | |
| items | No | preset "chest": loot [{type: "item"|"weapon"|"armor", id, amount}] | |
| mapId | Yes | Map the event lives on (always required) | |
| pages | No | action "create" without preset: full event page objects (optional) | |
| action | Yes | What to do; see the tool description. Default "create" | |
| fields | No | action "update": properties to overwrite, e.g. {"x": 5, "y": 9} or {"pages": [...]} (replaces all pages) | |
| preset | No | action "create" only: ready-made event recipe; omit for a low-level empty event | |
| command | No | action "add_command": event command {code, indent, parameters}; e.g. 201=Transfer Player [0, mapId, x, y, dir, fade] | |
| eventId | No | Existing event ID (update/delete/add_command); find it with query_map view "events" | |
| options | No | action "convert": kind-specific settings — merchant {goods|items, greeting?}, inn {cost?}, sign {text} | |
| switchX | No | preset "puzzle_switch": floor-switch tile X | |
| switchY | No | preset "puzzle_switch": floor-switch tile Y | |
| trigger | No | How the event activates: 0=action button, 1=player touch, 2=event touch, 3=autorun, 4=parallel | |
| troopId | No | preset "boss" / populate boss: troop to battle (create it first via create_database_entry preset encounter_troop) | |
| doorName | No | preset "puzzle_switch": editor name for the door event (default "Door") | |
| destMapId | No | preset "teleport"/"door": destination map ID | |
| dialogues | No | preset "npc": dialogue lines, each becomes one text box | |
| eventType | No | action "populate": kind of events to scatter — "npc", "chest" or "boss" | |
| pageIndex | No | action "add_command": which page receives the command (0-based, default 0) | |
| switchName | No | preset "puzzle_switch": editor name for the switch event (default "Switch") | |
| gameSwitchId | No | preset "puzzle_switch": game switch linking switch and door — pick an unused ID via manage_system get switches | |
| characterName | No | Sprite sheet from img/characters/ without extension; list options with get_project_context | |
| lockedMessage | No | preset "door": message shown while locked (default "It's locked.") | |
| characterIndex | No | Which of the 8 characters in the sheet (0-7) | |
| lockedSwitchId | No | preset "door": if set, the door shows lockedMessage until this game switch is ON, then warps |