Show continue button ONLY at end of conversation
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Show continue button ONLY at end of conversation
I'd like to make all of my conversations end only when the player clicks the "continue" button. I don't want that button to show up otherwise, only at the end of conversations.
I couldn't find an option or a sequencer command to do that. I understand how to turn it on and off, but I'm looking for something like a global setting in the Dialog Manager. Does it exist and I just missed it?
(why? because I want that the player has the option to read back through the conversation, or think about it or whatever he wants before gameplay continues. It shouldn't go automatically back to gameplay. Maybe the player is a slow reader or something.)
I couldn't find an option or a sequencer command to do that. I understand how to turn it on and off, but I'm looking for something like a global setting in the Dialog Manager. Does it exist and I just missed it?
(why? because I want that the player has the option to read back through the conversation, or think about it or whatever he wants before gameplay continues. It shouldn't go automatically back to gameplay. Maybe the player is a slow reader or something.)
Re: Show continue button ONLY at end of conversation
Hi,
There's no built-in option. But you can add a script to the Dialogue Manager to set the continue button mode. Something like:
There's no built-in option. But you can add a script to the Dialogue Manager to set the continue button mode. Something like:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class RequireContinueButtonOnLastNode : MonoBehaviour
{
private bool isFirstNode = false;
void OnConversationStart(Transform actor) { isFirstNode = true; }
void OnConversationLine(Subtitle subtitle)
{
var isLastNode = !DialogueManager.currentConversationState.hasAnyResponses;
if (isLastNode)
{
// Turn on continue button mode on last node:
subtitle.sequence = "SetContinueMode(true); " + subtitle.sequence;
}
else if (isFirstNode)
{
// Turn off continue button mode when conversation starts:
subtitle.sequence = "SetContinueMode(false); " + subtitle.sequence;
isFirstNode = false;
}
}
}
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Re: Show continue button ONLY at end of conversation
Finally got around to testing this and it seems to be working well... mostly.
It does seem to skip the first line of dialog (it appears, but instantly, no typewriter effect or waiting, I'll have to try with audio/voice file to check if that has an effect). It also shows up when the last conversation line is the player picking a dialog option (usually some variation of "thanks, goodbye"), which I didn't think about.
I'll be thinking about this again. I can go from here, I think. Checking if the speaker is the player should take care of my new problem, I think. The skipping is maybe an artifact of setting the continue mode?
It does seem to skip the first line of dialog (it appears, but instantly, no typewriter effect or waiting, I'll have to try with audio/voice file to check if that has an effect). It also shows up when the last conversation line is the player picking a dialog option (usually some variation of "thanks, goodbye"), which I didn't think about.
I'll be thinking about this again. I can go from here, I think. Checking if the speaker is the player should take care of my new problem, I think. The skipping is maybe an artifact of setting the continue mode?
Re: Show continue button ONLY at end of conversation
Hi,
For the case where the last node is a player option, you can change this:
to this:
There could be different reasons for the first line skipping. One solution is to change this line:
to this:
This will delay for a duration based on the text length.
For the case where the last node is a player option, you can change this:
Code: Select all
if (isLastNode)
Code: Select all
if (isLastNode && Subtitle.speakerInfo.isNPC)
Code: Select all
subtitle.sequence = "SetContinueMode(false); " + subtitle.sequence;
Code: Select all
subtitle.sequence = "SetContinueMode(false); Delay({{end}}); " + subtitle.sequence;
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Re: Show continue button ONLY at end of conversation
works brilliantly, thanks.
Just one fix:
should be:
Just one fix:
Code: Select all
if (isLastNode && Subtitle.speakerInfo.isNPC)
Code: Select all
if (isLastNode && subtitle.speakerInfo.isNPC)
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Re: Show continue button ONLY at end of conversation
That works wonderfully. Thank you so much!
Re: Show continue button ONLY at end of conversation
Happy to help!