How to Start Conversations

(Click Here for Conversation Trigger Video Tutorial)

The simplest way to start a conversation is to call:

DialogueManager.StartConversation("title");

or use the equivalent visual scripting action.

However, the Dialogue System provides components that make it easy to trigger conversations other ways, such as when a scene starts or when the player targets and "uses" an NPC.

This page explains how to set up those components.

In addition, you can also start conversations using Timeline Support.


Conversation Trigger

A Conversation Trigger starts a conversation with the GameObject when a specified trigger condition occurs, such as when the scene starts, when the NPC is enabled or used, or on a dialogue event such as the end of a cutscene sequence.

To make the NPC start a conversation with the player when used, set Trigger to OnUse and add a Usable component to the NPC. See How GameObjects Are Associated With Conversations for important information about how GameObject are associated in conversations.

You can also use a Dialogue System Trigger, which is a multipurpose triggering component that, among other functions, can start conversations.

More information: Conversation Trigger, Dialogue System Trigger


Start Conversation On Dialogue Event

The Start Conversation On Dialogue Event component starts a conversation with the GameObject when it's notified of a dialogue event such as the start or end of a conversation, bark, or sequence. See How GameObjects Are Associated With Conversations for important information about how GameObject are associated in conversations.

More information: Start Conversation On Dialogue Event


Components On Child GameObjects

You can put most Dialogue System components on child GameObjects to help you organize the NPC's components. If you do this, make sure to point properties such as Conversant to the main GameObject.


How GameObjects Are Associated With Conversations

NOTE: Actor GameObjects used in runtime conversations don't have to be the same as the actors assigned to the conversation in your dialogue database! See below for an explanation.

When you create a conversation in the Dialogue Editor, you'll assign an Actor and a Conversant from the dialogue database's list of actors.

When you set up a Conversation Trigger or similar trigger such as Dialogue System Trigger, you can assign GameObjects to the Actor and Conversant fields. These GameObjects can represent different actors than those assigned to the conversation in your dialogue database.

The conversation will use these GameObjects even if their names don't match the actors assigned to the conversation. This allows you to reuse conversations for different characters – for example, reusing the same shopkeeper conversation for all shopkeepers in your game world. In your dialogue database, you can create a generic actor named "Shopkeeper" with a generic conversation such as: "Hello, I'm [var=Conversant]. Welcome to my shop!" etc. Then reuse the same shopkeeper conversation for each village's shopkeeper and simply assign the specific village shopkeeper to the Conversation Trigger's Conversant field.

If you don't assign the Actor field, the Conversation Trigger will try to choose an appropriate GameObject. For example, if you've set the trigger type to OnTriggerEnter, the Conversation Trigger will use the GameObject that touched the trigger as the Actor.

If you don't assign the Conversant field, the Conversation Trigger will generally choose the GameObject that the Conversation Trigger is on.

If you need to point the conversation to certain characters, manually assign the Conversation Trigger's Actor and Conversant fields – for instance, so they match the actor definitions in the conversation.

The Dialogue System only uses the Conversation's Trigger's Actor and Conversant fields for the primary Actor and Conversant defined in the conversation. If the conversation involves additional actors, the Dialogue System will look for GameObjects whose names match the the additional actors' names in the dialogue database. If the character's GameObject name doesn't match its actor name, add an Override Actor Name component. This will associate the GameObject with a specific actor name.

You can also change the actual names displayed in PC/NPC Portrait Names by using an Override Actor Name component. This applies to the conversation's primary Actor and Conversant only.


<< How to Set Up NPCs | How to Play Barks >>