can I set a bark like player is in range, NPC barks at player "Come over here" and then when player is close, initiate a conversation?
1. Add 2 child GameObjects to the NPC.
2. On the first child:
Add a trigger collider (such as a Sphere Collider with Is Trigger ticked). Make it as big as the range where the NPC should bark.
Add a rigidbody. Tick Is Kinematic.
Add a Dialogue System Trigger. Set it to OnTriggerEnter. Click the Use 'Player' Tag button.
Select Add Action > Bark. Set up the bark text/conversation. Assign the NPC to the Barker field.
3. On the second child:
Add a trigger collider (such as a Sphere Collider with Is Trigger ticked). Make it as big as the range where the NPC should start the conversation.
Add a rigidbody. Tick Is Kinematic.
Add a Dialogue System Trigger. Set it to OnTriggerEnter. Click the Use 'Player' Tag button.
Select Add Action > Start Conversation. Set up the conversation. Assign the NPC to the Conversation Conversant field
Once you've confirmed that this is working, you may want to only bark and start the conversation once. To do this, define variables in the Dialogue Editor. Set those variables true in the bark/conversation. Check the variables in the Dialogue System Triggers' Condition section.
Hi Tony, do you think you could expand on running the in-range bark only once? I've been trying to define variables but either the bark plays every single time I'm in range, or it doesn't play at all. Simultaneously, it seems to override the random barks that I've applied directly to the character gameobject.
Thanks for the awesome support. I've found most of the answers i've been looking for just by using the search function on the board. This one has eluded me.
Define a variable in the Dialogue Editor. I defined a variable "barkedHere":
barkOnce2.png (11.12 KiB) Viewed 1142 times
In the Dialogue System Trigger's Conditions section, require that the variable is not true yet, as shown below. When the trigger fires, it will set the variable true and show a bark. I used a Run Lua Code action, but you could just as easily set the variable true in the bark conversation.
barkOnce.png (53.34 KiB) Viewed 1142 times
I'm not sure what you mean by overriding the random barks. Do you mean it interrupts the random barks? The character's bark UI can only show on bark at a time. If the character is barking and the Dialogue System Trigger fires, it will replace the text in the bark UI.
Hi Tony, thanks for the visuals! It works perfectly. The overriding barks thing was my fault. I disabled the conversation on the NPC while I was trying to get the bark in range/bark once to work.