Page 1 of 1

Conversation Priorities

Posted: Sun May 12, 2024 3:37 pm
by cungoliant
Hi, thanks for this great asset.

I have a question about conversation priorities.
I have a NPC prefab. It has Dialogue System Trigger that Barks on use with no condition.
This bark comes from GenericNPCGreet conversation that has generic texts such as "Hi", "Good day", "How are you?" etc.

By this, i wanted that; whenever player clicks (on use) on a Npc, he will not remain unanswered.

But, of course, some npc's have conversations or barks that gives quests or quest tips or something like that. These are naturally more important.
I added another Dialogue System Trigger component to these npcs that starts conversation or barks.

The problem is, although if a npc has an "important" bark, he barks from GenericNPCGreet.
Also, if a npc has a conversation, conversation starts but a warning in console says : Bark triggered, but a conversation is already active

Is it possible to do that; if npc has no other things to say (bark or conversation), bark from GenericNPCGreet?

Thanks in advance.

Re: Conversation Priorities

Posted: Sun May 12, 2024 4:34 pm
by Tony Li
Hi,

Yes. It depends on how you will determine if the NPC has something to say. Let's say you have two conversations:
  • "Greetings": Generic barks
  • "NPC Dialogue": Conversation whose nodes that are linked from <START> have Conditions on them. It's possible that one or more nodes' Conditions may be true, in which is the conversation has something to say. If none of the nodes' Conditions are true, the NPC has nothing to say and should bark instead.
In this case, in C# you can check if DialogueManager.ConversationHasValidEntry("NPC Dialogue") is true. You could make a method like:

Code: Select all

bool HasSomethingToSay(string conversationTitle)
{
    return DialogueManager.ConversationHasValidEntry(conversationTitle);
}
Then register that method with Lua.

Then you can set the bark Dialogue System Trigger's Conditions > Lua Conditions to:

Code: Select all

HasSomethingToSay("NPC Dialogue") == false

Re: Conversation Priorities

Posted: Sun May 12, 2024 5:44 pm
by cungoliant
Thank you very much Tony

Re: Conversation Priorities

Posted: Sun May 12, 2024 8:23 pm
by Tony Li
Glad to help!