I have a question.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
swang
Posts: 19
Joined: Sat May 13, 2023 10:28 pm

I have a question.

Post by swang »

1. When the last script is played, I want the code to signal that the conversation is over. Is there a way?

2. I want to change the database of the dialog system to code. Please teach me the way.
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: I have a question.

Post by Tony Li »

swang wrote: Wed Jun 21, 2023 5:28 am1. When the last script is played, I want the code to signal that the conversation is over. Is there a way?
You can use an OnConversationEnd() method, or DialogueManager.instance.conversationEnded C# event, or Dialogue System Events component > OnConversationEnd() UnityEvent.
swang wrote: Wed Jun 21, 2023 5:28 am2. I want to change the database of the dialog system to code. Please teach me the way.
If you only want to change variables and quest states, you can do that inside conversations -- for example, using the Script field -- or in C# using DialogueLua.SetVariable() and QuestLog.SetQuestState().

If you want to create new conversations, see: How To: Create Dialogue Database At Runtime
swang
Posts: 19
Joined: Sat May 13, 2023 10:28 pm

Re: I have a question.

Post by swang »

Can you bring the name of the character you are currently talking about?


It doesn't work well because I write it like this in update ().
string name = this.GetComponent<StandardUISubtitlePanel>().portraitActorName;
Debug.Log(name);
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: I have a question.

Post by Tony Li »

Hello,

Try:

Code: Select all

string name = DialogueLua.GetVariable("Conversant").asString;
Debug.Log(name);
If the character is the conversation's Actor, use DialogueLua.GetVariable("Actor").asString instead.
Post Reply