Override DialogueManagers settings bug

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Krejwen
Posts: 25
Joined: Mon Jun 08, 2020 8:09 am

Override DialogueManagers settings bug

Post by Krejwen »

Hi Tony,

I have a few questions and bugs to report.
  1. If there any place where is an info which scripts are required for DS to work? E.g. We don't demo project, arts, etc? Maybe wrappers?
  2. Is it possible to group quests in the same way like conversations or variables?
  3. Is it possible to set some quest rows in Dialogue window to another color? E.g. based on the group or tag
  4. If one of quest in dialogue window is not mark as group and we want to sort all quests by group then I get the following error error

    Code: Select all

    NullReferenceException: Object reference not set to an instance of an object
    PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow+<>c.<SortItemsByGroup>b__361_0 (PixelCrushers.DialogueSystem.Item x, PixelCrushers.DialogueSystem.Item y) (at Assets/3rd-Party/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueEditorWindowItemSection.cs:275)
    System.Collections.Generic.ArraySortHelper`1[T].InsertionSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Comparison`1[T] comparer) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.Collections.Generic.ArraySortHelper`1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison`1[T] comparer) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.Collections.Generic.ArraySortHelper`1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison`1[T] comparer) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) (at <9577ac7a62ef43179789031239ba8798>:0)
    Rethrow as InvalidOperationException: Failed to compare two elements in the array.
    System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.Collections.Generic.List`1[T].Sort (System.Comparison`1[T] comparison) (at <9577ac7a62ef43179789031239ba8798>:0)
    PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.SortItemsByGroup () (at Assets/3rd-Party/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueEditorWindowItemSection.cs:275)
    UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at <7d90b28560b644ce87b8263efcc36eed>:0)
    
    To generate this error you need to make following steps:
    1. Open windows with quests view.
    2. Set one quest to be in group
    3. Sort by group -> error
  5. I think I have a bug with override dialogue manager settings in conversations.
    When I override some settings in conversation they are not used in the game
    I attach a simple project with an example (password in private message).
    To check the problem play SampleScene.

    Settings:
    - I have two conversations - Conversation1 and Conversation2.
    - In DialogueManager I set a checkbox "Include Invalid Entries".
    - In Conversation2 I override Display Settings and set checkbox "Include Invalid Entries" to false.
    - Conversation1 has direct link to Conversation2
    - Quest is used to simulate situation

    Expected behaviour
    1. Start the conversation
    2. Player see 3 options (option “Maybe” is not able to choose)
    3. Player choose "Yes" options
    4. Player see 2 options - “Option 1” and “Option 2”

    At this moment, in step 4 I see three options ("Option 3" is not able to choose).
    In addition, I see an empty option to choose when I show a linked conversation. Can you say what is the source of the problem?

    Link to the project: [removed]
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override DialogueManagers settings bug

Post by Tony Li »

Hi
Krejwen wrote: Wed Dec 23, 2020 4:30 am1. If there any place where is an info which scripts are required for DS to work? E.g. We don't demo project, arts, etc? Maybe wrappers?
Krejwen wrote: Wed Dec 23, 2020 4:30 am2. Is it possible to group quests in the same way like conversations or variables?
Yes. Use forward slashes in the quest's Name. You probably won't want to show the Name in gameplay UIs, so also set the Display Name.
Krejwen wrote: Wed Dec 23, 2020 4:30 am3. Is it possible to set some quest rows in Dialogue window to another color? E.g. based on the group or tag
I'm not sure I understand. But you can set a custom node color for each actor. On the Actors panel, inspect an actor and tick Use Custom Color.
Krejwen wrote: Wed Dec 23, 2020 4:30 am4. If one of quest in dialogue window is not mark as group and we want to sort all quests by group then I get the following error error

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow+<>c.<SortItemsByGroup>b__361_0 (PixelCrushers.DialogueSystem.Item x, PixelCrushers.DialogueSystem.Item y) (at Assets/3rd-Party/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueEditorWindowItemSection.cs:275)...
Thanks for reporting that. I'll investigate it and provide a fix in the next release.
Krejwen wrote: Wed Dec 23, 2020 4:30 am[*] I think I have a bug with override dialogue manager settings in conversations.
When I override some settings in conversation they are not used in the game
I attach a simple project with an example (password in private message).
To check the problem play SampleScene.

