diff options
| author | historia <[not public]> | 2026-06-26 02:52:31 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-26 02:52:31 -0400 |
| commit | 3102525d97aa6f1ad152c74b2ccfbd4b3a9b83f5 (patch) | |
| tree | 65610fa4fb8abe1dc7a46d00658e85e0525d397c /building_guide/behaviors.md | |
| parent | e2d5b081f27141bb3dd89dbe595860b8a1345d55 (diff) | |
| download | thehouseoficarus-3102525d97aa6f1ad152c74b2ccfbd4b3a9b83f5.tar.gz | |
feat: simplified conversation trees and output won't overwrite prompts now
Diffstat (limited to 'building_guide/behaviors.md')
| -rw-r--r-- | building_guide/behaviors.md | 85 |
1 files changed, 77 insertions, 8 deletions
diff --git a/building_guide/behaviors.md b/building_guide/behaviors.md index a2c1f89..60428d6 100644 --- a/building_guide/behaviors.md +++ b/building_guide/behaviors.md @@ -244,9 +244,11 @@ talk: | Field | Type | Description | |---|---|---| | `message` | string or list | NPC dialogue. May be a single string or a list of strings (pick one at random). | +| `sequence` | []string | NPC monologue — each message shown one at a time, player presses enter to advance. Options appear after the last message. Takes priority over `message` if both present. | +| `condition` | Condition | Optional. If the condition fails, the node is skipped entirely — its message, action, and options are not shown. Use with `goto` to auto-advance to a different node. | | `action` | NodeAction | Fires when the node is entered (give items, set flags, etc). | -| `options` | []TalkOption | Player choices. If empty and `next` is set, auto-advances. | -| `next` | string | Node ID to auto-advance to when there are no visible options. | +| `options` | []TalkOption | Player choices. If empty and `goto` is set, auto-advances. | +| `goto` | string | Node ID to auto-advance to when there are no visible options OR when the node condition fails. | #### TalkOption fields @@ -322,6 +324,32 @@ nodes: If an option has both an `action` and a `goto`, the action runs first, then the player navigates to the target node (which may also have its own action, fired on entry). +#### Sequences + +`sequence` is a flat list of NPC messages shown one at a time. The player presses +enter to advance through each message. After the last message, the node's options +(if any) are displayed. This is the preferred way to deliver NPC monologues — no +named nodes or `goto` chains needed: + +```yaml +nodes: + sign_reminder: + sequence: + - "\"Yeah, just us two! Not a lot of people heading into the belt these days.\"" + - "\"But we'll be landing shortly! Please look at the information sign.\"" + options: + - text: "\"Okay, thanks.\"" + - text: "\"Goodbye.\"" +``` + +Each `[enter to continue]` prompt is automatic. The node's action fires once on +entry, before the first sequence message. Node conditions still work normally — +if the condition fails, the entire sequence is skipped via `goto`. + +If a sequence node has no options after the last message and `goto` is set, it +auto-advances to the target node. Non-empty input during a sequence cancels the +conversation (just like invalid input does during option selection). + #### Randomized messages `message` accepts either a plain string or a list. A list picks one entry at random each @@ -341,7 +369,7 @@ nodes: #### Linear auto-advance -When a node has no options (or all its options are hidden by conditions) and `next` is set, +When a node has no options (or all its options are hidden by conditions) and `goto` is set, the conversation automatically advances to the target node. This creates dialogue chains without prompting the player: @@ -349,13 +377,13 @@ without prompting the player: nodes: monologue_1: message: "The elder clears his throat and begins..." - next: monologue_2 + goto: monologue_2 monologue_2: message: "\"Long ago, before the asteroid was settled...\"" - next: monologue_3 + goto: monologue_3 monologue_3: message: "\"...a great darkness fell upon these halls.\" He pauses." - next: choice_point + goto: choice_point choice_point: message: "\"Do you understand the weight of what I'm telling you?\"" options: @@ -363,8 +391,49 @@ nodes: - text: "\"Not really.\"" ``` -If a node has both `next` and options, the options take priority — `next` is only used -when no options are visible. A node with a shop action ignores `next` entirely. +If a node has both `goto` and options, the options take priority — `goto` is only used +when no options are visible. A node with a shop action ignores `goto` entirely. + +#### Conditional nodes + +A node can have its own `condition` that gates the entire node — message, action, +and options. When the condition fails, the node is skipped and the conversation +automatically advances to `goto` (if set). This lets you build branching first +messages or entire mutually-exclusive conversation paths based on player flags, +items, or any other condition: + +```yaml +nodes: + start: + condition: + player_flag: finished_tutorial + not: true + message: "\"Welcome, newcomer! Need any help getting started?\"" + goto: returning_player + options: + - text: "\"Yes, where do I go?\"" + goto: directions + - text: "\"I'll figure it out.\"" + returning_player: + message: "\"Ah, you're back! I heard you handled that raid beautifully.\"" + options: + - text: "\"The loot was worth it.\"" + - text: "\"Barely made it out alive.\"" + directions: + message: "\"Head north through the gate and follow the road.\"" + options: + - text: "\"Thanks!\"" +``` + +When `finished_tutorial` is set, the `start` node's condition fails, so the player +never sees "Welcome, newcomer" — it jumps straight to `returning_player`. When the +flag is unset, the condition passes and the player sees the newcomer message and its +options. + +Node conditions compose cleanly with option conditions. When the node condition +passes, each option's own condition is then checked independently to determine +visibility — exactly as option conditions always work. When the node condition +fails, the node (and all its options) are skipped entirely. #### Shop (buy/sell interface) |
