Send Dialog via Script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
junwi21
Posts: 35
Joined: Wed Jan 27, 2021 12:18 am

Send Dialog via Script

Post by junwi21 »

Say I have a dialogue open, is there a way I can interrupt what's currently displayed and display some other text instead via script? I don't want it to instantly appear.
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Send Dialog via Script

Post by Tony Li »

Hi,

Yes; here are some ways to do it:

1. Directly change the text that's shown in a subtitle panel's subtitle text UI element. Example:

Code: Select all

var subtitleText = DialogueManager.standardDialogueUI.conversationUIElements.defaultNPCSubtitlePanel.subtitleText;
subtitleText.text = "This is new text.";
or, to type it using the typewriter effect:

Code: Select all

var panel = DialogueManager.standardDialogueUI.conversationUIElements.defaultNPCSubtitlePanel;
panel.GetTypewriter().StartTyping("This is new text.");

2. Or redirect the conversation to a different dialogue entry:

Code: Select all

var newDialogueEntry = DialogueManager.masterDatabase.GetDialogueEntry(conversationID, entryID);
var newState = DialogueManager.conversationModel.GetState(newDialogueEntry);
DialogueManager.conversationController.GotoState(newState);

3. Or create a fake Subtitle object and show it:

Code: Select all

var subtitle = new Subtitle(speakerInfo, listenerInfo, new FormattedText.Parse("This is new text."), sequence, "", null);
DialogueManager.standardDialogueUI.ShowSubtitle(subtitle);
Post Reply