Page 1 of 1

Easy way to display some runtime content in the UI controlled by dialogue system?

Posted: Tue Feb 27, 2024 7:07 am
by hyf4053
Hi, I would like to know if there is any easy way to manage some runtime content to display in the StandardDialogueUI.

The situation is like this:
1. The player talks to the NPC.
2. Somehow the player triggers a battle in the conversation.
3. As the battle is designed in pure words, I wonder if is there any way to use the conversation UI to continue displaying the battle content. (Like "Sheep Use Skill XXXX") Also, after the player chooses the skill they want to use, the information will be recorded in the Conversation UI because I want the player to see the whole battle history. (Like "Player Use Skill XXXX")

Thank you in advance.

Re: Easy way to display some runtime content in the UI controlled by dialogue system?

Posted: Tue Feb 27, 2024 9:36 am
by Tony Li
Hi,

Here are two ideas:

1. Incorporate the battle text into your conversation tree so it runs as normal as part of the conversation. This is what Disco Elysium and Clam Man do, for example. It's a better approach IMO because all of the text and logic is in one place.

2. However, if the text must come from a source that's external to the conversation tree, you can create a Subtitle object in C# and send it to DialogueManager.standardDialogueUI.ShowSubtitle(Subtitle). Example:

Code: Select all

// Let's say the speaker will be the conversation's main conversant (typically the NPC):
CharacterInfo speakerInfo = DialogueManager.conversationModel.conversantInfo;
// And the listener will be the conversation's main actor (typically the Player):
CharacterInfo listenerInfo = DialogueManager.conversationModel.actorInfo;
// Here's the text we'll show:
FormattedText formattedText = FormattedText.Parse("The sheep uses skill XXX and hits you with its horns for 3 damage.");
// No need for a sequence or response menu sequence:
string sequence = "";
string responseMenuSequence = "";
// A Subtitle has a reference to a dialogue entry. We'll just refer to the conversation's current entry:
DialogueEntry dialogueEntry = DialogueManager.currentConversationState.subtitle.dialogueEntry;
// Create the subtitle object:
Subtitle subtitle = new Subtitle(speakerInfo, listenerInfo, formattedText, sequence, responseMenuSequence, dialogueEntry);
// And send it to the dialogue UI to be displayed:
DialogueManager.standardDialogueUI.ShowSubtitle(subtitle);

Re: Easy way to display some runtime content in the UI controlled by dialogue system?

Posted: Mon Mar 04, 2024 1:58 am
by hyf4053
Tony Li wrote: Tue Feb 27, 2024 9:36 am Hi,

Here are two ideas:

1. Incorporate the battle text into your conversation tree so it runs as normal as part of the conversation. This is what Disco Elysium and Clam Man do, for example. It's a better approach IMO because all of the text and logic is in one place.

2. However, if the text must come from a source that's external to the conversation tree, you can create a Subtitle object in C# and send it to DialogueManager.standardDialogueUI.ShowSubtitle(Subtitle). Example:

Code: Select all

// Let's say the speaker will be the conversation's main conversant (typically the NPC):
CharacterInfo speakerInfo = DialogueManager.conversationModel.conversantInfo;
// And the listener will be the conversation's main actor (typically the Player):
CharacterInfo listenerInfo = DialogueManager.conversationModel.actorInfo;
// Here's the text we'll show:
FormattedText formattedText = FormattedText.Parse("The sheep uses skill XXX and hits you with its horns for 3 damage.");
// No need for a sequence or response menu sequence:
string sequence = "";
string responseMenuSequence = "";
// A Subtitle has a reference to a dialogue entry. We'll just refer to the conversation's current entry:
DialogueEntry dialogueEntry = DialogueManager.currentConversationState.subtitle.dialogueEntry;
// Create the subtitle object:
Subtitle subtitle = new Subtitle(speakerInfo, listenerInfo, formattedText, sequence, responseMenuSequence, dialogueEntry);
// And send it to the dialogue UI to be displayed:
DialogueManager.standardDialogueUI.ShowSubtitle(subtitle);
Thank you Tony that will be helpful.

And one more question, I would like to also display the player choose button text display on the UI, instead of disappearing with the button after chosen. Is there any one-node way to do this? Currently, I just use another node after the player's chosen node.

Re: Easy way to display some runtime content in the UI controlled by dialogue system?

Posted: Mon Mar 04, 2024 9:31 am
by Tony Li
Hi,
hyf4053 wrote: Mon Mar 04, 2024 1:58 amAnd one more question, I would like to also display the player choose button text display on the UI, instead of disappearing with the button after chosen. Is there any one-node way to do this? Currently, I just use another node after the player's chosen node.
On the Dialogue Manager GameObject, tick Display Settings > Subtitle Settings > Show PC Subtitles During Line, and UNtick Skip PC Subtitle After Response Menu. Screenshot in this post.