Settings:
- I have two conversations - Conversation1 and Conversation2.
- In DialogueManager I set a checkbox "Include Invalid Entries".
- In Conversation2 I override Display Settings and set checkbox "Include Invalid Entries" to false.
- Conversation1 has direct link to Conversation2
- Quest is used to simulate situation

Expected behaviour
1. Start the conversation
2. Player see 3 options (option “Maybe” is not able to choose)
3. Player choose "Yes" options
4. Player see 2 options - “Option 1” and “Option 2”

At this moment, in step 4 I see three options ("Option 3" is not able to choose).
In addition, I see an empty option to choose when I show a linked conversation. Can you say what is the source of the problem?
I'll take a look and reply back by the end of the day.
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override DialogueManagers settings bug

Post by Tony Li »

Hi,
Krejwen wrote: Wed Dec 23, 2020 4:30 amWhen I override some settings in conversation they are not used in the game
This is by design. There is a conceptual difference between conversation data in the dialogue database and the "active conversation instance" that is playing at runtime. When you start a conversation, the active conversation instance uses that conversation's settings, even if you link back and forth between different nodes in different conversations in the database.
Krejwen wrote: Wed Dec 23, 2020 4:30 amIn addition, I see an empty option to choose when I show a linked conversation. Can you say what is the source of the problem?
Link to "Ok, what do you want to know?", not to <START>. (Or change the actor assigned to <START> to be the NPC.)
Krejwen
Posts: 25
Joined: Mon Jun 08, 2020 8:09 am

Re: Override DialogueManagers settings bug

Post by Krejwen »

Hi Tony,

Thanks for answer! I see that I was not precise in some questions. Below there are additional info.
Yes. Use forward slashes in the quest's Name. You probably won't want to show the Name in gameplay UIs, so also set the Display Name.
Is it possible to show them in foldout groups like Variables?
I'm not sure I understand. But you can set a custom node color for each actor. On the Actors panel, inspect an actor and tick Use Custom Color.
I want to set color in Editor GUI dialogue, like in picture below, to be able detect which quests are from which "category" or groups. If you have e.g. 100 quests that can help organize them.
EditorColor.jpg
EditorColor.jpg (34.4 KiB) Viewed 688 times
This is by design. There is a conceptual difference between conversation data in the dialogue database and the "active conversation instance" that is playing at runtime. When you start a conversation, the active conversation instance uses that conversation's settings, even if you link back and forth between different nodes in different conversations in the database.
So it is possible to change settings of "active conversation instance"? My goal is to change them in case when node is linked to another conversation with overrided settings?
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override DialogueManagers settings bug

Post by Tony Li »

Hi,
Krejwen wrote: Mon Jan 04, 2021 5:52 am
Yes. Use forward slashes in the quest's Name. You probably won't want to show the Name in gameplay UIs, so also set the Display Name.
Is it possible to show them in foldout groups like Variables?
Not in the current version. This is a feature I'd like to add in the future. However, you can sort quests by Name. This way you can get all the quests in the same group to appear together in the list.
Krejwen wrote: Mon Jan 04, 2021 5:52 amI want to set color in Editor GUI dialogue, like in picture below, to be able detect which quests are from which "category" or groups. If you have e.g. 100 quests that can help organize them.
That's a good idea. I'll add that to consideration for a future update.
Krejwen wrote: Mon Jan 04, 2021 5:52 am
This is by design. There is a conceptual difference between conversation data in the dialogue database and the "active conversation instance" that is playing at runtime. When you start a conversation, the active conversation instance uses that conversation's settings, even if you link back and forth between different nodes in different conversations in the database.
So it is possible to change settings of "active conversation instance"? My goal is to change them in case when node is linked to another conversation with overrided settings?
Yes. You can add a script to the Dialogue Manager that has an OnLinkedConversationStart() method. In that method, set DialogueManager.displaySettings.conversationOverrideSettings:

