[HOWTO] Conversation Execution Order

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 22142
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] Conversation Execution Order

Post by Tony Li »

Starting Conversation
  • When a conversation starts, it first creates an initial model of the conversation by processing all links from the conversation's <START> node. It will call OnConversationPrepareLine on each node linked from <START>.
  • If the initial model has at least one node that's currently valid, it will start the conversation, and OnConversationStart will be called.
Showing Subtitle
This is the order of operations when a conversation shows a subtitle:
  • To arrive at a node, the Dialogue System has previously evaluated the Conditions fields of all nodes linked from the current node, starting with links at the highest priority level and going down from there. When it finds one or more nodes with true Conditions at a priority level, it stops evaluating at that level; it does not evaluate nodes at lower priorities. While evaluating Conditions, it also calls the DialogueManager.IsDialogueEntryValid delegate on the nodes if a method is assigned to the delegate.
  • If there is at least one NPC node whose Conditions are true, it will choose the first NPC node whose conditions are true.
  • OnPrepareConversationLine is called.
  • The node's Script field runs.
  • The node's OnExecute() events run.
  • The node's outgoing links are checked. (This is the step described in the first bullet point above.) This means the linked nodes' Conditions are evaluated. We evaluate them now because, for certain continue button modes, we need to know what's coming next.
  • If the link to the node crossed from one conversation to another, OnLinkedConversationStart is called.
  • The Dialogue System generates a Subtitle object for the current node. The Subtitle's formattedText contains the processed version of the node's Dialogue Text. For example, markup tags such as [var=variable] have been processed.
  • OnConversationLine is called. You can change the values of the Subtitle object's formattedText and sequence properties.
  • The conversation's ConversationView tells the dialogue UI to display the node's text.
  • The conversation's ConversationView tells the sequencer to play the sequence.
Post Reply