Page 1 of 1

Stop all barks onConversationStart

Posted: Tue Dec 01, 2020 5:51 am
by ar4wy
Hi Tony,

Is there a way to stop all barks when conversations become active? Right now, with "allow barks during conversation" set to false, if a bark is active, it fades while conversation is active (but does not call a new bark during conversation).

Is there a way to cut all barks off when the conversation starts?

Re: Stop all barks onConversationStart

Posted: Tue Dec 01, 2020 10:51 am
by Tony Li
Hi,

There isn't a built-in checkbox or anything like that, but you could add a small script to the Dialogue Manager, something like this:

Code: Select all

public class HideBarksOnConversation : MonoBehaviour
{
    void OnConversationStart(Transform actor)
    {
        foreach (var barkUI in FindObjectsOfType<StandardBarkUI>())
        {
            if (barkUI.isPlaying) barkUI.Hide();
        }
    }
}
Alternatively, you could use Bark Groups. Add a Bark Group Member component to all NPCs that can bark, and assign the same ID. When one member barks, the others will immediately hide their bark UIs if they're currently barking.

Add another Bark Group Member to the Dialogue Manager. When the conversation starts, manually call BarkGroupManager.instance.MutexBark(ID, DialogueManager.instance.GetComponent<BarkGroupMember>()).

Re: Stop all barks onConversationStart

Posted: Tue Dec 01, 2020 8:19 pm
by ar4wy
Hi Tony,

Thanks for this. After making a small script as described above, barks hide properly when conversation starts. However, when the conversation ends the barks seem to have a very short duration time now, even though in the inspector, barks still show "4" for Duration.

Re: Stop all barks onConversationStart

Posted: Tue Dec 01, 2020 9:43 pm
by Tony Li
Hi,

Do your barks use Sequences? If so, please try calling barkUI.OnBarkEnd(null) instead of barkUI.Hide().

Re: Stop all barks onConversationStart

Posted: Tue Dec 01, 2020 9:52 pm
by ar4wy
Hi Tony,

My Barks don't have any sequences. I tried what you suggested and the result is that it doesn't deactivate the bark.

I do have a default sequence in the Dialogue System Controller: Delay(0)@Message(Typed)

HOWEVER--I checked "Wait Until Sequence Ends" in the StandardBarkUI, and with the original Hide() call, it now works great. The barks get hidden when conversation starts and continue normally after conversation has ended.

My problem is resolved--but not sure why! haha.

Re: Stop all barks onConversationStart

Posted: Tue Dec 01, 2020 9:55 pm
by Tony Li
Hmm, barks don't use the Default Sequence. Anyway, glad it's working. I've made a note to investigate the issue when that checkbox wasn't ticked. I suspect the Hide() method just needs to reset something when it's not ticked.

Re: Stop all barks onConversationStart

Posted: Tue Dec 01, 2020 9:59 pm
by ar4wy
Thanks!!