Branching Conversation Trees

Here are a few simple ways to get branched dialog in the neatest and quickest way. This guide is assuming you have already gone over the basics of the conversation editor in Working With Conversations and Interactions.

## Branched Loop w/ Voice

This is a simple and quick way to insert voice into a scene where it may not be necessary, but still appears seamless to the player and lets the NPC respond accordingly to their choices. As you can see below, each player voice leads to a unique response, but each of those responses flows back into a singular blue EMPTY LINE node. This empty node contains the next set of player responses, all written as though they can be a response to either of the three NPC responses. Because this node is empty, whatever the NPC said last will be what the player views as what they’re responding to.

Here’s what constructing this will look like in the editor:

As you see here, the NPC greets the player, and the player has a choice of initial response appropriate to the voice they want to use. The NPC responds differently to each voice, but this NPC is intended to drop some information on you about Lone Star and the Cutters, which will come out no matter what type of character the player is. Once this conversation ends, the NPC should either be disabled or have an alternate tree at the root for revisits.

NOTE: If you'd like to have an NPC use the PC's name in conversation, use the following command in place of where you'd normally put the PC's name:
$(l.name)

To build a redirect link, click on the DESTINATION node (in this case, the EMPTY LINE) click the “copy” button. Then click the SOURCE (in this case, the empty chain node) and press the “paste as link” button.

Note: This should not be taken to mean that every branch results in the same outcome. At any point during these loops, you can introduce a true branch, where all the dialog beyond that is unique, or other results occur.

## Whittling Question List (Interrogation)

Here’s another simple one.

The NPC has a greet, which leads to an empty link which leads to an [EMPTY LINE] node. All of the questions the player can ask of this NPC are linked to this empty line which you can think of as the ‘question hub.’

The questions that the player can ask are all checked “Available only once” (box below the text input field). On each question node, also check “Hide if Unavailable”.

Here’s what an interrogation tree looks like in the editor:

Make sure that the questions here are not written as a response to the NPC greet. Because each time a question is asked it loops back to the question hub, they need to remain without context. Each time you ask a question and get the answer, you’ll come back to the hub with one less thing to ask until the only thing you can say is “Goodbye.”

Each line of questioning can go on for as long as needed, with a back and forth between the player and NPC, as long as it has a clear end point so that the player isn’t confused when they end up back at the question hub.

Note: Within each line of questioning, you can even use a branched loop tree as in the first tutorial to integrate player voices into the process.

## Self Disabling NPCs

NPCs acting as Question Hubs should usually “self-disable” when the questions are exhausted.
To do this easily, create an int variable called something like “countPersonQuestions”. On each question link, create an action of “Add to variable (int)” to add 1. Then, on the prop interaction editor, create a Prerequisite for interaction which is “comparison (int)” and set it to “if countPersonQuestions is less than (x)” where x is the number of questions that you can ask of them. Now, once you have finished asking all the questions the person will not be interactive anymore, so you won’t have the stub conversation of “What’s up?” -> “I should go.” being infinitely repeatable.