Moving player towards NPC and automatically starting dialogue when NPC is clicked

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jlhacode
Posts: 77
Joined: Fri Jul 03, 2020 6:23 am

Moving player towards NPC and automatically starting dialogue when NPC is clicked

Post by jlhacode »

I'm working on a "click-to-move" game, and what I'm trying to accomplish is this:

1. Click on NPC
2. Move player towards NPC
3. Trigger Dialogue when Player gets close to NPC only when the NPC was the last thing clicked

What would be the best-practice approach to doing this with DialogueSystem?
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Moving player towards NPC and automatically starting dialogue when NPC is clicked

Post by Tony Li »

Hi,

Since the player could possibly click somewhere else while the PC is moving, it would be best to handle this outside of the Dialogue System. Only involve the Dialogue System when the player gets close to the NPC and the NPC was the last thing clicked. At that point, call DialogueManager.StartConversation() to start the conversation, or if you want to use a Dialogue System Trigger call the Dialogue System Trigger's OnUse() method.
Post Reply