How to trigger dialogue from script?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
PepeJEe
Posts: 18
Joined: Sat Apr 24, 2021 8:39 am

How to trigger dialogue from script?

Post 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
User avatar
Tony Li
Posts: 21722
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to trigger dialogue from script?

Post 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)
Post Reply