Top Down 2D JRPG game conversation trigger

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Tony Chou
Posts: 7
Joined: Wed Jun 23, 2021 11:39 pm

Top Down 2D JRPG game conversation trigger

Post by Tony Chou »

I am working on a top down JRPG project.
I would like to implement the following features.
1. When the player is close to the NPC, press KeyCode.Z to start a conversation
2. User press KeyCode.Z to continue conversation.
3. To avoid repeated conversations caused by users pressing KeyCode.Z by mistake. After conversation end, delay 0.5 second to let NPC can be trigger again.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Top Down 2D JRPG game conversation trigger

Post by Tony Li »

Hi,
Tony Chou wrote: Sat Jun 26, 2021 11:16 am1. When the player is close to the NPC, press KeyCode.Z to start a conversation
Use a Proximity Selector component. (See Interaction Tutorial.) If you don't want to use a Proximity Selector, you can use your own interaction system. Just configure it to call the NPC's Dialogue System Trigger > OnUse method.
Tony Chou wrote: Sat Jun 26, 2021 11:16 am2. User press KeyCode.Z to continue conversation.
Add a UI Button Key Trigger component to your dialogue UI's continue button. Set its Key to Z. (See Dialogue UI Tutorial for info on customizing dialogue UIs.)

continueZ.png
continueZ.png (57.18 KiB) Viewed 336 times
Tony Chou wrote: Sat Jun 26, 2021 11:16 am3. To avoid repeated conversations caused by users pressing KeyCode.Z by mistake. After conversation end, delay 0.5 second to let NPC can be trigger again.
Configure the NPC like this:

usableTimedDelay.png
usableTimedDelay.png (69.96 KiB) Viewed 336 times

When the Dialogue System Trigger starts, it will start the conversation and disable the NPC's Usable component. When the conversation ends, it will start a timer that re-enables the Usable component after 0.5 seconds.
Post Reply