Hi!
Thanks for using the Dialogue System!
The typical way to do this in branching dialogue systems is to record information as the conversation progresses. When you return to the conversation, use conditions to jump to a specific branch based on the information you've recorded.
The Dialogue System provides two ways to do this.
The first is to use SimStatus. (For lots of info about SimStatus, see
here.) SimStatus is an optional feature that records the state of each dialogue entry node. The state can be:
- Untouched: Not used yet.
- WasOffered: Was shown in a player response menu, but was not clicked by the player.
- WasDisplayed: Was "spoken" (completed).
To use the SimStatus feature, inspect the Dialogue Manager GameObject and tick
Include Sim Status. Then you can set up a conversation with Conditions like this:
Both Conditions check the SimStatus value of dialogue entry #1. (You can get the ID number of a dialogue entry by inspecting it. In this example, dialogue entry #1 is "Hello!") If the SimStatus is Untouched, it plays "Hello!" (which is when the NPC first meets the player). Otherwise, if the SimStatus is WasDisplayed, it re-greets the player with "Hi, Pete!"
Note that, although the Conditions are expressed in text code, you don't actually have to type text into the Conditions field. You can click the "..." button to get a dropdown menu to specify the conditions you want to apply to the dialogue entry.
SimStatus is handy and built-in. But it has two drawbacks you may want to consider:
1. It uses ID numbers, which aren't very intuitive.
2. Since it stores this information for every dialogue entry, it can use a lot of memory if you have a
lot of content. But we're talking thousands and thousands of lines of dialogue for it to really become something to think about.
--------
An alternative that a lot of people go with is to use variables. You can define variables on the Dialogue Editor's Variables page. Here's an example conversation that uses a variable named
Met_NPC:
In this conversation, the "Hello!" entry has a Script field that sets the variable to true. (Assume you've set the initial value to false on the Variables page.)
The other dialogue entry ("Hi, Pete!") has Conditions that Met_NPC is true. But the link to this node is also set to a higher priority level. (To set the priority, click on the link and then select the priority value in the inspector.) Since it has a higher priority, the Dialogue System will check this dialogue entry first. If the Conditions are true, it will choose it. Otherwise it will fall back to the "Hello!" entry.
I realize I just typed a big wall of text, but I wanted to make sure you're well equipped with all the options you might want to take advantage of. If you have questions about any of this, just let me know!