Dialogue
This page goes over how to use dialogue in New Horizons.
Understanding Dialogue
Dialogue Tree
A dialogue tree is an entire conversation, it’s made up of dialogue nodes.
Dialogue Node
A node is a set of pages shown to the player followed by options the player can choose from to change the flow of the conversation.
Condition
A condition is a yes/no value stored for this loop and this loop only. It can be used to show new dialogue options, stop someone from talking to you (looking at you Slate), and more.
Persistent Condition
A persistent condition is similar to a condition, except it persists through loops, and is saved on the players save file.
Remote Trigger
A remote trigger is used to have an NPC talk to you from a distance; ex: Slate stopping you for the umpteenth time to tell you information you already knew.
ReuseDialogueOptionsListFrom
This is a custom XML node introduced by New Horizons. Use it when adding new dialogue to existing characters, to repeat the dialogue options list from another node.
For example, Slate’s first dialogue with options is named Scientist5
. To make a custom DialogueNode using these dialogue options (meaning new dialogue said by Slate, but reusing the possible player responses) you can write:
Note: If you’re loading dialogue in code, 2 frames must pass before entering the conversation in order for ReuseDialogueOptionsListFrom to take effect.
Example XML
Here’s an example dialogue XML:
Using the XML
To use the dialogue XML you have created, you simply need to reference it in the dialogue
prop
Dialogue Config
To view the options for the dialogue prop, check the schema
Controlling Conditions
You can set condition in dialogue with the <SetCondition>
and <SetPersistentCondition>
tags
Dialogue Options
There are many control structures for dialogue options to hide/reveal them if conditions are met. Take a look at the DialogueOption schema for more info.
Controlling Flow
In addition to <DialogueOptions>
, there are other ways to control the flow of the conversation.
DialogueTarget
Defining <DialogueTarget>
in the <DialogueNode>
tag instead of a <DialogueOption>
will make the conversation go directly to that target after the character is done talking.
DialogueTargetShipLogCondition
Used in tandem with DialogueTarget
, makes it so you must have a ship log fact to go to the next node.
Adding to existing dialogue
Here’s an example of how to add new dialogue to Slate, without overwriting their existing dialogue. This will also allow multiple mods to all add new dialogue to the same character.
NH will merge together <DialogueNode>
nodes that have the same <Name>
field, adding their <DialogueOptionsList>
together. No other changes will be merged.
NH can also add new <DialogueNode>
nodes into the text, however you have to add <DialogueOption>
s that link to them for them to ever be read by the player.
Be careful to use unique names to ensure optimal compatibility between mods. Consider prefixing the names of your nodes with the name of your mod.
To use this additional dialogue you need to reference it in a planet config file:
Dialogue FAQ
How do I easily position my dialogue relative to a speaking character
Use pathToAnimController
to specify the path to the speaking character (if they are a Nomai or Hearthian make sure this goes directly to whatever script controls their animations), then set isRelativeToParent
to true (this is setting available on all NH props for easier positioning). Now when you set their position
, it will be relative to the speaker. Since this position is normally where the character is standing, set the y
position to match how tall the character is. Instead of pathToAnimController
you can also use parentPath
.