Skip to main content
Glama

Add a character who talks

make_npc
DestructiveIdempotent

Place 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

TableJSON Schema
NameRequiredDescriptionDefault
xYes
yYes
sayNoWhat the first page says
nameNoThe event's name; also how replace finds this NPC again
noteNo
imageNoThe event's graphic. A characterName that is not in img/characters fails the call
mapIdYes
pagesNoThree 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
followNoThe page that replaces the first once its condition holds
patrolNoA 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 "...".
scriptNoThe 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.
replaceNoRebuild the NPC of this name on this map instead of adding a second one (default true)
speakerNoName shown above the dialog box, for every page here
throughNo
triggerNo0 action button (an NPC's default), 1 player touch, 2 event touch, 3 autorun, 4 parallel process
faceNameNoFace image from img/faces, for every page here
moveTypeNo0 static, 1 custom route (pass patrol), 2 random, 3 toward the player, 4 away
moveSpeedNo
walkAnimeNo
directionFixNoStop the sprite turning as it moves — what a facing-specific shopkeeper needs
priorityTypeNo0 below tiles (the player walks through), 1 same as tiles (blocks, the default), 2 above tiles
moveFrequencyNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.2

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only carry idempotent/destructive hints; the description adds the transaction/atomicity guarantee ('if any part fails, nothing is written'), the reply shape (map rendered around the new NPC), the two consequential defaults (priorityType 1, replace true), and the note that script/raw escape hatches are echoed back in the reply. This is substantial disclosure beyond the annotations and is consistent with idempotentHint=true and destructiveHint=true.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core behavior, then defaults, then the escape-hatch caveat. Sentences are dense but each carries distinct information (atomicity, defaults, alternatives). It is on the long side for a tool description, but little is filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex, deeply nested tool with no output schema, it covers the write semantics, the reply's rendered map, defaults, and the escape-hatch limitation. It omits error/validation detail beyond the characterName failure (which the schema already states) but is otherwise complete enough to invoke confidently.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 22 params at 64% coverage, the description adds real meaning the schema does not: the rationale and default for priorityType 1 and replace true, and that `patrol` writes the page's movement route run by moveType 1. It leaves other params (e.g. moveSpeed, moveFrequency, walkAnime) to the schema, so it does not fully compensate for the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource ('Place a non-player character in one call') and enumerates exactly what it creates: graphic, movement, dialogue, and an optional follow page. It is clearly separable from sibling place_event (raw event) and make_choice_scene (branching scenes).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear routing rule for adjacent needs — 'For more than talk — choices, gates, battles — use `script` here or make_choice_scene' — and explains the replace default as the build-script idiom. It does not exhaustively state when NOT to use it (e.g. vs place_event), so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.