Page 1 of 1
I have a question.
Posted: Wed Jun 21, 2023 5:28 am
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.
Re: I have a question.
Posted: Wed Jun 21, 2023 8:01 am
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
Re: I have a question.
Posted: Thu Jun 22, 2023 3:25 am
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);
Re: I have a question.
Posted: Thu Jun 22, 2023 8:45 am
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.