Dialogue reference
The dialogue component, the conversation assets, their answer effects and flag requirement, and the running conversation your UI reads. For how to use it, see Dialogue.
VtUnitDialogue
Component. Add it with Add Component → Vantage → Dialogue → VtUnitDialogue.
Per-unit dialogue state for the unit that talks to NPCs, usually the player. Holds the one running VtDialogueConversation and a set of named flags that remember what has been said. Opt in through VtUnitDefinition.useDialogue; VtUnit attaches it.
Scripting API
| Member | Description |
|---|---|
VtDialogueConversation Active { get; } |
The running conversation, or null. |
bool IsTalking { get; } |
True while a conversation is running. |
IReadOnlyCollection<string> Flags { get; } |
Every flag currently set. Read-only view for UI and saving. |
event Action<VtDialogueConversation> OnConversationStarted |
Fires after Begin started a conversation. |
event Action<VtDialogueConversation> OnNodeChanged |
Fires when the shown node or its answers changed. |
event Action<VtDialogueConversation> OnConversationEnded |
Fires once when the conversation ended by any route. |
event Action OnFlagsChanged |
Fires after a flag was set or cleared. |
void Initialize() |
Cache the sibling VtUnit. Idempotent; public for late-attach AddComponent callers. |
VtDialogueConversation Begin(VtUnit speaker, VtDialogueDefinition dialogue, string greeting, VtQuestDefinition[] offeredQuests) |
Start talking to speaker. Runs dialogue when it has nodes; otherwise shows greeting with the speaker’s offered quests as answers. Returns null, and starts nothing, when there would be nothing to show. Ends any conversation already running. |
bool Choose(int index) |
Pick an answer on the running conversation. False when none is running or the pick was refused. On a predicting client the pick also goes to the authority, which applies the answer’s effects. |
bool Continue() |
Advance past a plain line on the running conversation. False when none is running or answers are pending. |
void End() |
End the running conversation, if any. |
bool HasFlag(string flag) |
True when flag is set. |
void SetFlag(string flag) |
Set a flag. No-ops on a replica or when already set. |
void ClearFlag(string flag) |
Clear a flag. No-ops on a replica or when not set. |
void ApplyFlagsFromNet(IEnumerable<string> snapshot) |
Replace every flag with snapshot. Used by loading and replication; not authority-gated. |
VtDialogueDefinition
Asset. Create it with Create → Vantage → Dialogue → Dialogue Definition.
Authored conversation: a flat list of VtDialogueNode entries that jump to each other by node id. The first node is where a conversation starts. Assign the asset to an NPC’s VtQuestGiver.dialogue (or to VtUnitDefinition.dialogue so it attaches on spawn); the player’s VtUnitDialogue runs it when they interact.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Id (id) |
string |
Empty | Stable string identifier for save files and tooling. Convention: ‘dialogue. |
Nodes (nodes) |
VtDialogueNode[] | Empty | Nodes in any order. The conversation starts at the first one; answers jump by node id. |
Scripting API
| Member | Description |
|---|---|
VtDialogueNode StartNode { get; } |
The node a conversation starts on, or null when the asset has no nodes. |
VtDialogueNode Find(string nodeId) |
Find a node by VtDialogueNode.id. Returns null when the id is empty or unknown. |
VtQuestDialogueEffect
Asset. Create it with Create → Vantage → Dialogue → Effects → Quest. Inherits VtDialogueEffect.
Dialogue effect: accept, turn in or abandon a quest on the listener’s VtUnitQuestLog. No-ops when the listener has no log or the log refuses, for example accepting a quest that is not available. Pair the answer with a VtQuestStateRequirement so it only shows when the action can succeed.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Quest (quest) |
VtQuestDefinition | None | Quest to act on. Required. |
Action (action) |
VtQuestDialogueAction | Accept |
What to do with the quest when the answer is picked. |
Scripting API
| Member | Description |
|---|---|
override void Apply(VtUnit listener, VtUnit speaker) |
Accepts, turns in or abandons quest on the listener’s quest log, as set by action. |
VtRewardDialogueEffect
Asset. Create it with Create → Vantage → Dialogue → Effects → Reward. Inherits VtDialogueEffect.
Dialogue effect: grant quest reward assets to the listener. Reuses the same item, currency and XP rewards a quest turn-in uses, so a bribe, a gift or a tutorial hand-out needs no new asset type.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Rewards (rewards) |
VtQuestReward[] | Empty | Rewards granted to the listener, in order. |
Scripting API
| Member | Description |
|---|---|
override void Apply(VtUnit listener, VtUnit speaker) |
Grants every entry of rewards to the listener, in order. |
VtSetFlagDialogueEffect
Asset. Create it with Create → Vantage → Dialogue → Effects → Set Flag. Inherits VtDialogueEffect.
Dialogue effect: set or clear a named flag on the listener’s VtUnitDialogue. Flags remember what has been said, for example “met.elder” or “refused.bribe”, and gate later answers through VtDialogueFlagRequirement. Flags are saved with the unit.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Flag (flag) |
string |
Empty | Flag name. Convention: ‘ |
Clear (clear) |
bool |
Off | Clear the flag instead of setting it. |
Scripting API
| Member | Description |
|---|---|
override void Apply(VtUnit listener, VtUnit speaker) |
Sets flag on the listener’s VtUnitDialogue, or clears it when clear is checked. |
VtDialogueFlagRequirement
Asset. Create it with Create → Vantage → Quests → Requirements → Dialogue Flag. Inherits VtQuestRequirement.
Requirement: the holder’s VtUnitDialogue has (or, with mustBeAbsent, lacks) a named flag. Works anywhere a VtQuestRequirement is accepted: dialogue answers and quest availability alike. A holder without a dialogue component never meets it.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Flag (flag) |
string |
Empty | Flag to look for. Set by a Set Flag dialogue effect. |
Must Be Absent (mustBeAbsent) |
bool |
Off | When checked the flag must NOT be set. |
Scripting API
| Member | Description |
|---|---|
override bool IsMet(VtUnit holder) |
True when the holder has flag set, or does not when mustBeAbsent is checked. |
VtDialogueNode
Serializable class.
One line of a VtDialogueDefinition: what the speaker says and which answers the listener can give. Authored inline on the dialogue asset.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Id (id) |
string |
Empty | Id other nodes and answers jump to. Unique within the dialogue. E.g. ‘greet’, ‘shop’, ‘farewell’. |
Text (text) |
string |
Empty | What the speaker says. Render in your dialogue UI. |
Answers (answers) |
VtDialogueAnswer[] | Empty | Answers the listener can pick, in display order. Empty = a plain line; Continue moves to Next Node Id or ends the conversation. |
Next Node Id (nextNodeId) |
string |
Empty | Node to go to on Continue when this node has no answers to pick. Empty = end the conversation. |
Include Quest Answers (includeQuestAnswers) |
bool |
Off | Append the NPC’s offered quests as answers: one to accept each quest the listener can take, one to turn in each quest they have completed. Picking one applies it and refreshes this node. |
Scripting API
| Member | Description |
|---|---|
Vector2 graphPosition |
Where the node sits in the Dialogue Graph window. Editor layout only; conversations ignore it. |
VtDialogueAnswer
Serializable class.
One answer on a VtDialogueNode: the listener’s line, the conditions to show it, what happens when it is picked, and where it leads.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Text (text) |
string |
Empty | What the listener says. Render as the button label. |
Next Node Id (nextNodeId) |
string |
Empty | Node to jump to when picked. Empty = end the conversation. |
Requirements (requirements) |
VtQuestRequirement[] | Empty | Conditions on the listener, all of which must pass. Empty = always offered. |
Show When Locked (showWhenLocked) |
bool |
Off | When checked, an answer whose requirements fail is still listed but marked unavailable, so the UI can show it greyed out. Unchecked hides it. |
Effects (effects) |
VtDialogueEffect[] | Empty | Applied to the listener when the answer is picked, in order, before the jump. |
VtDialogueEffect
Abstract asset base. Shipped subclasses: VtQuestDialogueEffect, VtRewardDialogueEffect, VtSetFlagDialogueEffect.
Abstract authored side effect of picking a VtDialogueAnswer. The built-ins accept or turn in a quest (VtQuestDialogueEffect), grant rewards (VtRewardDialogueEffect) and set a dialogue flag (VtSetFlagDialogueEffect). Opening a shop or starting a cutscene is one file with an Apply override.
Scripting API
| Member | Description |
|---|---|
abstract void Apply(VtUnit listener, VtUnit speaker) |
Run the effect. listener is the unit holding the conversation (the player); speaker is the NPC. Both are non-null. |
VtDialogueConversation
Class.
A running conversation between a listener (the player) and a speaker (an NPC). Walks a VtDialogueDefinition node by node, filters each node’s answers through their requirements, applies effects when an answer is picked, and appends the speaker’s offered quests as answers where the node asks for them. Plain C#: no rendering, no timing. Your UI reads Text and Choices, calls Choose or Continue, and closes on OnEnded.
Scripting API
| Member | Description |
|---|---|
VtUnit Speaker { get; } |
The NPC. |
VtUnit Listener { get; } |
The unit holding the conversation, usually the player. |
VtDialogueDefinition Definition { get; } |
The dialogue asset being run; null when the speaker has none and the conversation is a generated greeting with quest answers. |
VtDialogueNode CurrentNode { get; } |
The node currently shown; null once the conversation has ended. |
string Text { get; } |
The speaker’s line for the current node, localized. |
IReadOnlyList<VtDialogueChoice> Choices { get; } |
Answers for the current node after requirement filtering, in display order. |
bool HasChoices { get; } |
True when the listener must pick an answer; false when Continue applies. |
bool IsFinished { get; } |
True after the conversation ended by any route. |
bool HasContent { get; } |
True when there is something to show: a non-empty line or at least one answer. |
bool AppliesChanges { get; } |
True when this copy applies effects and quest actions itself; false on a predicting client, where the authority’s copy does. |
event Action<VtDialogueConversation> OnNodeChanged |
Fires after the shown node or its answers changed. |
event Action<VtDialogueConversation> OnEnded |
Fires once when the conversation ends. |
bool Choose(int index) |
Pick the answer at index. Applies its effects, then jumps or ends. Returns false when the conversation is over, the index is out of range, or the answer is locked. |
bool Continue() |
Advance past a node that has no answers: go to its next node or end. Returns false when the conversation is over or the node has answers that must be picked. |
void End() |
End the conversation from the UI, for example on Escape. |
void Refresh() |
Re-evaluate the current node’s answers, for example after the listener’s inventory changed while the window was open. |
VtDialogueChoice
Class.
One pickable answer in a running VtDialogueConversation, as the UI sees it. Authored answers carry their text; quest answers generated from the NPC’s offered list carry the quest and a Kind so the UI can label them “Accept” or “Turn in” in its own words.
Scripting API
| Member | Description |
|---|---|
int Index { get; } |
Position in VtDialogueConversation.Choices; pass to VtDialogueConversation.Choose. |
string Text { get; } |
Label to render. For quest answers this is the quest’s display name. |
bool IsAvailable { get; } |
False when the answer is shown locked; VtDialogueConversation.Choose refuses it. |
VtDialogueChoiceKind Kind { get; } |
Authored answer, or a generated quest accept / turn-in answer. |
VtDialogueAnswer Answer { get; } |
The authored answer behind this choice; null for generated quest answers. |
VtQuestDefinition Quest { get; } |
The quest behind a generated answer; null for authored answers. |
Enums
VtQuestDialogueAction
What a VtQuestDialogueEffect does with its quest.
| Value | Description |
|---|---|
Accept |
Add the quest to the log as active. |
TurnIn |
Turn in a completed quest and grant its rewards. |
Abandon |
Drop the quest from the log. |
VtDialogueChoiceKind
Where a VtDialogueChoice came from.
| Value | Description |
|---|---|
Authored |
An answer authored on the dialogue node. |
AcceptQuest |
Generated from the NPC’s offered quests: picking it accepts the quest. |
TurnInQuest |
Generated from the NPC’s offered quests: picking it turns the quest in. |