Pause a conversation in the dialogue
-
- Posts: 5
- Joined: Wed Jun 22, 2022 11:52 pm
Pause a conversation in the dialogue
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
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
Re: Pause a conversation in the dialogue
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:
In your inventory system, when the player uses an item use this C# code:
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:
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)
Code: Select all
PixelCrushers.DialogueSystem.Sequencer.Message("UsedItem");
Code: Select all
SetDialoguePanel(false);
SetDialoguePanel(true)@Message(UsedItem)
-
- Posts: 5
- Joined: Wed Jun 22, 2022 11:52 pm
Re: Pause a conversation in the dialogue
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.
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 (680.52 KiB) Viewed 1336 times
-
- code.png (8.39 KiB) Viewed 1336 times
Re: Pause a conversation in the dialogue
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:
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)
-
- Posts: 5
- Joined: Wed Jun 22, 2022 11:52 pm
Re: Pause a conversation in the dialogue
Yes, it is. If I deactivate it in the editor, it disappears normally.
- Attachments
-
- setting.png (10.75 KiB) Viewed 1328 times
-
- panel.png (8.79 KiB) Viewed 1328 times
Re: Pause a conversation in the dialogue
Hmm, I assigned the WRPG UI to DemoScene1 and set Private Hart's first node sequence to:
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.
Code: Select all
Camera(Closeup); {{default}};
SetDialoguePanel(false)@1;
SetDialoguePanel(true)@4;
Delay(6)
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.
-
- Posts: 5
- Joined: Wed Jun 22, 2022 11:52 pm
Re: Pause a conversation in the dialogue
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?
I know there is pause and unpause method in the dialogue manager class, but how can I call it in Sequence?
Re: Pause a conversation in the dialogue
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:
Then show your inventory system. After the player has used an item:
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();
Code: Select all
DialogueManager.StartConversation(DialogueManager.lastConversationStarted, DialogueManager.currentActor, DialogueManager.currentConversant, currentEntryID);
-
- Posts: 5
- Joined: Wed Jun 22, 2022 11:52 pm
Re: Pause a conversation in the dialogue
I used the sequencer and it worked well.
Thank you, Tony!
Thank you, Tony!
Re: Pause a conversation in the dialogue
Happy to help!