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.
Top Down 2D JRPG game conversation trigger
Re: Top Down 2D JRPG game conversation trigger
Hi,
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.
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.
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.)
Configure the NPC like this:
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.