Page 1 of 1

Completing the prior subtitle text with current response?

Posted: Sun Oct 18, 2020 10:02 pm
by fkkcloud
Hello,
11111111.png
11111111.png (25.7 KiB) Viewed 376 times
I have something like this above and want to complete the single player subtitle's latter part with the response that I have.'
What is best solution for it?

Re: Completing the prior subtitle text with current response?

Posted: Mon Oct 19, 2020 10:14 am
by Tony Li
Hi,

You can define a custom Boolean field for your dialogue entries, such as "AddToNext". In the "I mean..." node, set the field to True.

Then add a script to the Dialogue Manager that has an OnConversationLine method. Something like:

Code: Select all

private string textToAdd = string.Empty;

void OnConversationLine(Subtitle subtitle)
{
    subtitle.formattedText.text = textToAdd + subtitle.formattedText.text;
    textToAdd = Field.LookupBool(subtitle.dialogueEntry.fields, "AddToNext") ? subtitle.formattedText.text : string.Empty;
}
This method will check if AddToNext is true. If so, it will remember the subtitle's text and add it to the next subtitle.

Re: Completing the prior subtitle text with current response?

Posted: Tue Oct 20, 2020 4:45 am
by fkkcloud
Hi,

Is it possible to add it to the previous one?
For instance,

"I mean.." actually stays longer than those 2 responses. After I click on either of that, it will change the previous node which is "I mean..." to "I mean.. you are fine".

Since the "I mean.." node disappear after those 2 responses disappear, it will be much natural for the conversation flow.

Re: Completing the prior subtitle text with current response?

Posted: Tue Oct 20, 2020 9:46 am
by Tony Li
Here's a small example scene using the script above. It was made in Unity 2020.1.

DS_AddToNextExample_2020-10-20.unitypackage