NPC with a branching dialogue tree
A character with a consistent voice and dialogue that reacts to what the player did. Written for Claude, free to copy, with every placeholder explained below.
The prompt
<role>
You write game dialogue that stays in character under pressure.
</role>
<context>
Game and setting: {{setting}}
NPC role: {{npc_role}}
What they want: {{want}}
What they are hiding: {{secret}}
What they will never do: {{limit}}
How they speak: {{voice}}
Player state that matters: {{player_state}}
</context>
<task>
Write a branching dialogue tree for this NPC.
</task>
<constraints>
- Every line must be in the stated voice. No neutral narrator register.
- At least three branches, and at least one where the player is hostile.
- The NPC never volunteers the secret. It surfaces only under a specific condition
you define.
- Reference the player state where it would plausibly matter.
- Keep every line under 25 words. This is spoken dialogue, not prose.
- The NPC must be able to end the conversation. Give the condition.
</constraints>
<output_format>
A tree with node IDs, player options and NPC responses, plus the conditions on
each branch.
</output_format>
Now write the dialogue tree.Open this in the prompt builder to adapt it, score it, and re-render it for a different model.
What to replace
| Placeholder | What to put there |
|---|---|
| {{setting}} | World, era, tone. |
| {{npc_role}} | Who they are in the world. |
| {{want}} | Their concrete goal in this scene. |
| {{secret}} | What they will not say unprompted. |
| {{limit}} | What they refuse to do, whatever the player says. |
| {{voice}} | Vocabulary, rhythm, verbal tics. |
| {{player_state}} | Flags the dialogue should react to. |
Why this prompt works
- Secret gated behind a condition
- Models volunteer everything they know. Defining the unlock condition is what makes the character feel like it has an interior.
- A hostile branch required
- Generated dialogue assumes a cooperative player. The hostile path is where character consistency actually gets tested.
- Word cap per line
- Written dialogue drifts toward prose length. A cap keeps it speakable.
- NPC can end the conversation
- An NPC that will talk forever is not a character. Giving them an exit condition gives them agency.
More prompts
- D&D 5e one-shot adventure — A complete session with encounters balanced to your party, and no railroading.
- Design a game mechanic — A mechanic with its failure modes and degenerate strategies identified up front.
- Blog post from an outline — Turn a rough outline into a full draft that keeps your structure and does not pad.
- Rewrite for clarity without changing meaning — Tighten prose while keeping the author's voice and every factual claim intact.
- Summarise a document without distorting it — A summary that separates what the source says from what it implies.
- Code review for correctness only — Findings with a triggering input, ranked by severity — and permission to find nothing.
Browse the full prompt library, all games prompts, or read the guides.