Use Bark...

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
gammaker95
Posts: 9
Joined: Fri Nov 20, 2015 10:48 pm

Use Bark...

Post by gammaker95 »

Hello.

When Monster attack (or attacked), Game display Some Dialogue like "I'll kill you".
I thought bark system can maybe do this.

I didn't know how do i do. I didn't find helpful something in documentation and example.
Can I use bark trigger or something?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Use Bark...

Post by Tony Li »

Hello,

Yes, the bark system works well for this. The main documentation on barks is here: How to Play Barks

Here's a simple example:

1. Prepare a bark conversation with lines such as "I'll kill you!" and "Prepare to die!".

2. Add a Bark UI to your monster. <-- That link is for Unity UI. Here's the main page for all GUI systems if you want to use a different GUI system: Bark UIs.

3. Add a Bark Trigger to your monster. Select the bark conversation, and set the Trigger type to OnUse.

4. When the monster attacks or is attacked, send an "OnUse" message to the monster. For example:

Code: Select all

void Attack(Transform player) {
    SendMessage("OnUse", player);
}

Extra info:

If you want to make more advanced barks, you can add conditions to your bark conversation nodes. For example, you could set a Lua variable before sending "OnUse". Something like:

Code: Select all

void Attack(Transform player) {
    BarkInResponseTo("attack");
}

void Attacked(Transform player) {
    BarkInResponseTo("attacked");
}

void Damaged(Transform player) {
    BarkInResponseTo("damaged");
}

void BarkInResponseTo(string action) {
    DialogueLua.SetVariable("Action", action);
    SendMessage("OnUse", player);
}
And set up your bark conversation like this:
  • START
    • "I'll kill you!" ( condition: Variable["Action"] == "attack" )
    • "So you want to fight, eh?" ( condition: Variable["Action"] == "attacked" )
    • "Ouch! That hurt!" ( condition: Variable["Action"] == "damaged" )
gammaker95
Posts: 9
Joined: Fri Nov 20, 2015 10:48 pm

Re: Use Bark...

Post by gammaker95 »

Thanks for details. :)

Your asset is very useful for my game.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Use Bark...

Post by Tony Li »

I'm very glad to hear it! Happy to help!
Post Reply