Adding Narrative Design to your Character
Follow this guide to incorporate Narrative Design into your Convai-powered characters. Follow this step-by-step tutorial, open your project, and let's begin!
Convai Playground
Step 1: Select your Character in which you want to enable Narrative Design

Step 2: Open Narrative Design in Convai Playground
Select the Narrative Design option from the side panel and create your narrative design

For this sample we have created the following Narrative design

You are all set to bring your character from Convai Playground to Unity, let's hope over to Unity to continue the guide
Unity Setup
Step 1: Add the Narrative Design Manager Component
Using Add Components Button in Convai NPC (Recommended Way)
1: Select your Convai Character in the scene and look for ConvaiNPC component in the inspector panel. Click on Add Components button

2: Select Narrative Design Manager checkbox and then click on Apply Changes button

Using Unity Inspector
1: Select your Convai Character and find Add Component button in the inspector panel

2: Search for Narrative Design Manager
in the search box and select it
Narrative Design Manager
in the search box and select it
Step 2: Setup the Narrative Design Component
After adding the Narrative Design Component, you will be able to be the following component
This component system assumes that API key is setup correctly, so ensure that API key is setup correctly otherwise an error will be thrown.
The following section events are for character used in demo, and you will see section events corresponding to your character in which Narrative Design is enabled.

Getting to know the Narrative Design Component
Expanding the section event, you will see two unity events you can subscribe to, one is triggered when section starts, and another one is triggered when section ends

Getting to know about Section Triggers
Section triggers are a way to directly invoke a section in narrative design and can be used to jump to a different section in your narrative design
Step 1: Select the game object you want to make a trigger, in this example we have selected a simple cube, but it's up to your imagination.

Step 2: Add Narrative design Trigger from Add Component menu by searching for it

Step 3: Make the collider a trigger.

Step 4: Assign your Convai NPC to Convai NPC field

Now you can select from the "Trigger" dropdown which trigger should be invoked when player enters this trigger box.
We have added a way for you to manually invoke this trigger also, you can use InvokeSelectedTrigger
function to invoke the trigger from any where

Invoke Trigger from any script
You can use this code block as a reference to invoke the trigger from anywhere
if(convaiNPC.TryGetComponent(out NarrativeDesignTrigger narrativeDesignTrigger))
{
//Optional message parameter if you want to send some message while invoking
//the trigger
string message = "Player has collected enough resources";
narrativeDesignTrigger.InvokeSelectedTrigger(message);
}
Last updated
Was this helpful?