Barking from a sequence

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
chud575
Posts: 50
Joined: Thu May 11, 2017 10:57 am

Barking from a sequence

Post by chud575 »

Can you do the following?

1. Bark from a sequence command
2. Set custom bark text from #1 (instead of using a conversation)

If not, how would I go about implementing such a feature? Lua?
EDIT - I found the template, giving this a go now
chud575
Posts: 50
Joined: Thu May 11, 2017 10:57 am

Re: Barking from a sequence

Post by chud575 »

Ok, 1 tiny bug I need help with:

Sequence Command:

Code: Select all

Bark(string barkText, subject, null)
Source:

Code: Select all

namespace PixelCrushers.DialogueSystem.SequencerCommands
{
    public class SequencerCommandBark : SequencerCommand
    {

        // Use this for initialization
        void Start()
        {
            string barkString = GetParameter(0);
            Transform subject = GetSubject(GetParameter(1));
            DialogueManager.BarkString(barkString, subject);
        }

        // Update is called once per frame
        void Update()
        {

        }

        public void OnDestroy()
        {
        }
    }
}
Test Sequence: Bark(Hello?, Townsfolk1,)
Result:
Hello?: Hello?

Any thoughts as to why that is?
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Barking from a sequence

Post by Tony Li »

Hi,

You might want to use a Lua function instead of a sequencer command so you can pass more complicated strings. For example, this won't work as a sequence:

Code: Select all

Bark(Hello, world!, Townsfolk1)
But you can do it in Lua:

Code: Select all

Bark("Hello, world!", "Townsfolk1")
If you stick with the sequencer command, remember to call Stop() at the end of your Start() method.

What kind of bark UI does Townsfolk1 have? You might want to uncheck Include Name -- or, if Townsfolk1 isn't defined as an actor in the database, add an Override Actor Name and set the name to use. I'm not exactly sure why it seems to be using the bark text as the barker's name.
chud575
Posts: 50
Joined: Thu May 11, 2017 10:57 am

Re: Barking from a sequence

Post by chud575 »

Just your basic run of the mill Unity UI Bark.

Is the Lua code already implemented or do I need to write my own function?
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Barking from a sequence

Post by Tony Li »

You'd need to write your own function. There's a template script for Lua functions.
chud575
Posts: 50
Joined: Thu May 11, 2017 10:57 am

Re: Barking from a sequence

Post by chud575 »

Ok so this is why that was happening:
I created my own bark ui, and removed the name text field, but left "include name" ticked.

Got the Lua code working. Thanks Tony.
User avatar
Tony Li
Posts: 21070
Joined: Thu Jul 18, 2013 1:27 pm

Re: Barking from a sequence

Post by Tony Li »

Happy to help! I'm glad it's working!
Post Reply