Page 1 of 1

Use Bark...

Posted: Fri Mar 11, 2016 5:49 am
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?

Re: Use Bark...

Posted: Fri Mar 11, 2016 9:31 am
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" )

Re: Use Bark...

Posted: Fri Mar 11, 2016 9:27 pm
by gammaker95
Thanks for details. :)

Your asset is very useful for my game.

Re: Use Bark...

Posted: Fri Mar 11, 2016 9:47 pm
by Tony Li
I'm very glad to hear it! Happy to help!