Code: Select all

void OnLinkedConversationStart(Transform actor)
{
    var conversationID = DialogueManager.currentConversationState.subtitle.dialogueEntry.conversationID;
    var conversation = DialogueManager.masterDatabase.GetConversation(conversationID);
    DialogueManager.displaySettings.conversationOverrideSettings = conversation.overrideSettings;
}
p.s. - In the next release, changing to a linked conversation will change the active conversation to use the new conversation's override settings since this turned out to be requested by several people.
Krejwen
Posts: 25
Joined: Mon Jun 08, 2020 8:09 am

Re: Override DialogueManagers settings bug

Post by Krejwen »

Thanks for all info!
You can add a script to the Dialogue Manager that has an OnLinkedConversationStart() method.
I made it but it doesn't work. Data for the UI is set when a conversation is starting but we don't start the UI again when the conversation is switched to another one (the linked one).

I am looking how to solve the problem.
Krejwen
Posts: 25
Joined: Mon Jun 08, 2020 8:09 am

Re: Override DialogueManagers settings bug

Post by Krejwen »

I found a solution but I am not quite sure is it ok with your architecture.

I changed the code in the OnLinkedConversationStart() method:

Code: Select all

void OnLinkedConversationStart(Transform actor)
    {
        var conversationID = DialogueManager.currentConversationState.subtitle.dialogueEntry.conversationID;
        var conversation = DialogueManager.masterDatabase.GetConversation(conversationID);
        DialogueManager.displaySettings.conversationOverrideSettings = conversation.overrideSettings;
        DialogueManager.conversationModel.UpdateDisplaySettings();
        DialogueManager.UpdateResponses();
    }
and make little modification in ConversationModel class (add UpdateDisplaySettings method):

Code: Select all

public ConversationModel(DialogueDatabase database, string title, Transform actor, Transform conversant,
                                 bool allowLuaExceptions, IsDialogueEntryValidDelegate isDialogueEntryValid,
                                 int initialDialogueEntryID = -1, bool stopAtFirstValid = false, bool skipExecution = false)
        {
            this.m_allowLuaExceptions = allowLuaExceptions;
            this.m_database = database;
            this.isDialogueEntryValid = isDialogueEntryValid;
            UpdateDisplaySettings();
            Conversation conversation = database.GetConversation(title);
            if (conversation != null)
            {
                SetParticipants(conversation, actor, conversant);
                if (initialDialogueEntryID == -1)
                {
                    firstState = GetState(conversation.GetFirstDialogueEntry(), true, stopAtFirstValid, skipExecution);
                    FixFirstStateSequence();
                }
                else
                {
                    firstState = GetState(conversation.GetDialogueEntry(initialDialogueEntryID), true, stopAtFirstValid, skipExecution);
                }
            }
            else
            {
                firstState = null;
                if (DialogueDebug.logErrors) Debug.LogWarning(string.Format("{0}: Conversation '{1}' not found in database.", new System.Object[] { DialogueDebug.Prefix, title }));
            }
        }

        public void UpdateDisplaySettings()
        {
            DisplaySettings displaySettings = DialogueManager.displaySettings;
            if (displaySettings != null)
            {
                if (displaySettings.cameraSettings != null) m_entrytagFormat = displaySettings.cameraSettings.entrytagFormat;
                if (displaySettings.inputSettings != null)
                {
                    m_emTagForOldResponses = displaySettings.inputSettings.emTagForOldResponses;
                    m_emTagForInvalidResponses = displaySettings.inputSettings.emTagForInvalidResponses;
                    m_includeInvalidEntries = displaySettings.GetIncludeInvalidEntries();
                }
            }
        }
User avatar
Tony Li
Posts: 22163
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override DialogueManagers settings bug

Post by Tony Li »

Version 2.2.15 is on schedule for release early next week. It applies override settings when linking to another conversation. That may be another workable solution for you.
Post Reply