Help with Bark Conversations

Announcements, support questions, and discussion for the Dialogue System.
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: Help with Bark Conversations

Post by Mackerel_Sky »

Hey Tony,

I think I have the input system working, thanks for that.

Regarding the simultaneous conversations starting, ideally I would like conversations to occur simultaneously, but I am a little worried about the error being thrown in my last post - it happens when i move scene while the bark conversation is still in progress, and if I disable simulatenous conversations the Dialogue Manager says the bark conversation is still active even when the scene has completely changed. I'm guessing there's something interfering with ending the conversation on scene end, and if I kept on ignoring the problem there would eventually be a massive backlog of unfinished conversations potentially causing performance issues.
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help with Bark Conversations

Post by Tony Li »

Hi,

Changing scenes will not stop conversations. If you want to stop all conversations, use:

Code: Select all

DialogueManager.StopAllConversations();
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: Help with Bark Conversations

Post by Mackerel_Sky »

Thanks Tony, all makes sense to me.

One last question and we can wrap this up - I'm currently using OnTriggerEnter2D with the dialogue system trigger to start a conversation when the player is near by. This leads to the player being able to rapidly trigger new conversations by walking in and out of the hitbox rapidly.

I'm thinking about swapping over to an OnUse trigger and maybe changing the hitbox to check whether a certain time has passed before triggering a new conversation (sending OnUse if a new conversation is eligible to trigger). Would there be a way for the conversation to inform the trigger that it has finished to reset the trigger - keeping in mind that there could be multiple background and one primary conversation going on at the same time?
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help with Bark Conversations

Post by Tony Li »

Hook into DialogueManager.instance.conversationEnded or use an OnConversationEnd() method. (See Script Messages & Events)

If only one instance of a conversation can play at a time, you can check DialogueManager.lastConversationEnded or lastConversationID:

Code: Select all

void OnConversationEnd(Transform actor)
{
    Debug.Log(DialogueManager.lastConversationEnded + " just ended.");
}
If it's possible that more than one instance of the same conversation could be playing at the same time, you'll have to check DialogueManager.activeConversationRecords:

Code: Select all

void OnConversationEnd(Transform actor)
{
    foreach (var record in DialogueManager.activeConversations)
    {
        if (!record.conversationController.isActive)
        {
            Debug.Log($"An instance of '{DialogueManager.lastConversationEnded}' involving {record.actor} and {record.conversant} just ended.");
        }
    }
}
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: Help with Bark Conversations

Post by Mackerel_Sky »

Hi Tony,

Thanks - I hooked into DialogueManager.instance.conversationEnded and it seems to work but a couple last bugs to iron out. They seem to relate to the same issue occuring when the conversation finishes.

The first is an alert declaring:
Dialogue System: Can't find subtitle panel for [Other Generic Actor] 'Woah! Was it serious?'.

The second is:
MissingReferenceException: The object of type 'StandardDialogueUI' has been destroyed but you are still trying to access it.

If it's any help, the conversationEnded function I hooked is being run multiple (around 2-3) times in a row on converation end for some reason as well.
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help with Bark Conversations

Post by Tony Li »

At what point does the "Can't find subtitle panel" warning appear? Can you post the stack trace?

For the error (the second message), if you're using Override Dialogue UI components, it may be destroying the dialogue UI before your code runs. Try adding an instance at design time instead of pointing the Override Dialogue UI component to a prefab.
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: Help with Bark Conversations

Post by Mackerel_Sky »

Hi Tony,

I've done some more digging and I think I fixed the red error - I found some doors which weren't calling StopAllConversations properly. I also found some additional information that might be useful:

The yellow alert is triggered when a scene change occurs. The stack trace is:

Code: Select all

