Interrupt a dialog with another

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ava
Posts: 17
Joined: Tue Oct 30, 2018 2:53 pm

Interrupt a dialog with another

Post by ava »

Hi

I'm looking for a good method to implement the following feature request I got:

We got some dialogs that can interrupt other dialogs, for that I added an extra check in the DialogueSystemTrigger.
The request is to play an "exit sentence" as in something like "Wait, what's that there" or "Did you see that" before starting the new dialogue.

Then later the interrupted dialog can be resumed, and then we need to insert a start sentence like "As I was saying..." or "Where were we? Ah yes,..."

What could be a good approach to try to accomplish this? I have a dedicated dialog containing all those "connect" sentences, but I'm looking for a good place in the code to insert them into the ongoing dialog.

Thanks for any help!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Interrupt a dialog with another

Post by Tony Li »

I think a good way -- at least for the way I manage my own content workflow -- is to keep the same conversation going, but use cross-conversation links. (Inspect a node, and from the "Links To:" dropdown select Another Conversation.)

So you can link from "Wait, what's that there" to a new conversation. And when you want to return to the original conversation, link from "As I was saying" to the original conversation.

For the return, instead of actually linking to the original conversation, you can use the Conversation Position Stack. This component, which you can add to the Dialogue Manager, has three functions that you can use in dialogue entry nodes' Script fields:
  • PushConversationPosition(): Saves the current conversation position.
  • PopConversationPosition(): Returns to the most recently saved conversation position.
  • ClearConversationPositionStack(): Forgets all saved conversation positions.
So in "Wait, what's that there" (or in the player's followup, such as "What? Where"), use PushConversationPosition().

In "As I was saying", use PopConversationPosition().

You can also call ConversationPositionStack.PushConversationPosition(), etc., in your own C# methods. But you can only call them while a conversation is active.

However, if you really want to stop the conversation after "Wait, what's that there" then the conversation position stack isn't a good fit. For example, you might want to stop the conversation to allow the player to run around in gameplay mode before resuming the conversation. In this case, you could set up a variable to remember what the NPC was talking about before the conversation ended. Then in your second Dialogue System Trigger (to resume the conversation), choose a branch based on the variable. You can still use cross-conversation links to link from your "connect" sentence conversation to where you want to pick up from.
ava
Posts: 17
Joined: Tue Oct 30, 2018 2:53 pm

Re: Interrupt a dialog with another

Post by ava »

Allright, super, thanks for your help, I'll try to implement this and report back.
Post Reply