Get Conversation text only

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
windwalking
Posts: 6
Joined: Tue Mar 26, 2024 6:31 am

Get Conversation text only

Post by windwalking »

Hello!

I have a part of my game where just one line shows up in the middle of the screen. I want to get that random text from a similar structure as barks. I guess my question is, can I get only the string from a conversation directly in script?
User avatar
Tony Li
Posts: 22100
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get Conversation text only

Post by Tony Li »

Hi,

Yes, you can create a ConversationModel. Assuming the line is assigned to an NPC:

Code: Select all

var model = new ConversationModel(DialogueManager.masterDatabase, "conversation title", null, null, true, null);
var state = model.GetState(model.firstState.firstNPCResponse);
Debug.Log("Text is " + state.subtitle.formattedText.text);
Post Reply