Page 1 of 1

How to trigger dialogue from script?

Posted: Sat Aug 14, 2021 5:18 am
by PepeJEe
Hey! I have a basic boxcollider which is trigger. When I enter inside the trigger zone and press "E" I want to trigger a conversation. How can I do that?
:)

-Pepe

Re: How to trigger dialogue from script?

Posted: Sat Aug 14, 2021 8:59 am
by Tony Li
Hi,

Use a Proximity Selector.

On the player, add a Rigidbody, collider, Proximity Selector, and Selector Use Standard UI Elements. Set the Proximity Selector's Use Key to E, and set the Use Message to something like "E) Interact".

On the basic boxcollider, add a Rigidbody (tick Is Kinematic), Usable, and Dialogue System Trigger. On the Dialogue System Trigger, select Add Actions > Start Conversation, and select your conversation.

Make sure the player's layer and the boxcollider's layer are configured to register collisions. (Edit > Project Settings > Physics)