Barks and Conversations

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ferakiii
Posts: 13
Joined: Tue Nov 19, 2019 12:25 am

Barks and Conversations

Post by ferakiii »

I'm using both barks and conversations as speech bubbles and am having a problem with how I want things to play out.

I have an Input "Fire 2" that is meant to represent "talk" for the player. If they press it the player should do a little bark (Yells out to Dad), but if they are next to an area of interest, or are holding an item they should play the conversation relating to that thing.

I am using the proximity selector to trigger area of interest conversations, but am calling the Barks from my main input script.

The problem is that the bark fires and plays behind the conversation (so 2 speech bubbles) because the triggers are the same, and I can't tell from my input script if a conversation "should" play, since that is determined by the proximity scripts.

I have tried changing to the Bark being a conversation instead, but then I can't use the "chose a random bark" logic, and it also has the same issue of triggering before desired conversation, and therefore either playing for a short time, or blocking all together.

I'm wondering if there is a better way to set this up? I feel like I'm doing the wrong things.

Also bonus question, any way to setup the "Pick a random option" in a normal conversation?
User avatar
Tony Li
Posts: 21987
Joined: Thu Jul 18, 2013 1:27 pm

Re: Barks and Conversations

Post by Tony Li »

Hi,

To choose a random entry from a conversation, use the RandomizeNextEntry() Lua function or sequencer command on the preceding node (i.e., the one that links to the random nodes). This post has more info on different ways of randomizing content.

In your main input script, check if the player's ProximitySelector is currently detecting a usable. If so, don't trigger the bark. For example:

Code: Select all

void Start()
{
    myProximitySelector = GetComponent<ProximitySelector>();
}

void Update()
{
    if (Input.GetButtonDown("Fire1"))
    {
        if (myProximitySelector.currentUsable == null) // Nothing in proximity; it's OK to bark.
        {
            DialogueManager.BarkString("Hello world");
        }
    }
}
ferakiii
Posts: 13
Joined: Tue Nov 19, 2019 12:25 am

Re: Barks and Conversations

Post by ferakiii »

Thanks Tony! I'll do that for the random conversation.

That current usable looks like what I need. I'll do have to check wether it has a dialog action on that usuable as well, but it's a good direction to start me off in (i.e. some items may just be pickupable but have no talking when you pick them up).

Cheers for the help
User avatar
Tony Li
Posts: 21987
Joined: Thu Jul 18, 2013 1:27 pm

Re: Barks and Conversations

Post by Tony Li »

Happy to help! :-)
Post Reply