Add a character who talks
make_npcPlace a complete NPC in one atomic call: set graphic, movement, dialogue, and an optional switch-triggered second page; the map is rerendered around it.
Instructions
Place a non-player character in one call: graphic, movement, what it says, and an optional second page that takes over once a switch or self switch is set. The dialog compiles into the shapes the engine reads (Show Text 101 plus one 401 per line; a follow page conditioned on the self switch the first page then sets), and the whole thing runs as one transaction — if any part fails, nothing is written. Answers with the map rendered around the new NPC. The two defaults worth knowing: priorityType 1 (same as tiles), because a person should block their cell, and replace true, so re-running a build script updates this NPC instead of leaving a second copy of it. patrol writes the page's own movement route, which the editor's moveType 1 runs. For more than talk — choices, gates, battles — use script here or make_choice_scene.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| say | No | What the first page says | |
| name | No | The event's name; also how replace finds this NPC again | |
| note | No | ||
| image | No | The event's graphic. A characterName that is not in img/characters fails the call | |
| mapId | Yes | ||
| pages | No | Three or more pages, in engine order: the first whose condition holds is the one that runs. Given `pages`, it *is* the page list and every page carries its own say or script — a top-level say/script alongside `pages` is refused, because merging it into every page conditions page 0 on the last page's condition and leaves a mute NPC | |
| follow | No | The page that replaces the first once its condition holds | |
| patrol | No | A custom movement route, e.g. [{right: true}, {right: true}, {left: true}, {left: true}]. Route steps are {key: value}: down, left, right, up, lowerLeft, lowerRight, upperRight, upperLeft, random, toward, away, forward, backward; jump {dx, dy}; wait n; turn ("down"|"left"|"right"|"up"|"90right"|"90left"|"180"|"random90"|"random"|"toward"|"away"); switch {id, value}; speed 0..6; frequency 0..4; walkAnime, stepAnime, directionFix, through, transparent (true/false); image {characterName, characterIndex}; opacity 0..255; blend 0..4; se {name}; script "...". | |
| script | No | The first page's steps instead of plain lines. Each step is an object with exactly one key: `say` (a string, a list of lines, or {lines, speaker?, faceName?, faceIndex?, background?, positionType?}), `scroll` ({lines, fast?, wait?}), `comment`, `choice` ({prompt?, options: [{label, then, when?, lockedMessage?}], cancel?: steps, defaultType?, positionType?, background?}), `if` ({when, then, else?}), `loop` (steps, closed by `break` or `goto`), `break`, `exit`, `label`, `goto`, `switch` ({id, value?}), `selfSwitch` ({letter, value?}), `variable` ({id, set?|add?|multiply?}), `gold` (a number; negative takes), `item`/`weapon`/`armor` ({id, count?, take?}), `heal`, `transfer` ({mapId, x, y, direction?, fade?}), `wait` (frames), `fade` ("out"|"in"), `flash` ({color?, duration?, wait?}), `weather` ({type, power, duration?, wait?}), `se`/`me`/`bgm` (a name or {name, volume?, pitch?, pan?}), `stopBgm`, `stopSe`, `animate` ({target?, animationId, wait?}), `balloon` ({target?, balloonId, wait?}), `moveRoute` ({target?, route: [route steps], repeat?, skippable?, wait?}), `battle` ({troopId, canEscape?, canLose?, win?, escape?, lose?}), `shop` ({goods: [{id, kind?, price?, purchaseOnly?}]}), `menu`, `saveScreen`, `gameOver`, `title`, `commonEvent`, `erase`, `script` (engine code, stored as 355/655) and `raw` (verbatim {code, parameters, indent?}). `script` and `raw` are escape hatches: they come back named in the reply, and a build that leans on them is reporting a shape this layer does not cover yet. | |
| replace | No | Rebuild the NPC of this name on this map instead of adding a second one (default true) | |
| speaker | No | Name shown above the dialog box, for every page here | |
| through | No | ||
| trigger | No | 0 action button (an NPC's default), 1 player touch, 2 event touch, 3 autorun, 4 parallel process | |
| faceName | No | Face image from img/faces, for every page here | |
| moveType | No | 0 static, 1 custom route (pass patrol), 2 random, 3 toward the player, 4 away | |
| moveSpeed | No | ||
| walkAnime | No | ||
| directionFix | No | Stop the sprite turning as it moves — what a facing-specific shopkeeper needs | |
| priorityType | No | 0 below tiles (the player walks through), 1 same as tiles (blocks, the default), 2 above tiles | |
| moveFrequency | No |