Have NPCs bark at each other

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
wedgiebee
Posts: 14
Joined: Wed May 25, 2022 6:40 pm

Have NPCs bark at each other

Post by wedgiebee »

Hi there, I'm struggling to implement a setup where NPCs bark at each other. I know there are instructions in the documentation's FAQ for this very case, but sadly I am still struggling!

I have NPC 1 and NPC 2 who are sitting at a bench. When the player walks within range, the NPCs should start a series of barks at each other, let's say like 4 back-and-forths. If the player leaves range, they should stop, and if the player re-enters range, they should restart from the beginning.

How do I do this?
User avatar
Tony Li
Posts: 20774
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have NPCs bark at each other

Post by Tony Li »

Hi,

Since it's a series of lines of dialogue, run a conversation. See: How To: Show Overhead Conversation Bubble Text
wedgiebee
Posts: 14
Joined: Wed May 25, 2022 6:40 pm

Re: Have NPCs bark at each other

Post by wedgiebee »

Got it, thanks for the link! Using a conversation makes sense, but I have some existing behavior that it conflicts with.

1) I have a component on my player character that listens to "DialogueManager.instance.conversationStarted" and "DialogueManager.instance.conversationEnded" to disable/enable player input. I don't want this behavior when the NPCs have a bark conversation - I want the player to still have input as normal, like they're just observing a conversation in the background.

2) I have a component that always sets continue mode to true (meaning require the continue button to be pressed) for conversations. For NPC bark conversations, I want their conversations to progress automatically on a timer.

How would I handle these situations?
User avatar
Tony Li
Posts: 20774
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have NPCs bark at each other

Post by Tony Li »

Hi,
wedgiebee wrote: Sun May 12, 2024 5:10 pm1) I have a component on my player character that listens to "DialogueManager.instance.conversationStarted" and "DialogueManager.instance.conversationEnded" to disable/enable player input. I don't want this behavior when the NPCs have a bark conversation - I want the player to still have input as normal, like they're just observing a conversation in the background.
Use OnConversationStart(Transform) and OnConversationEnd(Transform) methods on the player GameObject (or a Dialogue System Events component) instead of DialogueManager.instance.conversationStarted/Ended. These methods will only be called when the player GameObject is used as the primary actor or primary conversant. More info: Character GameObject Assignments
wedgiebee wrote: Sun May 12, 2024 5:10 pm2) I have a component that always sets continue mode to true (meaning require the continue button to be pressed) for conversations. For NPC bark conversations, I want their conversations to progress automatically on a timer.
Instead of using a component, set the Dialogue Manager's Display Settings > Subtitle Settings > Continue Button mode to Always. For NPC bark conversations, inspect the conversation and select Menu > Conversation Properties. Then tick Override Display Settings > Subtitle Settings, and set the Continue Button mode for that conversation to Never.
Post Reply