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_DialoguesComponent on 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_Shop with configured ItemsForSale.

For detailed information on creating quests, see how-to-add-quest.md.
For creating vendor NPCs, see how-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.

  1. In the Content Browser, right‑click and choose Miscellaneous → Data Table.
  2. Select FDialogueContainer as the row structure.
  3. Name the DataTable (e.g., DT_Dialogue_Quest_01, DT_Dialogue_Trader_Greeting).
  4. 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)

  1. Add a new row and give it a Row Name (e.g., 1).
  2. Fill the Dialogue struct:
    • 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.).

4.2. Add Player Answer Nodes

For each possible player answer:

  1. Add a new row with a Row Name that indicates the choice (e.g., 1.1, 1.2).
  2. Fill the Dialogue struct:
    • 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.

4.3. Add NPC Response Nodes

For each player choice, add a row for the NPC’s response:

  1. Add a new row with a Row Name that reflects the choice path (e.g., 1.1.1, 1.2.1).
  2. Fill the Dialogue struct:
    • 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 Answers empty and set DialogueFinishedResult.

4.4. Set the Final Result

For the last node in a dialogue branch (where Answers is empty):

  1. 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 of BP_RPG_AI_NPC_Shop).
    • DeclineQuestRequest – the player declines the quest.
  2. 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 NameSpeakerMeaning
1NPCFirst greeting
1.1PlayerFirst choice
1.2PlayerSecond choice
1.1.1NPCResponse to first choice
1.2.1NPCResponse to second choice
1.1.1.1PlayerOptional 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 the SKEL_FaceMetahumans skeleton).
  • 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.


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:

  1. Open the vendor NPC (child of BP_RPG_AI_NPC_Shop).
  2. Find the BP_AI_Component.
  3. 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

  1. Place the NPC in the level (if not already placed).
  2. Start the game in PIE.
  3. Approach the NPC and press the interaction key.
  4. 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 DialogueFinishedResult triggers (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


  • 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.