Page 1 of 1
Cancel and Randomize barks via script
Posted: Sat Nov 02, 2024 11:49 am
by domopuff
Hey Tony,
Is there a script method to cancel all active barks? I tried using BarkGroupManager.instance.CancelAllBarks() but doesn't seem to work.
Also was wondering if there's a way to trigger and randomize barks via script as well?
Thank you!
Re: Cancel and Randomize barks via script
Posted: Sat Nov 02, 2024 6:12 pm
by Tony Li
Hi,
To cancel all barks, add
BarkGroupMember components to your barking characters. Then
BarkGroupManager.instance.CancelAllBarks() will tell all BarkGroupMembers to cancel any active barks.
To trigger randomized barks in C#, use
DialogueManager.Bark() to
DialogueManager.BarkString(). If your conversation only has two dialogue entries to randomize from, Dialogue System version 2.2.50 will have a fix that randomly chooses between the two. (Currently it always uses the first entry if there are only two.)
Re: Cancel and Randomize barks via script
Posted: Sat Nov 02, 2024 8:17 pm
by domopuff
Thanks for the help Tony. Would there also be a way to sequentially trigger barks as well? Or i just need to ensure the previous bark doesn't repeat itself again.
Re: Cancel and Randomize barks via script
Posted: Sat Nov 02, 2024 9:46 pm
by Tony Li
Hi,
Create a BarkHistory object and pass it along. Example:
Code: Select all
private BarkHistory barkHistory = new BarkHistory(BarkOrder.Sequential);
void BarkNextSequentialLineInOrder()
{
DialogueManager.Bark("My Bark Conversation", this.transform, barkHistory);
}
Re: Cancel and Randomize barks via script
Posted: Mon Nov 04, 2024 12:56 am
by domopuff
Thanks it worked!
Re: Cancel and Randomize barks via script
Posted: Mon Nov 04, 2024 7:31 am
by Tony Li
Glad to help!