Dialogue System: Can't find subtitle panel for [Other Generic Actor] 'You can't stay out here if you don't find the valuables, y'know...'.
UnityEngine.Debug:LogWarning (object)
PixelCrushers.DialogueSystem.StandardUISubtitleControls:HideSubtitle (PixelCrushers.DialogueSystem.Subtitle) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardUISubtitleControls.cs:450)
PixelCrushers.DialogueSystem.StandardDialogueUI:HideSubtitle (PixelCrushers.DialogueSystem.Subtitle) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardDialogueUI.cs:271)
PixelCrushers.DialogueSystem.ConversationView:FinishSubtitle () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:423)
PixelCrushers.DialogueSystem.ConversationView:HandleContinueButtonClick () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:400)
PixelCrushers.DialogueSystem.ConversationView:OnConversationContinueAll () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:392)
UnityEngine.Component:BroadcastMessage (string,UnityEngine.SendMessageOptions)
PixelCrushers.DialogueSystem.Sequencer:HandleContinueInternally () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:2699)
PixelCrushers.DialogueSystem.Sequencer:HandleCommandInternally (string,string[],single&) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:1214)
PixelCrushers.DialogueSystem.Sequencer:ActivateCommand (string,string,UnityEngine.Transform,UnityEngine.Transform,string[]) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:816)
PixelCrushers.DialogueSystem.Sequencer:OnSequencerMessage (string) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:974)
PixelCrushers.DialogueSystem.Sequencer/<SendTimedSequencerMessage>d__144:MoveNext () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs:938)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
In addition, every time I change scenes the OnConversationEnd hook function increases by 1 on each scene change (regardless if there were any conversations in previous scenes) - I've made sure StopAllConversations is being called correctly too on scene change and confirmed by logging that there are 0 active conversations on scene start.

Another issue popped up regarding the usage of Continue() to progress the barks - if the player is in a standard conversation while a background conversation is ongoing, when Continue() is called in the background conversation it will progress the player's conversation as well. I believe there should be a way to use a custom sequence to get around it using the same check as the simultaneous conversation fix we used earlier - checking to see if the conversation calling Continue() involves the player.
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help with Bark Conversations

Post by Tony Li »

Mackerel_Sky wrote: Sun Nov 27, 2022 3:54 amThe yellow alert is triggered when a scene change occurs. The stack trace is:

Code: Select all

Dialogue System: Can't find subtitle panel for [Other Generic Actor] 'You can't stay out here if you don't find the valuables, y'know...'.
UnityEngine.Debug:LogWarning (object)
PixelCrushers.DialogueSystem.StandardUISubtitleControls:HideSubtitle (PixelCrushers.DialogueSystem.Subtitle)
Can you wait until the actor has hidden its subtitle panel before changing scenes? It's probably asking to hide the subtitle on the same frame that you're changing scenes, and the scene change has already destroyed the subtitle panel.
Mackerel_Sky wrote: Sun Nov 27, 2022 3:54 amIn addition, every time I change scenes the OnConversationEnd hook function increases by 1 on each scene change (regardless if there were any conversations in previous scenes) - I've made sure StopAllConversations is being called correctly too on scene change and confirmed by logging that there are 0 active conversations on scene start.
There's got to be some mismatch of registering and unregistering for events, or something like that.

What version of the Dialogue System are you using?
Mackerel_Sky wrote: Sun Nov 27, 2022 3:54 amAnother issue popped up regarding the usage of Continue() to progress the barks - if the player is in a standard conversation while a background conversation is ongoing, when Continue() is called in the background conversation it will progress the player's conversation as well. I believe there should be a way to use a custom sequence to get around it using the same check as the simultaneous conversation fix we used earlier - checking to see if the conversation calling Continue() involves the player.
The Continue() sequencer command may be too general-purpose for this specific case. Can you set up your barks to work without Continue() -- either by not requiring a continue button and using timing instead such as Delay(#) and None(), or by having the player click an actual UI Button for the continue button? You can connect the UI Button's OnClick() to the subtitle panel's OnContinue method, which will make it only continue that conversation.
Mackerel_Sky
Posts: 111
Joined: Mon Apr 08, 2019 8:01 am

Re: Help with Bark Conversations

Post by Mackerel_Sky »

Hey Tony,

Unfortunately given the timing of this and my other commitments (and a cost benefit analysis), I might just need to drop this and revisit it later down the track - I can adapt the normal conversation framework to have the player interact with these conversations as a point of interest, perhaps.

Thank you for the assistance though, we did end up clearing out a few outstanding bugs both related to the dialogue system and others, some of which have been plaguing me for a while. Sorry for all the trouble you went through.

I think a way to more easily integrate sequential barks between two bark actors would be a good feature to have going forward. It seems like something that might be of interest to a number of current and potential users for the Dialogue Engine.
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help with Bark Conversations

Post by Tony Li »

I'll give that some thought. If you want to revisit it in the future, I'd be happy to discuss it with you. In the meantime, my recommendation still stands to play actual conversations when you need to show more than one line of dialogue.
Post Reply