Pause and resume after user action

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lordzeon
Posts: 12
Joined: Mon Feb 26, 2024 5:06 pm

Pause and resume after user action

Post by lordzeon »

Hi, i have a minigame that player should play after a dialogue choice. After selection i need to:
1) hide the dialogue (to do the minigame)
2) after minigame completion resume the dialogue
3) the next dialogue line is changed based on minigame

so far i was only able to hide the dialogue, but when i resume the dialogue seting Canvas active or with DialogueManage.SetDialoguePanel(true,true), NPC line appear (last entry before player choices) but player choices don´t

for the third part i already have the OnConversationResponseMenu to change the answer, i understand i need to add a intermediate node to change the response, so how do i continue from code once i need to advance the conversation based on minigame? so that intermediate node don't show
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Pause and resume after user action

Post by Tony Li »

Hi,

I recommend doing this without an OnConversationResponseMenu method. There may be no need for scripting, at least on the Dialogue System side. You can set up your conversation similarly to this:

minigame.png
minigame.png (37.07 KiB) Viewed 195 times

The conversation above assumes your minigame sets the Dialogue System variable "Won" to true or false and then sends the sequencer message "MinigameEnded". For example:

Code: Select all

public void EndMinigame(bool didPlayerWin)
{
    DialogueLua.SetVariable("Won", didPlayerWin);
    Sequencer.Message("MinigameEnded");
}
If you also need to prevent the Dialogue System from stealing UI focus or input (which you shouldn't need to do since the dialogue UI is inactive), you can set UIPanel.monitorSelection and UIButtonKeyTrigger.monitorInput false as described in How To: Pause Dialogue In Pause Menu.
lordzeon
Posts: 12
Joined: Mon Feb 26, 2024 5:06 pm

Re: Pause and resume after user action

Post by lordzeon »

I will say im impressed by the quality of the response, Dialogue System for Unity is a bit intimidating but the power is unlimited.

This worked great! i have to use OnConversationResponseMenu because choices are not fixed depend on minigame result. Based on that, i tried another approach with the minigame as dialogue options.... it did work somehow with a ton of conditions and variables, but i wasn't able to add or completelly remove a dialogue entry (not change or disable, but make it disappear), is that possible from OnConversationResponseMenu or i should use another for this case:
- from OnConversationResponseMenu i change marked answers for custom answers
- i had to make more entries than potential custom answers, so i either have to disable the ones i dont want, or duplicate a entry one time for each custom response
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Pause and resume after user action

Post by Tony Li »

Hi,

OnConversationResponseMenu(Response[]) assumes the number of responses will not change.

Instead of using OnConversationResponseMenu(), you could make a subclass of StandardDialogueUI and override the ShowResponses() method to change the list of responses that it passes to the menu panel. To retain UI element assignments when replacing the StandardDialogueUI component with your subclass, see this post.
Post Reply