About Dialogue Actor component

Announcements, support questions, and discussion for the Dialogue System.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

So the problem come back to top. How to have a Fields only belong to the running conversation, and is able to be used in the Condition and Script of entry?

Yesterday I thought of a idea that:
>1. Keep a Dictionary of Instance entries in the ActiveRecord, the key is ConversationID+EntryID,
>2. In the event methods such as OnConversationLine(subtitle), as now we can get subtitle.targetRecord, so we call a method of the Record to add a instance of the subtitle entry and modify the instance entry's field when needed.
>3. During the conversation, if the entry is visited, check if there is a instance in the Dictionary, if there is, use it instead of the original entry.
>plus. Maybe add a Bool to set if a conversation is using this feature or not.

How do you think of this idea?
User avatar
Tony Li
Posts: 21926
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

In the big picture, what are you trying to accomplish?

Dialogue entry fields are supposed to be read only, except for SimStatus. There may be a better way to do all of this.

I'm finishing working for the day, but I'll check back in the morning.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

What I am trying to accomplish is as I always said, to have a Fields(a pack of variables) only belong to the running conversation, and is able to be used in the Condition and Script of entry, maybe DialogueText, too.

For example. There is a Entry says "I have xxx cats".

In ConversationA, xxx=2, this lead to the next Entry "wonderful" by condition(xxx < 3 and xxx > 1)

In ConversationB, xxx=5, this lead to the next Entry "WoW" by condition(xxx >= 3)

ConversationA and ConversationB are simultaneouse conversations that comes from the same original conversation.
User avatar
Tony Li
Posts: 21926
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Since the dialogue database is global and the Variable[] table is global, I think it will work best to associate a pack of variables with each ActiveConversationRecord. This may be easier when I include the ActiveConversationRecord in the Subtitle and Response objects. I'll put together a prototype and post it here later today.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

As we talked about earlier, The problem of this is how to write the Lua Function to get the target ActiveConversationRecord(or the target pack of variables). A unique parameter for the Lua Function is needed. With this in thought, I am looking forward for the prototype :)
User avatar
Tony Li
Posts: 21926
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Please give me a day to think of the best approach. I don't want to rush it and suggest an awkward approach.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Of course, please take your time :)
User avatar
Tony Li
Posts: 21926
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Hi,

Here's a patch and an example scene:

DS_ActiveConversationRecordPatch-2021-03-18.unitypackage

DS_JZL_Test_2021-03-18.unitypackage

The patch adds these things:
  • DialogueManager.instance.activeConversation: The current ActiveConversationRecord. Valid when Lua code in Conditions and Script are running, and in OnConversationLine and OnConversationResponseMenu methods.
  • Subtitle.activeConversationRecord: The ActiveConversationRecord of the conversation that this subtitle came from.
The example scene has two dialogue UIs. A script starts the same conversation in each dialogue UI, but with different conversants in the back-end info. The conversation shows the conversant name and also branches differently based on the conversant name.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Hi,

The patch works great. And Response class needs it, too.

Glad to see it works in DialogueText, too. I didn't test sequence, does it work in there?

I think the Sequencer need a ref of the Record, too. I personally want to make something around it.
And in this way, You can set the "activeConversation" in HandleContinueInternally(), and compare it with the Record that ConversationView belongs to in HandleContinueButtonClick(). The Continue() sequencer command is able to become unique. Maybe SetContinueMode(), too

It seems there is no ref of the Record or Controller in ConversationView/Model, how about adding them?
User avatar
Tony Li
Posts: 21926
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Hi,

I don't think there's a need for references anywhere else, except maybe for Continue. (I'll look into that.) When OnConversationResponseMenu runs, DialogueManager.instance.activeConversation will point to the correct ActiveConversationRecord.
Post Reply