Dialog System
The dialog system lets you create branching conversations with NPCs. Dialogs are defined as JSON files and support multiple node types, conditional branching, command macros and localization.
How Dialogs Work
When a player presses F on an NPC, the system follows this priority chain:
- Quest NPC Profile -- If the Quest mod has a profile for this citizen, the quest dialog system takes over.
- Citizen Dialogs -- The
dialogsarray in the citizen config is checked. The first dialog whose condition matches is opened. - Messages -- If no dialog matches, simple chat messages are sent.
- Shop / Commands -- If no dialog or messages exist, the shop or command actions are executed.
Quest NPC Profiles always take priority. If a citizen has both a quest profile and legacy dialogs, only the quest profile dialog is shown. Do not mix both on the same NPC.
Dialog File Structure
Dialog files live in configs/kyuubisoft_core/dialogs/ as individual JSON files.
{
"id": "example_dialog",
"speakerName": "dialog.example.speaker",
"startNode": "greeting",
"nodes": [
{
"nodeId": "greeting",
"type": "TEXT",
"lines": ["dialog.example.greeting.line1", "dialog.example.greeting.line2"],
"next": "ask_help"
},
{
"nodeId": "ask_help",
"type": "CHOICE",
"lines": ["dialog.example.ask_help"],
"choices": [
{
"text": "dialog.example.choice.yes",
"next": "accepted"
},
{
"text": "dialog.example.choice.no",
"next": "declined"
},
{
"text": "dialog.example.choice.later",
"next": null
}
]
},
{
"nodeId": "accepted",
"type": "TEXT",
"lines": ["dialog.example.accepted.line1"],
"next": null
},
{
"nodeId": "declined",
"type": "TEXT",
"lines": ["dialog.example.declined.line1"],
"next": null
}
]
}
Top-Level Fields
| Field | Required | Description |
|---|---|---|
id | Yes | Unique dialog ID. Referenced from citizen config. |
speakerName | No | Display name for the speaker. Can be an i18n key or plain text. Falls back to the citizen's name if omitted. |
startNode | Yes | ID of the first node to display. |
nodes | Yes | Array of dialog nodes. |
Node Types
TEXT Node
Displays one or more lines of text. The player clicks to advance to the next node.
{
"nodeId": "greeting",
"type": "TEXT",
"lines": ["Hello, traveler!", "Welcome to our village."],
"next": "ask_help"
}
lines-- Array of text strings or i18n keys (1-4 lines recommended).next-- ID of the next node. Set tonullto end the dialog.
CHOICE Node
Displays text with selectable response options.
{
"nodeId": "ask_help",
"type": "CHOICE",
"lines": ["Can you help me gather some herbs?"],
"choices": [
{ "text": "Sure, I will help!", "next": "accepted" },
{ "text": "Not right now.", "next": null }
]
}
Each choice has:
text-- Display text or i18n key.next-- Node to jump to.nullcloses the dialog.condition-- Optional condition to show/hide this choice (see below).macro-- Optional commands to execute when this choice is selected.
INPUT Node
Prompts the player for text input. The input is dispatched to the citizen listeners.
{
"nodeId": "name_input",
"type": "INPUT",
"lines": ["What is your name, adventurer?"],
"next": "response"
}
Conditions
Conditions control which dialogs or choices are available based on the player's state.