Adding a dialogue for an NPC¶
In this tutorial, you will learn how to:
- Add dialogues to the dialogue pool
- Attach the dialogue to a non-character player (NPC)
- Trigger the conversation in the game
In the Explorer window, add dialogues to the dialogue pool by choosing Gameplay > + New Dialogue.
Populate the dialogue.
Field Description Name The name of the dialogue. The name is the first text that a player sees when the conversation is activated. Sentence Sentences that speakers say during the conversation. You can add as many sentences as you like. NPC/Player This is the speaker type you can specify. You can create a consecutive conversation with it. Text The content of the sentence
Add another dialogue by choosing the + icon.
Creating an NPC and attaching a dialogue to it¶
Find a model in Asset Library and place it in the scene.
Make the model an NPC by attaching a Character component to it.
Add a Dialogue component to the NPC and select a dialogue from the dialogue pool. You can make the dialogue repetitive or one-off.
Adding a trigger for the convesation¶
- On the pane of the Dialogue component, set the trigger for the conversation. The default condition of the trigger is self-trigger on start.
Set the trigger condition to Touched by player. You can also try another condition and see how it works in your Space.
Now you can playtest it by switching to Play Mode.