On Bark Start, On Bark End not firing??

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fringilla
Posts: 12
Joined: Tue Jan 31, 2017 12:37 pm

On Bark Start, On Bark End not firing??

Post by fringilla »

Hello!
I've attached the Dialogue System Events component to my Dialogue Manager. Events On Conversation Start, On Conversation End and On Bark Line are Fine but On Bark Start and On Bark End are not firing at all. I've set Dialogue Manager Debug to Info and there's no Info about those events firing either. Why is that?

What I want to achieve is setting a condition flag that player couldn't trigger another bark on NPC while the previous is still playing. How can I achive this without those events not firing?
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Bark Start, On Bark End not firing??

Post by Tony Li »

Hello!

Add a Dialogue System Events component to the NPC. The OnBarkStart and OnBarkEnd events are only sent to the barker and listener, not to the Dialogue Manager (unlike OnBarkLine). You can find a list of the recipients for each event here.

I'll look into adding OnBarkStart and OnBarkEnd to the Dialogue Manager in a patch version coming in the next week.
fringilla
Posts: 12
Joined: Tue Jan 31, 2017 12:37 pm

Re: On Bark Start, On Bark End not firing??

Post by fringilla »

Thank you, it works!
But it works kinda weird. I attached Dialogue System Events to only one barking NPC and it behaves the same on all of them :O They're different prefabs and as an event function I referenced method script from that one particular NPC object and it's still working correctly everywhere :P It's fine for me but let's say I don't want that behaviour for all barking NPCs - what should I do?
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Bark Start, On Bark End not firing??

Post by Tony Li »

That's very strange. The OnBarkStart and OnBarkEnd events only get sent to the barker and the listener (and then only if the listener is assigned in the Bark Trigger). Could your script method be related to the issue?

Or maybe the Dialogue Manager is now being set as the listener somehow. If this is the case, it will also receive the OnBarkStart and OnBarkEnd events.

If you want to research this further and can't get to the bottom of it, please feel free to send a reproduction project to tony (at) pixelcrushers.com. I'd be happy to take a look and let you know what I find.
fringilla
Posts: 12
Joined: Tue Jan 31, 2017 12:37 pm

Re: On Bark Start, On Bark End not firing??

Post by fringilla »

Sorry, I can't email you the project because it's not only mine, I work on it along with other people :)

BUT the strangest thing happened, I removed this one Dialogue System Event component from one NPC barker and it's still working :O And there're no functions assigned to Dialogue System Events Bark section on the Dialogue Manager.
Przechwytywanie.PNG
Przechwytywanie.PNG (36.73 KiB) Viewed 897 times
Screenshot above is from the child object of my NPC. Interaction Trigger is my script which invokes OnUse() on Dialogue Trigger. And in this script are also my OnBarkStart() and OnBarkEnd() methods:

Code: Select all

public void OnBarkStart()
{
	IsActive = false;
	Debug.Log("BarkStart");
	GlobalController.instance.SetStandardCursor();
}
public void OnBarkEnd()
{
	Debug.Log("BarkEnd");
	IsActive = true;
}
When I was first asking this question those above methods were in GameController script, which is not attached to the NPCs of course, and they set a different flag. Then I attached Dialogue System Events to the one NPC AND wrote above methods in the Interaction Trigger Script and it suddenly started to work on every NPC. And now I removed Dialogue System Events from that one NPC and it's still working :D

Oh and I also tried to change methods' names and it wasn't working then changed it back and it works well.
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: On Bark Start, On Bark End not firing??

Post by Tony Li »

You just implemented the programmers' alternative to using Dialogue System Events. If the barker or listener has a script with OnBarkStart(), OnBarkEnd(), or OnBarkLine() methods, the Dialogue System will automatically invoke them, similar to how Unity will automatically invoke Update() or OnTriggerEnter() if your script has it. You can find a complete list of Dialogue System methods on the Script Messages page.
Post Reply