Pause a conversation in the dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
luffyklose
Posts: 5
Joined: Wed Jun 22, 2022 11:52 pm

Pause a conversation in the dialogue

Post by luffyklose »

Hi Tony,

I'm using the dialogue system and quest machine to develop my game, they really help a lot.
But I have a question about the dialogue system. There's a conversation and I want to pause it to find and use some items in the inventory system and resume after that. How can I make it using cutscene and continue the conversation after using the items?

I think I need add some script in the dialogue system to pause it and bind an event to recover.

Thanks
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Pause a conversation in the dialogue

Post by Tony Li »

Hi,

One way is to hide the dialogue UI. You can disable the dialogue UI's Canvas or use the SetDialoguePanel() sequencer command. For example, in the dialogue entry node where you want to hide the dialogue UI, use the command SetDialoguePanel(false) and wait for a message from your inventory system:

Code: Select all

SetDialoguePanel(false);
required SetDialoguePanel(true)@Message(UsedItem);
Continue()@Message(UsedItem)
In your inventory system, when the player uses an item use this C# code:

Code: Select all

PixelCrushers.DialogueSystem.Sequencer.Message("UsedItem");
Note: The sequence above handles continue button modes. If you don't require the player to click a continue button, you can simplify it to:

Code: Select all

SetDialoguePanel(false);
SetDialoguePanel(true)@Message(UsedItem)
luffyklose
Posts: 5
Joined: Wed Jun 22, 2022 11:52 pm

Re: Pause a conversation in the dialogue

Post by luffyklose »

Hi Tony,

I used these code but didn't work, the text is hidden but the UI is still there. The dialogue UI object is still active.
Attachments
game.png
game.png (680.52 KiB) Viewed 1339 times
code.png
code.png (8.39 KiB) Viewed 1339 times
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Pause a conversation in the dialogue

Post by Tony Li »

Is your background image part of the Dialogue Panel hierarchy?

If not, you can use SetEnabled() instead of SetDialoguePanel().

1. Give a unique name to your dialogue UI's canvas, such as "DialogueCanvas".

2. Disable and enable the canvas:

Code: Select all

SetEnabled(Canvas, false, DialogueCanvas);
SetEnabled(Canvas, true, DialogueCanvas)@Message(UsedItem)
luffyklose
Posts: 5
Joined: Wed Jun 22, 2022 11:52 pm

Re: Pause a conversation in the dialogue

Post by luffyklose »

Yes, it is. If I deactivate it in the editor, it disappears normally.
Attachments
setting.png
setting.png (10.75 KiB) Viewed 1331 times
panel.png
panel.png (8.79 KiB) Viewed 1331 times
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Pause a conversation in the dialogue

Post by Tony Li »

Hmm, I assigned the WRPG UI to DemoScene1 and set Private Hart's first node sequence to:

Code: Select all

Camera(Closeup); {{default}};
SetDialoguePanel(false)@1;
SetDialoguePanel(true)@4;
Delay(6)
and it properly hides and shows the dialogue UI.

Two options:

1. Use SetEnabled() instead, as described above.

2. Or send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look and let you know what I find.
luffyklose
Posts: 5
Joined: Wed Jun 22, 2022 11:52 pm

Re: Pause a conversation in the dialogue

Post by luffyklose »

The other problem is that I hide it using SetEnabled(Canvas, false, DialogueCanvas);, but the dialogue doesn't stop because I set it automatically.

I know there is pause and unpause method in the dialogue manager class, but how can I call it in Sequence?
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Pause a conversation in the dialogue

Post by Tony Li »

Hi,

Make sure your sequence is configured to wait for a sequencer message from your inventory system. See the @Message(UsedItem) part of the example sequences above.

Another way to handle this is to record the current dialogue entry ID and then stop the conversation entirely. After the player has used an item, start the conversation from the recorded dialogue entry ID. For example:

Code: Select all

// C# code:
int currentEntryID;
...
currentEntryID = DialogueManager.currentConversationState.subtitle.dialogueEntry.id;
DialogueManager.StopConversation();
Then show your inventory system. After the player has used an item:

Code: Select all

DialogueManager.StartConversation(DialogueManager.lastConversationStarted, DialogueManager.currentActor, DialogueManager.currentConversant, currentEntryID);
luffyklose
Posts: 5
Joined: Wed Jun 22, 2022 11:52 pm

Re: Pause a conversation in the dialogue

Post by luffyklose »

I used the sequencer and it worked well.

Thank you, Tony!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Pause a conversation in the dialogue

Post by Tony Li »

Happy to help!
Post Reply