Bark response system

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
cassbaygames
Posts: 5
Joined: Sat Jul 12, 2025 8:30 pm

Bark response system

Post by cassbaygames »

I'm trying to develop an "insult system" (A little bit Monkey Island inspired) where an NPC barks an insult at the player. The player has a window of time to press an input to "retort". I want to be able to have specific "retort" lines triggered that relate to the original insult.

I'm using a conversation for the barks, so I can choose a random bark from a list of valid ones based on game conditions. Ideally I'd like to just add appropriate "retorts" as child nodes to the original insults. But I need to work out how to store the original node, and then get the next valid child node for a separate bark event.

Can you describe a way to achieve this? Would I need to do something bespoke like store the original insult ID and then directly get the child's ID?
User avatar
Tony Li
Posts: 23434
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark response system

Post by Tony Li »

Hi,

You probably don't need to do anything custom for that. Here's a simple example:

DS_RetortExample_2025-07-12.unitypackage

It looks like this:
retorts.png
retorts.png (26.5 KiB) Viewed 466 times

I used these steps to set up the scene:

1. Wrote a conversation (intended to be an interactive conversation, not a bark) that has two NPC insults followed by player responses:
retortConversation.png
retortConversation.png (38.63 KiB) Viewed 466 times
I ticked conversation properties > Override Display Settings > Input Settings and set a Response Timeout value.

2. Added a capsule for the NPC. Gave it a Usable, Dialogue Actor (pointing to a child overhead bubble subtitle panel), and Dialogue System Trigger that starts the conversation.

3. Added a Selector to the Main Camera that can select Usables at the mouse position.

I just used the Basic Standard Dialogue UI's response menu, but you could use a different dialogue UI that assigns specific inputs to each response button, like this: (instructions)

Image
cassbaygames
Posts: 5
Joined: Sat Jul 12, 2025 8:30 pm

Re: Bark response system

Post by cassbaygames »

Hi Tony, thanks so much for your reply.

Unfortunately I haven't managed to communicate what I'm trying to do properly. I will try again as this solution isn't what I am after.

I don't want to enter a conversation, what I'm trying to do is just with barks. The original insult is a bark, and I want the player to have the option to simply press a dedicated key that will respond with another bark.

Here is a video of what I currently have:

In the example the NPC randomly decides to bark an insult: "Is that a mop?"
Then the players presses a key to trigger an insult back: "You call that a weapon..."

Right now these are pulling from different conversations to select the subtitle for each bark. I want the player's "retort" to be related to the original insult. Ideally I would simply write the retorts as child nodes of the original insults. But because this is not a conversation interaction and only in barks.

Image

I would like to be able to remember the last node that was barked by an enemy (original insult node), and then if the player triggers a bark in time, jump to a valid child node of that original insult node. This way I could simply create a conversation that had original insult nodes, and then relevant retorts as children beneath those.
User avatar
Tony Li
Posts: 23434
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark response system

Post by Tony Li »

Hi,

Sure, you can do that. If you're using barks, add a script with an OnBarkLine(Subtitle) method to the Dialogue Manager. In this method, record the dialogue entry. Example:

Code: Select all

private DialogueEntry lastBarkedEntry;

void OnBarkLine(Subtitle subtitle) => lastBarkedEntry = subtitle.dialogueEntry;
When you want to bark a retort that's linked from the last barked entry:

Code: Select all

void Retort()
{
    // Get the first entry linked from the bark:
    var retortEntry = DialogueManager.masterDatabase.GetDialogueEntry(lastBarkedEntry.outgoingLinks[0]);
    var conversationTitle = DialogueManager.masterDatabase.GetConversation(retortEntry.conversationID).Title;
    
    // Then bark it back:
    DialogueManager.Bark(conversationTitle, player, npc, retortEntry.id);
}
cassbaygames
Posts: 5
Joined: Sat Jul 12, 2025 8:30 pm

Re: Bark response system

Post by cassbaygames »

Hi Tony, that's working flawlessly. Amazing support thank you! I'm going to enjoy digging into this now - a fun little detail for players to mess around with for a little flavour.

User avatar
Tony Li
Posts: 23434
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark response system

Post by Tony Li »

Looks nice! Glad to help.
cassbaygames
Posts: 5
Joined: Sat Jul 12, 2025 8:30 pm

Re: Bark response system

Post by cassbaygames »

Hi Tony, sorry to open this one back up. I'm trying to go deeper and I'd love for the retort to be a group now, so I can then nest other dialogue logic beneath that to choose a random retort.

If I make the first outgoing link a group, is it possible to then search that group for a random valid entry?

e.g. with dream psuedo code

retort = lastBarkedEntry.outgoingLinks[0].GetRandomValidEntryFromAllOutgoingLinks();

Would the best way be to just loop through each outgoing link? How do you check if a link/entry is valid (passes all conditions) via script?
User avatar
Tony Li
Posts: 23434
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark response system

Post by Tony Li »

You could loop through lastBarkedEntry.outgoingLinks, manually check each linked entry's Conditions, and then randomly choose from the ones that are true. However, it may be simpler to let the Dialogue System do that. Create a ConversationModel that starts at the lastBarkedEntry, and check its responses. Example (just typed in below; may have typos):

Code: Select all

var conversationTitle = DialogueManager.masterDatabase.GetConversation(lastBarkedEntry.conversationID).Title;
var model = new ConversationModel(conversationTitle, player, npc, true, null, lastBarkedEntry.id);
var response = model.firstState.pcResponses[Random.Range(0, model.firstState.pcResponses.Length)];
var retortEntry = response.destinationEntry;
cassbaygames
Posts: 5
Joined: Sat Jul 12, 2025 8:30 pm

Re: Bark response system

Post by cassbaygames »

Ah, thank you! I actually got it behaving in my manual, convoluted way looping through all the outgoing links - this looks much cleaner though so I will give it a go!
Thanks again
Post Reply