How do I activate Bark text when the enemy gets hurt?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
totosavi
Posts: 4
Joined: Tue Aug 08, 2023 3:19 pm

How do I activate Bark text when the enemy gets hurt?

Post by totosavi »

Hi guys! I'm not sure if this question has been asked before, but I'm trying to find out how to activate Bark whenever the enemy gets hurt by the player. Does anyone know how to do this?
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I activate Bark text when the enemy gets hurt?

Post by Tony Li »

Hi,

You first need to have a way to know when the enemy gets hurt. When it gets hurt, you can either bark in code, using a string:

Code: Select all

DialogueManager.BarkString("Ouch!", enemy);
or, to bark random lines from a conversation:

Code: Select all

DialogueManager.Bark("Enemy Hurt Barks", enemy);
Or you can set up a Dialogue System Trigger on the enemy. Set its Trigger to OnUse. Select Add Action > Bark, and configure the bark. When the enemy is hurt, call the Dialogue System Trigger's OnUse() method.
totosavi
Posts: 4
Joined: Tue Aug 08, 2023 3:19 pm

Re: How do I activate Bark text when the enemy gets hurt?

Post by totosavi »

Thank you Tony! It worked :D
User avatar
Tony Li
Posts: 22118
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I activate Bark text when the enemy gets hurt?

Post by Tony Li »

Glad to help!
Post Reply