Page 1 of 1

Send Dialog via Script

Posted: Sun Aug 28, 2022 4:32 am
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.

Re: Send Dialog via Script

Posted: Sun Aug 28, 2022 8:30 am
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);