We're using Dialogue System and Quest Machine for our new project, Dungeons of Atonement.
I'm testing various type of "bark" interactions with NPCs.
I want to make a NPC that "barks on idle", that part is simple.
But I want him to play different barks when the player interacts with him, now I don't know the correct way to do that.
I use SimStatus to alternate between barks.
Barks on Idle:
"Dum, dee dum..."
"Hmm-hmm, hmm-hmm..."
(he's just singing)
Barks on interact:
First time: "What a beautiful day, wouldn't you say?"
Second time: "Oh, the sweet solace of labour!"
Forever after: "Pom, pom-pom, pom...."
Basically, should it be structured like this:
Or like this?
Thank you so much!
Edit: I should mention I wish it all to be in one conversation, I'd prefer to have only one conversation graph per NPC.
Re: Play different barks on idle versus on interact
Posted: Tue Apr 22, 2025 7:11 pm
by Tony Li
Hi,
If you don't mind using two different conversations, it'll be a lot cleaner. (Note that you can use forward slashes ( / ) in conversation titles to group them into submenus.) Point the Bark On Idle component to one conversation and your Dialogue System Trigger (triggered on use/interact) to the other conversation.
For the bark on interact conversation, use a variable to keep track of which node it should bark. For example, say you have a Number variable named "Cellarer.Bark" whose initial value is 0. Then:
Node 1 - Dialogue Text: "What a beautiful day, wouldn't you say?"
Conditions: Variable["Cellarer.Bark"] == 0
Script: Variable["Cellarer.Bark"] = 1
Node 1 - Dialogue Text: "Oh, the sweet solace of labour!"
Conditions: Variable["Cellarer.Bark"] == 1
Script: Variable["Cellarer.Bark"] = 2
If you absolutely must use a single conversation, you can link the <START> node to two nodes, see below.
Spoiler
1. The first node will contain all bark on idle text inside a RandomElement() Lua function:
Dialogue Text: [lua(RandomElement("Dum, dee dum...|Hmm-hmm, hmm-hmm..."))]
Set the Bark On Idle component's Bark Order to First Valid.
2. The second node will contain all bark on interact text:
Dialogue Text: [lua(RandomElement("What a beautiful day, wouldn't you say?|Oh, the sweet solace of labour!|Pom, pom-pom, pom...."))]
Tick the Dialogue System Trigger's Actions > Bark > Specify Bark Entry, and specify this node. However, if it must go in order, this node's text will need to be more complex. I can write that up, but I'll skip it unless you really need it.
Re: Play different barks on idle versus on interact
Posted: Tue Apr 22, 2025 9:00 pm
by Matt_VoxPrima
Oh okay!
Hmm okay I understand that any method other than creating a conversation for barks on idle and another conversation for barks on interact would be a bit over-complicated. There are no condition really to distinguish the two types of barks.
Is there a way to reorder the submenus, or set them to alphabetical order? It's getting a bit messy since I'm adding a graph for every NPCs.
Re: Play different barks on idle versus on interact
Posted: Tue Apr 22, 2025 9:50 pm
by Tony Li
> Is there a way to reorder the submenus, or set them to alphabetical order? It's getting a bit messy since I'm adding a graph for every NPCs.
Yes! To set conversations to alphabetical order, in the Dialogue Editor you can use Menu > Sort > By Title.
To reorder them manually, use Menu > Outline Mode. Then you can drag conversation titles up and down.
You can also use the filter bar next to the conversation title dropdown (just below the "Database | Actors |..." tabs) to filter the dropdown menu.
Re: Play different barks on idle versus on interact
Posted: Wed Apr 23, 2025 1:30 am
by Matt_VoxPrima
Genius! This will be tremendously helpful. Thank you!
Re: Play different barks on idle versus on interact
Posted: Wed Apr 23, 2025 1:48 am
by Matt_VoxPrima
- Is there a way to deactivate "Bark On Idle" while a bark on interact is playing? So that "What a beautiful day, wouldn't you say?" doesn't get interrupted by "Dum, dee dum..."
- I don't know why but the barks are "following" my player off screen.
Re: Play different barks on idle versus on interact
Posted: Wed Apr 23, 2025 8:23 am
by Tony Li
Hi,
I'll assume you're using a Dialogue System Trigger to trigger barks on interact. To prevent idle barks while a bark on interact is playing:
1. On the Bark On Idle component, tick Bark On Enable.
2. On the Dialogue System Trigger select Add Action > OnExecute() UnityEvent. Configure the UnityEvent to disable the Bark On Idle component.
3. Add a Dialogue System Events component to the NPC. Configure the OnBarkEnd() UnityEvent to re-enable the Bark On Idle component.
To keep bark UIs positioned over the NPC's head, untick the bark UI's Keep In View checkbox.
Re: Play different barks on idle versus on interact
Posted: Wed Apr 23, 2025 12:32 pm
by Matt_VoxPrima
Works like a charm!! Thank you again!
Re: Play different barks on idle versus on interact