About Dialogue Actor component

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

CHOPJZL wrote: Wed Mar 10, 2021 10:06 amHow to set the Actor's subtitle color if there is no Dialogue Actor component of him in the scene?
You can define a custom field for the actor's color, or even use the existing Node Color field. Then add an OnConversationLine method to your Dialogue Manager that checks the field and wraps the text in a rich text color code. Example:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    Actor actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
    string fieldValue = Field.LookupValue(actor.fields, "Subtitle Color");
    var color = Tools.WebColor(fieldValue);
    subtitle.formattedText.text = UITools.WrapTextInColor(subtitle.formattedText.text, color);
}
CHOPJZL wrote: Wed Mar 10, 2021 10:06 amAbout "Typed" message, If there are 2 conversation running at the same time, will the "Typed" message be conflict?
Yes. You can find a way to use the typewriter effect's OnEnd() UnityEvent instead.
CHOPJZL wrote: Wed Mar 10, 2021 10:06 amIs it possible to start 2 entry at the same time as a group, or start the second entry before the first finishes, and the first entry's sequence don't need to stop. As for UI, let's take 2 different NPC panel for an example.
Not with the default UI scripts, but you can subclass them or replace them, so it's quite possible if you do that with your own code.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Not with the default UI scripts, but you can subclass them or replace them, so it's quite possible if you do that with your own code.
I know I need to do some work on the UI, How about the control part? Or is it controled by the UI, too?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

A bit of code, too. The default UI scripts stop the previous subtitle's typewriter effect when it moves to the next subtitle. If you make a subclass or replacement of the dialogue UI scripts, you can make your version not stop the previous subtitle's typewriter effect.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

I saw this post about override FinishSubtitle(), but how to write the "async command" that starts the next entry?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

You can use the Continue() sequencer command. For example, to move to the next entry after 2 seconds, set the Sequence field to:

Code: Select all

Continue()@2
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

But won't it stop the sequencer of the first entry?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Yes, but it won't stop the typewriter if you've overridden that method.

If you want to play audio or animations that don't stop when the sequence is stopped, use Audio() instead of AudioWait() and AnimatorPlay() instead of AnimatorPlayWait().
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Like the "Typed" message, will Continue() be conflict If there are 2 conversation running at the same time?

Can we set some of the variable to only save by quit game so that it won't change by loading a saved game? Like an achievement to remember a conversation branch has been passed, If I load a save before the branch choice, the branch become false or a new branch's condition become true. This is not quite common in normal games but often used in VN games.

If I use a custom sequencer command to call "DialogueManager.PlaySequence()", the newly added sequencer is not controled by Continue(), am I right? I am kind of hoping it to work in this way, as I want to try to write my own controller to control sequences.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

CHOPJZL wrote: Thu Mar 11, 2021 6:14 amLike the "Typed" message, will Continue() be conflict If there are 2 conversation running at the same time?
Good point. Yes, it does tell all conversations to continue.

No need for Continue(), though. Just set the sequence to run for a specific duration. For example, to play the audio "hello_world" and then advance after 2 seconds:

Code: Select all

Audio(hello_world);
Delay(2)
Or, if you really need to continue a specific conversation, you can write a custom sequencer command to do that.
CHOPJZL wrote: Thu Mar 11, 2021 6:14 amCan we set some of the variable to only save by quit game so that it won't change by loading a saved game? Like an achievement to remember a conversation branch has been passed, If I load a save before the branch choice, the branch become false or a new branch's condition become true. This is not quite common in normal games but often used in VN games.
No. You should do that separately from dialogue database variables.
CHOPJZL wrote: Thu Mar 11, 2021 6:14 amIf I use a custom sequencer command to call "DialogueManager.PlaySequence()", the newly added sequencer is not controlled by Continue(), am I right? I am kind of hoping it to work in this way, as I want to try to write my own controller to control sequences.
Yes, that's correct.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Is there any other command that I should pay attention to when using simultaneous conversations?

I saw the "mmGetQuantity(string inventoryName, string itemID)" in InventoryEngineLua returns a double value. Why is it not int?
Post Reply