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?
Have NPCs bark at each other
Re: Have NPCs bark at each other
Hi,
Since it's a series of lines of dialogue, run a conversation. See: How To: Show Overhead Conversation Bubble Text
Since it's a series of lines of dialogue, run a conversation. See: How To: Show Overhead Conversation Bubble Text
Re: Have NPCs bark at each other
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?
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?
Re: Have NPCs bark at each other
Hi,
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 Assignmentswedgiebee 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.
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.
Re: Have NPCs bark at each other
Thank you, this works great!
For the NPC bark conversations, I've gone into their Conversation Properties and ticked Override Display Settings > Subtitle Settings so that I can set Continue Button to Never. But now all those conversation also use their own "Subtitle Chars Per Second" as specified in the overridden subtitle settings. I want all NPC bark conversations to have the same "Subtitle Chars Per Second," and I want to easily be able to tweak that number in all places over the course of development instead of having to go into every NPC bark conversation.
Is there a way to do that with this method?
For the NPC bark conversations, I've gone into their Conversation Properties and ticked Override Display Settings > Subtitle Settings so that I can set Continue Button to Never. But now all those conversation also use their own "Subtitle Chars Per Second" as specified in the overridden subtitle settings. I want all NPC bark conversations to have the same "Subtitle Chars Per Second," and I want to easily be able to tweak that number in all places over the course of development instead of having to go into every NPC bark conversation.
Is there a way to do that with this method?
Re: Have NPCs bark at each other
Hi,
Here's another approach:
Here's another approach:
- UNtick the conversation properties' Override Subtitle Settings checkbox.
- Tick Override Camera Settings.
- Set Default Sequence to something like: This will simulate a continue button click after a duration based on the text length. (More info on duration: How To: Control the Duration of Subtitle Text)
Code: Select all
Continue()@{{end}}