Reusing conversations

Announcements, support questions, and discussion for the Dialogue System.
lemonjolly_anna
Posts: 17
Joined: Tue May 16, 2023 11:41 pm

Reusing conversations

Post by lemonjolly_anna »

Hello again!

Is it possible to reuse conversations
  • in another database? (e.g. database_newyork and database_tokyo both share the conversation_alleywaygeneric)
  • in another conversation? (e.g. conversationA's node graph summons conversationB according to a condition met)
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Reusing conversations

Post by Tony Li »

Hi,

Yes, there are several ways to reuse conversations. Here are some notes:

> in another database? (e.g. database_newyork and database_tokyo both share the conversation_alleywaygeneric)

Not if you plan to have both databases loaded at the same time. See: Working With Multiple Databases.


> in another conversation? (e.g. conversationA's node graph summons conversationB according to a condition met)

Yes, you can link from one conversation to another. Inspect the node in conversationA. In the "Links To:" dropdown, select "(Another Conversation)". I recommend linking to the conversationB node after the <START> node, not the <START> node itself. Or set the <START> node's Sequence to "Continue()" (without quotes) if you want to link to the <START> node.


You can also reuse conversations for different characters. See: Character GameObject Assignments
lemonjolly_anna
Posts: 17
Joined: Tue May 16, 2023 11:41 pm

Re: Reusing conversations

Post by lemonjolly_anna »

Thanks!
Not if you plan to have both databases loaded at the same time.
Why's that?
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Reusing conversations

Post by Tony Li »

If you load both databases into memory at the same time, and if both of the databases have a separate conversation titled conversation_alleywaygeneric, the Dialogue system won't know which one you're referring to if you ask it to start the conversation 'conversation_alleywaygeneric'.
lemonjolly_anna
Posts: 17
Joined: Tue May 16, 2023 11:41 pm

Re: Reusing conversations

Post by lemonjolly_anna »

I see, thanks!

Is it possible to
  • 1) link from conversationA to conversationB,
  • 2) wait for a custom method/event/method or whatever,
  • 3) return to where you left off in conversationA
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Reusing conversations

Post by Tony Li »

Hi,
lemonjolly_anna wrote: Sun May 28, 2023 5:15 amIs it possible to
  • 1) link from conversationA to conversationB,
  • 2) wait for a custom method/event/method or whatever,
  • 3) return to where you left off in conversationA
Yes.

(1) To link from conversationA to conversationB, inspect a node in conversationA. From the "Links To:" dropdown, select "(Another Conversation)". It's generally best to select a node in conversationB that's not the <START> node.

(2) To wait for a custom method/event/whatever, use a sequencer command. For example, you can set a node's Sequence to:

Code: Select all

WaitForMessage(someMessage)
and then in a C# script call:

Code: Select all

PixelCrushers.DialogueSystem.Sequencer.Message("someMessage");
If you require the player to click a continue button to advance the conversation, instead of WaitForMessage() use:

Code: Select all

Continue()@(someMessage)
Or use a custom sequencer command that waits for something.

(3) To return where you left off, the easiest way is to link from a node in conversationB back to a node in conversationA. However, if you can link to conversationB from more than one node in conversationA, then you won't know ahead of time which node to return to. In this case, you'll need to use the conversation position stack. Before going to conversationB, your node in conversationA will call PushConversationPosition(). This will save the place in conversationA. The final node in conversationB can call PopConversationPosition() to return to that saved place.
lemonjolly_anna
Posts: 17
Joined: Tue May 16, 2023 11:41 pm

Re: Reusing conversations

Post by lemonjolly_anna »

Just testing this WaitForMessage stuff, and I feel like I'm missing something:
WaitForMessage1.jpg
WaitForMessage1.jpg (92.01 KiB) Viewed 381 times
WaitForMessage2.jpg
WaitForMessage2.jpg (67.66 KiB) Viewed 381 times
WaitForMessage3.jpg
WaitForMessage3.jpg (20.56 KiB) Viewed 381 times
The dialogue just continues to play on without waiting for "continueConversation" message.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Reusing conversations

Post by Tony Li »

Hi,

Are there any errors or warnings in the Console window?

Also, it looks like there might be some overlapping of link arrows. Are the nodes linked properly?
lemonjolly_anna
Posts: 17
Joined: Tue May 16, 2023 11:41 pm

Re: Reusing conversations

Post by lemonjolly_anna »

I'm getting this warning (and same for PushConversation):

Code: Select all

Dialogue System: Can't find any built-in sequencer command named PopConversationPosition() or a sequencer command component named SequencerCommandPopConversationPosition()
UnityEngine.Debug:LogWarning (object)
PixelCrushers.DialogueSystem.Sequencer:ActivateCommand (string,string,UnityEngine.Transform,UnityEngine.Transform,string[]) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:849)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand,string,bool,single,string,string,string[]) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:785)
PixelCrushers.DialogueSystem.Sequencer:PlayCommand (PixelCrushers.DialogueSystem.SequencerCommands.QueuedSequencerCommand) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:754)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence (string) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:688)
PixelCrushers.DialogueSystem.Sequencer:PlaySequence (string,bool,bool) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:698)
PixelCrushers.DialogueSystem.ConversationView:StartSubtitle (PixelCrushers.DialogueSystem.Subtitle,bool,bool) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:194)
PixelCrushers.DialogueSystem.ConversationController:GotoState (PixelCrushers.DialogueSystem.ConversationState) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:213)
PixelCrushers.DialogueSystem.ConversationController:OnFinishedSubtitle (object,System.EventArgs) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:271)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle () (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:428)
PixelCrushers.DialogueSystem.ConversationView:HandleContinueButtonClick () (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:400)
PixelCrushers.DialogueSystem.ConversationView:OnConversationContinue (PixelCrushers.DialogueSystem.IDialogueUI) (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:383)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinueConversation () (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:366)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnContinue () (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:356)
PixelCrushers.DialogueSystem.StandardUIContinueButtonFastForward:OnFastForward () (at Assets/_Other_Files/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Effects/StandardUIContinueButtonFastForward.cs:86)
UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)

I've added the ConversationPositionStack component onto the dialogue manager:
stack.jpg
stack.jpg (47.96 KiB) Viewed 349 times
The node was linking to two different things, but after sorting it still no dice!
Should be waiting on the wiggly pink line node.
stack2.jpg
stack2.jpg (150.12 KiB) Viewed 349 times

Here are where the pop and push are set up:
push.jpg
push.jpg (226.37 KiB) Viewed 349 times
pop.jpg
pop.jpg (165.23 KiB) Viewed 349 times
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Reusing conversations

Post by Tony Li »

Hi,

Sorry for the confusion -- PushConversationPosition() and PopConversationPosition() are Lua functions. If you move them to the Script field instead of the Sequence field they should work fine.
Post Reply