How to return to previous node without text being typed again
Posted: Tue Dec 08, 2020 1:43 pm
by EntertainmentForge
How can I return to previous dialogue node without it's text being typed again (or voice over being repeated)?
Here's a short video to clarify:
Re: How to return to previous node without text being typed again
Posted: Tue Dec 08, 2020 2:00 pm
by Tony Li
Hi,
To do it without scripting, you can set up two versions of the node: one version to show when first entering the conversation, and a second version to show without the typewriter effect when looping back. To skip the typewriter effect and VO, put Continue()@0.01 in the Sequence field. Example:
repeatWithoutVO.png (47.18 KiB) Viewed 325 times
Re: How to return to previous node without text being typed again
Posted: Tue Dec 08, 2020 4:10 pm
by EntertainmentForge
Thanks for quick replay!
If I did it that way it would complicate things a bit. Translators would get double text as well as voice actors.
I'd rather solve it with code. Do maybe Nodes know to what other nodes they are linked to? So one Node can tell the other Node to change it's sequence to "Continue()@0.01".
Again a video to clarify if needed:
Re: How to return to previous node without text being typed again
Posted: Tue Dec 08, 2020 4:21 pm
by Tony Li
If you needed to do this everywhere, I'd recommend using SimStatus. However, most nodes will not need this, so you don't need to add the extra memory requirement and extra saved game size of SimStatus.
Instead, I'll propose a different solution. Here is the basic idea:
1. The "I humbly apologize..." node will set a variable to remember that it has been displayed.
2. When the node is used, it will check this variable. If the variable has been set, it will change the Sequence to: Continue()@0.01.
---
To do this, add a Text field to your dialogue entry template. For example, call it "DisplayedVariable".
In the "I humbly apologize..." node, set the DisplayedVariable field to a value of your choice such as "Displayed.RepresentativeAsked".
Add a script to the Dialogue Manager that has an OnConversationLine method. In this method, check if the current node has a DisplayedVariable value. If so, check the variable. If the variable is false, set it true. If the variable is true, change the Sequence. Example:
public class SkipEffectsOnDisplayedNodes : MonoBehaviour
{
void OnConversationLine(Subtitle subtitle)
{
// Check if the current subtitle's dialogue entry node has a DisplayedVariable:
var displayedVariable = Field.LookupValue(subtitle.dialogueEntry.fields, "DisplayedVariable");
if (string.IsNullOrEmpty(displayedVariable)) return;
if (DialogueLua.GetVariable(displayedVariable).asBool == false)
{ // This is the first time. Set the variable true:
DialogueLua.SetVariable(displayedVariable, true);
}
else
{ // Otherwise change the sequence:
subtitle.Sequence = "Continue()@0.01";
}
}
}
Re: How to return to previous node without text being typed again
Posted: Tue Dec 08, 2020 9:08 pm
by EntertainmentForge
Thanks a lot, Tony! This solved the issue.
But it created one more small problem:
Re: How to return to previous node without text being typed again
Posted: Tue Dec 08, 2020 9:33 pm
by Tony Li
Hi,
I think you should be able to adjust the menu panel's Animator so it cuts the hide animation short if it needs to be shown again. If you can't get that to work for some reason, you could make a subclass of StandardUIMenuPanel and override the HideResponses method to wait one or two frames. If ShowResponses() is called again in in one or two frames, don't hide. Otherwise hide.