Detect new conversations in a conversation?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
alexlol
Posts: 35
Joined: Sat Nov 07, 2020 8:20 am

Detect new conversations in a conversation?

Post by alexlol »

Is there a simple way for me to detect whether a conversation has a new, previously inaccessible node? I'd like to use this to in order to tell my UI whether or not it needs to show the 'speak to' prompt.

A quick example to illustrate what I'm trying to do:

1) Player speaks to NPC 1, who tells them to speak to NPC 2.
2) Player speaks to NPC 2, who tells them to go back and speak to NPC 1 (setting a variable to unlock a new node in NPC 1's conversation).
3) Player returns to NPC 1 and accesses the new node, as the new conditions have been met.

All of this works fine. My problem: each NPC has a 'speak to' icon that appears above their heads which uses an OnTriggerEnter, and I would like this to not appear if all conversation nodes with that NPC are currently exhausted. In my mind, what I'm looking for is a simple if (conversationNotExhausted) bool which I can wrap my code in, inside the OnTriggerEnter, but perhaps there's a better way of doing it.

I feel like there's a simple solution to this I'm just not seeing. Pointers very welcome! Thanks.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Detect new conversations in a conversation?

Post by Tony Li »

Hi,

You can check DialogueManager.ConversationHasValidEntry(). Example:

Code: Select all

string myConversationTitle = GetComponent<DialogueSystemTrigger>().conversation;
bool shouldShowSpeakIcon = DialogueManager.ConversationHasValidEntry(myConversationTitle);
alexlol
Posts: 35
Joined: Sat Nov 07, 2020 8:20 am

Re: Detect new conversations in a conversation?

Post by alexlol »

That's exactly what I was looking for, thank you!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Detect new conversations in a conversation?

Post by Tony Li »

Happy to help!
Post Reply