Skip to content

Dialogue Participant Interface

Dominik Morse edited this page Jun 10, 2024 · 1 revision

Mountea Dialogue Participant Interface Documentation

Overview

The Mountea Dialogue Participant Interface (IMounteaDialogueParticipantInterface) is an interface designed to connect the Mountea Dialogue Graph with the Mountea Dialogue Manager Component. This interface allows any actor to be a dialogue participant, handling various dialogue-related functionalities such as starting dialogues, playing participant voices, and managing dialogue states.

Class: IMounteaDialogueParticipantInterface

Description

This interface provides a comprehensive set of functions to handle dialogue processes within the game, including checking if a dialogue can start, saving and retrieving dialogue states, playing and skipping participant voices, and more. It includes several events to notify the system of changes in the dialogue state.


How to Use

C++

To use the IMounteaDialogueParticipantInterface in C++, follow these steps:

Implementing the Interface

Include the Interface Header:

   #include "Interfaces/MounteaDialogueParticipantInterface.h"
Inherit from the Interface:
void YourClass::InitializeParticipant_Implementation()
{
    // Your implementation code
}
Implement Required Functions:

Implement all pure virtual functions defined in the interface. For example:

void YourClass::InitializeParticipant_Implementation()
{
    // Your implementation code
}

Calling Interface Methods

Direct Calls:

For methods with default implementations, you can call them directly:

YourClassInstance->InitializeParticipant();

Using Execute_ Prefix for BlueprintCallable Functions:

For functions that are meant to be called from Blueprints and require BlueprintNativeEvent, use the Execute_ prefix:

IMounteaDialogueParticipantInterface::Execute_CanStartDialogueEvent(YourClassInstance);

or

TScriptInterface<IMounteaDialogueParticipantInterface> interface = YourClassInstance;
interface->Execute_CanStartDialogueEvent(YourClassInstance);

Blueprint

To use the IMounteaDialogueParticipantInterface in Blueprints:

Add the Interface to a Class:

Open the class settings in the Blueprint Editor. Under "Interfaces", click "Add" and select IMounteaDialogueParticipantInterface.

Implement Interface Functions:

Once the interface is added, you will see new functions in the Blueprint that you need to implement. Implement these functions by providing the necessary Blueprint logic.

Call Interface Functions:

You can call these interface functions from other Blueprints by using the appropriate nodes available in the Blueprint Editor.


Functions

Name Inputs Outputs
CanStartDialogueEvent None bool (Whether the dialogue can start)
GetOwningActor None AActor* (The owning actor)
SaveStartingNode NewStartingNode (The node to set as the starting node) None
SaveTraversedPath InPath (The traversed path of the dialogue graph to be saved) None
GetState None EDialogueParticipantState (The participant state)
GetTag None FGameplayTag (The participant gameplay tag)
InitializeParticipant None None
PlayParticipantVoice ParticipantVoice (The sound to play) None
SkipParticipantVoice ParticipantVoice (The sound to skip) None
CanStartDialogue None bool (Whether the dialogue can start)
GetSavedStartingNode None UMounteaDialogueGraphNode* (The saved starting node)
GetDialogueGraph None UMounteaDialogueGraph* (The dialogue graph)
SetDialogueGraph NewDialogueGraph (The new dialogue graph to be used) None
GetParticipantState None EDialogueParticipantState (The participant state)
SetParticipantState NewState (The new state to set the participant to) None
GetDefaultParticipantState None EDialogueParticipantState (The default participant state)
SetDefaultParticipantState NewState (The new default state to set the participant to) None
GetAudioComponent None UAudioComponent* (The audio component)
SetAudioComponent NewAudioComponent (The new audio component to use for dialogue audio) None
GetTraversedPath None TArray<FDialogueTraversePath> (The traversed path)
GetParticipantTag None FGameplayTag (The participant gameplay tag)

Events

Name Inputs Description
FDialogueGraphChanged UMounteaDialogueGraph* NewGraph Event triggered when the dialogue graph changes.
FDialogueParticipantStateChanged const EDialogueParticipantState& NewState Event triggered when the dialogue participant state changes.
FDialogueParticipantAudioComponentChanged const UAudioComponent* NewAudioComp Event triggered when the audio component changes.
FParticipantStartingNodeSaved const UMounteaDialogueGraphNode* NewSavedNode Event triggered when the starting node is saved.