Conversation available or not with NPC

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hassaanmustafa263
Posts: 3
Joined: Wed May 17, 2023 8:18 am

Conversation available or not with NPC

Post by hassaanmustafa263 »

Hi. I'm just new to this Dialogue System and stuck somewhere. When you approach an NPC (proximity selector) there appears a popup on the screen to interact with that NPC. When we press spacebar and If some conversation is available, the conversation starts successfully. But if there's no conversation available, nothing happens.

I want to detect whether any conversation is available or not. Is there a method or property available for detecting this?

Basically, I want to show something on-screen if we can chat (chat available) with the NPC and I want to hide that thing if we cannot chat with NPC (chat not available).

Thanks for anyone considering to reply. Any help will be much appreciated.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation available or not with NPC

Post by Tony Li »

Hi,

Thanks for using the Dialogue System! Please see: How To: Not Select Usable If Conditions Are False
hassaanmustafa263
Posts: 3
Joined: Wed May 17, 2023 8:18 am

Re: Conversation available or not with NPC

Post by hassaanmustafa263 »

Thanks for the quick reply. The solution you proposed is something different than what I wanted to achieve. Let me explain to you in detail.

I have an NPC with 5 conversations which gives me 5 quests. When I complete all 5 quests and then I approach the NPC (proximity selector) there appears a popup on the screen to interact with that NPC. But this time there is no conversation left in the dialogue system as I have completed all 5 conversations and quests but the popup still appears to interact with the NPC. (The popup says the name of the NPC and to press the space bar to interact). And when I press the space bar now, nothing happens. Which can be irritating for the users.

The issue is, when I have completed all 5 conversations, why does the popup still appear? How can I hide it if no conversation is left? (or maybe I don't have the suitable condition to have any conversation with the NPC). So how can I hide the popup?

Maybe there is a way through which I can know whether I can have a successful conversation with the NPC or not?
I hope you understand it now.

If I am unable to explain my point, please let me know.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation available or not with NPC

Post by Tony Li »

Hi,

If I understand you correctly, nothing in the Dialogue System Trigger's Conditions section will be false in this case. But the conversation you've specified in Actions > Start Converrsation may not currently have anything to show, since all of the quests have been completed. In this case, you can check DialogueManager.ConversationHasValidEntry. I updated the HOWTO above in this follow-up post.
hassaanmustafa263
Posts: 3
Joined: Wed May 17, 2023 8:18 am

Re: Conversation available or not with NPC

Post by hassaanmustafa263 »

Thanks a lot. That did the job.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation available or not with NPC

Post by Tony Li »

Glad to help!
Post Reply