Page 1 of 1

Deleting lines after one trigger

Posted: Mon Mar 20, 2017 2:26 pm
by manlyghostcake
Hi!
I'm new to this dialogue system, and it's working great for me so far.
I just couldn't figure out yet how to change the dialogue after it's been completed, i. e. I want to delete the lines I already talked through.

I normally have a dialogue with a few "side exits", so you can end it before it's completed. I don't want to repeat it though. I want it to start exactly where I left off.

Is that possible, and how would I go about it? Thanks for your help (:

Re: Deleting lines after one trigger

Posted: Mon Mar 20, 2017 7:46 pm
by Tony Li
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:

Image

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:

Image

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!

Re: Deleting lines after one trigger

Posted: Tue Mar 21, 2017 5:28 am
by manlyghostcake
Thanks for the quick reply! This took me a big step further :D

Two questions though:
After a few tests I've always been able to get away with the "Untouched" state. It looks like it only checks for "untouched" once and then assumes the lines have been used. Why would I even need the other two states? Did I misunderstand something?
EDIT: Ok, I just realized it's more complicated than that. Give me a few days to work through this, maybe then I'll understand it better.

On another note, I would love to take it one step further and trigger changes in the dialogue via c# script/use dialogue to execute scripts, so I can create a link between the dialogue and all other mechanics in my game. But I'm not sure how to access the dialogue system. Maybe the built-in features would do the job just as well, I just feel that c# comes more natural to me.

Re: Deleting lines after one trigger

Posted: Tue Mar 21, 2017 9:16 am
by Tony Li
Hi,
manlyghostcake wrote:EDIT: Ok, I just realized it's more complicated than that. Give me a few days to work through this, maybe then I'll understand it better.
You may need to know that Conversations Evaluate Condition One Level Ahead, which is on the More on Conditions page. (The link has an example with pictures.)
manlyghostcake wrote:On another note, I would love to take it one step further and trigger changes in the dialogue via c# script/use dialogue to execute scripts, so I can create a link between the dialogue and all other mechanics in my game. But I'm not sure how to access the dialogue system. Maybe the built-in features would do the job just as well, I just feel that c# comes more natural to me.
The Dialogue System lets you register your own C# code as Lua functions for just this purpose. In fact, that's what all the third-party support packages do.

You can also write custom sequencer commands.

Conceptually, I think of Lua functions as manipulating data (including data in your non-Dialogue System gameplay mechanics) whereas sequencer commands control what's shown/heard during conversations (camera cuts, audio, animation, etc.). But you can mix and match as you see fit.