How to Add a Dialogue
This guide explains how to create a dialogue in RPG Engine v6 by
adding rows to a DataTable based on the FDialogueContainer
structure. Dialogues are used for quests, trading, and NPC
interactions.
Prerequisites
Before you start, make sure that:
- The dialogue system is configured
(
BP_DialoguesComponenton characters, UI widgets set up). - You have a clear idea of the dialogue flow: who speaks, what they say, and what choices the player has.
- If the dialogue is for a quest, the quest already exists in
DT_Quests. - If the dialogue is for a vendor, the NPC is a child of
BP_RPG_AI_NPC_Shopwith configuredItemsForSale.
For detailed information on creating quests, see
how-to-add-quest.md.
For creating vendor NPCs, seehow-to-add-vendor-npc.md.
Step 1 – Create a New Dialogue DataTable
All dialogues are stored in separate DataTables, but they all share
the same row structure: FDialogueContainer.
- In the Content Browser, right‑click and choose Miscellaneous → Data Table.
- Select
FDialogueContaineras the row structure. - Name the DataTable (e.g.,
DT_Dialogue_Quest_01,DT_Dialogue_Trader_Greeting). - Open the DataTable to start adding rows.
Step 2 – Understand the Dialogue Structure
A dialogue is built from rows. Each row represents one node in the conversation.
A node contains: — A phrase (who speaks, what they say, optional animations) — A list of possible answers (if any) — A final result when the dialogue ends
The conversation flows by linking nodes through the
Answers array.
Step 3 – Define the Dialogue Flow
Plan your dialogue as a tree:
- Node 1: NPC speaks (no choice, just a greeting).
- Node 2: Player has multiple answer options (e.g., “Tell me about the quest”, “I want to trade”, “Goodbye”).
- Node 3: NPC responds to the chosen answer.
- Node 4: The dialogue ends with a result (GiveQuest, StartTrading, etc.).
Step 4 – Add Rows to the DataTable
Each row corresponds to one node in the dialogue flow.
4.1. Add the First Node (NPC Greeting)
- Add a new row and give it a Row Name (e.g.,
1). - Fill the
Dialoguestruct:- Phrase → DialogueSide – set to
NPC. - Phrase → Text – the greeting text.
- Answers – add an array of RowHandles pointing to
the next nodes (e.g.,
1.1,1.2, etc.).
- Phrase → DialogueSide – set to
4.2. Add Player Answer Nodes
For each possible player answer:
- Add a new row with a Row Name that indicates the
choice (e.g.,
1.1,1.2). - Fill the
Dialoguestruct:- Phrase → DialogueSide – set to
Player. - Phrase → Text – the text of the answer the player can select.
- Answers – add a RowHandle pointing to the NPC response node that follows this choice.
- Phrase → DialogueSide – set to
4.3. Add NPC Response Nodes
For each player choice, add a row for the NPC’s response:
- Add a new row with a Row Name that reflects the
choice path (e.g.,
1.1.1,1.2.1). - Fill the
Dialoguestruct:- Phrase → DialogueSide – set to
NPC. - Phrase → Text – the NPC’s response.
- Answers – if the dialogue continues, add RowHandles
to the next nodes. If this is the end, leave
Answersempty and setDialogueFinishedResult.
- Phrase → DialogueSide – set to
4.4. Set the Final Result
For the last node in a dialogue branch (where Answers is
empty):
- Set DialogueFinishedResult to the desired outcome:
None– dialogue ends with no action.AI Attack– the NPC attacks the player.GiveQuest– the player receives the quest (must have a quest active for this NPC).GiveReward– the player receives the quest reward.StartTrading– opens the vendor UI (only works if the NPC is a child ofBP_RPG_AI_NPC_Shop).DeclineQuestRequest– the player declines the quest.
- Optionally, configure Visuals:
ChangeCamera– switch to a dedicated dialogue camera.AttachCameraToCustomSocket– attach the camera to a specific socket.CustomSocket– the socket name to attach to.
Step 5 – Naming Convention for Rows
To keep the dialogue tree organized, use a hierarchical naming system:
| Row Name | Speaker | Meaning |
|---|---|---|
| 1 | NPC | First greeting |
| 1.1 | Player | First choice |
| 1.2 | Player | Second choice |
| 1.1.1 | NPC | Response to first choice |
| 1.2.1 | NPC | Response to second choice |
| 1.1.1.1 | Player | Optional follow‑up, etc. |
This naming is not required by the engine but helps designers navigate complex dialogues.
Step 6 – Configure Optional Fields
You can leave these fields empty for a basic dialogue:
Text Alternatives– use for random variation of the same phrase.Face Animation– AnimMontage for facial animation (requires a skin with a separate head using theSKEL_FaceMetahumansskeleton).Body Animation– AnimMontage for body animation.Visuals– camera controls.
If you use Face Animation or
Body Animation, they will play automatically when that
phrase is active.
Example existing animations: A_EnergyDrinks,
A_Drink, etc.
Step 7 – Link the Dialogue to an NPC or Quest
For Quests
The dialogue reference is stored in DT_Quests. In your
quest row, set:
Give Quest Dialogue– the dialogue DataTable used when the NPC offers the quest.End Quest Dialogue– the dialogue DataTable used when the player turns in the quest.Quest not Finished Dialogue– the dialogue shown if the player tries to turn in an incomplete quest.
For Vendors
The dialogue reference is stored in BP_AI_Component on
the NPC. In the NPC Blueprint:
- Open the vendor NPC (child of
BP_RPG_AI_NPC_Shop). - Find the
BP_AI_Component. - Set the Dialogue parameter to the DataTable you created.
Vendor dialogues typically end with
DialogueFinishedResult = StartTrading.
For Generic NPCs (No Quest, No Shop)
If the NPC is not a quest giver or vendor, you can still attach a
dialogue through BP_AI_Component on any AI. The dialogue
will play when the player interacts, and can end with None
or AI Attack.
Step 8 – Test the Dialogue
- Place the NPC in the level (if not already placed).
- Start the game in PIE.
- Approach the NPC and press the interaction key.
- Verify that:
- The dialogue UI opens.
- The NPC speaks the correct lines.
- Player choices appear as expected.
- Selecting an answer advances the dialogue correctly.
- At the end, the correct
DialogueFinishedResulttriggers (quest given, trading opens, etc.).
If the dialogue does not behave as expected: — Check that the
Answers array in each node points to the correct RowNames.
— Verify that the final node has an empty Answers array and
a valid DialogueFinishedResult. — For quest dialogues,
confirm the quest exists in DT_Quests and has
ByNPC = true. — For vendor dialogues, confirm the NPC is a
child of BP_RPG_AI_NPC_Shop and has
ItemsForSale configured.
Summary Checklist
Related Docs
docs/systems/quests-and-dialogues.md– dialogue system architecture and runtime behavior.docs/how-to/progression-and-quests/how-to-add-quest.md– creating quests that use dialogues.docs/how-to/progression-and-quests/how-to-add-quest-npc.md– setting up an NPC to give quests.docs/how-to/progression-and-quests/how-to-add-vendor-npc.md– setting up an NPC for trading.