3. Set the Context

Building a set of contexts, each with its own speaker and listener

Windows
MacOS
Linux
Prerequisite Topics

This page assumes you have prior knowledge of the following topics. Please read them before proceeding.

Now that we have our Dialogue Voices and Dialogue Wave set up, we can give our quest NPC some logic to create the right context for her greeting. Again, a Dialogue Context involves at least two Dialogue Voices, a Speaker and at least one Dialogue Voice that the dialogue is Directed At.

  1. Add a Box component to the Mixamo_SWAT Blueprint.

    AddBoxComponent.png

  2. In the Viewport, adjust the Box component so it is around the height of the character, and extends some distance in front of her. Make sure it doesn't overlap her, or set her Capsule component to not generate overlap events, or she will trigger the conversation logic herself.

    TriggerVolume.png

  3. Add a new Dialogue Wave variable named Greeting.

  4. Compile your Blueprint and set the default value to the QuestGreeting Dialogue Wave you made previously.

    QuestGreetingDetails.png

  5. Set up the following Blueprint graph.

    Copy Node Graph

    DialogueContextBP.png

    This graph: Fires after something overlaps the Box component Casts the Overlapping Actor to our MixamoCharacter_Master, where we added the Dialogue Voice variable Gets the voice from the Overlapping Actor and uses it as the Target for our Dialogue Context. Uses the Quest NPC's voice for the Speaker for our Dialogue Context. * Plays the **Dialogue Wave** named **Greeting** at our Quest NPC's location, using the correct **Dialogue Context**

    The Mixamo Animation pack comes with a Game Mode we can use to test our dialogue setup.

  6. Open World Settings.

  7. Set the GameMode Override to MixamoGame.

  8. Set the Default Pawn Class to Mixamo_Adam or Mixamo_Zoe.

    SetDefaultPawn.png

    Now, if the QuestNPC is placed in the level, you can run up to them with either Adam or Zoe and trigger the dialogue.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback