Unraed Docs

Documentation for Unraed plugins and projects

Click here to return to table of contents.

Dialogue Tree: Dialogue Speaker Component

Extends: UAudioComponent

A component representing a “Speaker” or participant in a dialogue. Serves as a liaison between the dialogue and the game world, as well as playing any actual audio clips.

Contents

  1. Blueprint Callable Methods
  2. Blueprint Implementable Methods
  3. Data Attributes

1. Blueprint Callable Methods

The following methods can be called but not overridden via blueprint.

Set Display Name (BlueprintCallable)

/**
* Sets the speaker's display name to the provided text.
* 
* @param InDisplayName - FText, the new display name. 
*/
void SetDisplayName(FText InDisplayName);


Set Dialogue Name (BlueprintCallable)

/**
* Sets the speaker's dialogue name (the name to use for matching it 
* automatically into a dialogue role). 
* 
* @param InDialogueName - FName, the new dialogue name. 
*/
void SetDialogueName(FName InDialogueName);


Get Display Name (BlueprintCallable, Pure)

/** 
* Retrieves the display name for the speaker.
*
* @return FText, the display name. 
*/
FText GetDisplayName() const;


Get Dialogue Name (BlueprintCallable, Pure)

/**
* Retrieves the dialogue name for the speaker. This is used for matching
* the speaker component to its role in a dialogue.
* 
* @return FName - the speaker's dialogue name. 
*/
FName GetDialogueName() const;


Set Owned Dialogue (BlueprintCallable)

/**
* Sets the speaker's owned dialogue to the provided dialogue asset. 
* 
* @param InDialogue - UDialogue*, the target dialogue. 
*/
void SetOwnedDialogue(UDialogue* InDialogue);


Get Owned Dialogue (BlueprintCallable, Pure)

/**
* Retrieves the speaker's owned dialogue. 
* 
* @return UDialogue*, the owned dialogue. 
*/
UDialogue* GetOwnedDialogue();


Get Gameplay Tags (BlueprintCallable, Pure)

/**
* Gets gameplay tag container for any ongoing speech. 
* 
* @return FGameplayTagContainer
*/
FGameplayTagContainer GetGameplayTags();


Start Owned Dialogue With Names (BlueprintCallable)

/**
* Starts the default dialogue for this speaker component. Uses the provided
* name-speaker pairings for matching with target dialogue. 
* 
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue. 
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to 
* false. 
*/
void StartOwnedDialogueWithNames(TMap<FName, UDialogueSpeakerComponent*> InSpeakers, 
   bool bResume);


Start Owned Dialogue (BlueprintCallable)

/**
* Starts the default dialogue for this speaker component. Attempts to 
* match the provided speaker's dialogue names to those expected
* by the dialogue. Duplicate or unfilled names not allowed. 
* 
* @param InSpeakers - TArray<UDialogueSpeakerComponent*>, the conversing 
* speakers. 
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to 
* false. 
*/
void StartOwnedDialogue(TArray<UDialogueSpeakerComponent*> InSpeakers, bool bResume);


Start Dialogue With Names (BlueprintCallable)

/**
* Starts the given dialogue. Uses the provided name-speaker pairings for
* matching with target dialogue.
* 
* @param InDialogue - UDialogue*, the dialogue to start. 
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue. 
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to 
* false. 
*/
void StartDialogueWithNames(UDialogue* InDialogue, 
   TMap<FName, UDialogueSpeakerComponent*> InSpeakers, bool bResume);


Start Dialogue (BlueprintCallable)

/**
* Starts the given dialogue. Uses the provided speakers' dialogue names 
* for matching with target dialogue. Duplicate or unfilled dialogue names
* not allowed.
* 
* @param InDialogue - UDialogue*, the dialogue to start. 
* @param InSpeakers - TArray<UDialogueSpeakerComponent*> the conversing
* speakers. 
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to 
* false. 
*/
void StartDialogue(UDialogue* InDialogue, TArray<UDialogueSpeakerComponent*> InSpeakers, 
   bool bResume);


Start Owned Dialogue With Names At (BlueprintCallable)

/**
* Starts the default dialogue for this speaker component at the given 
* NodeID location. Uses the provided name-speaker pairings for matching 
* with target dialogue.
*
* @param InNodeID - FName, the target node ID to start at. 
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue.
*/
void StartOwnedDialogueWithNamesAt(FName InNodeID, 
   TMap<FName, UDialogueSpeakerComponent*> InSpeakers);


Start Owned Dialogue At (BlueprintCallable)

/**
* Starts the default dialogue for this speaker component at the given node 
* ID. Attempts to match the provided speaker's dialogue names to those 
* expected by the dialogue. Duplicate or unfilled names not allowed.
*
* @param InNodeID - FName, the target node to start at. 
* @param InSpeakers - TArray<UDialogueSpeakerComponent*>, the conversing
* speakers.
*/
void StartOwnedDialogueAt(FName InNodeID, TArray<UDialogueSpeakerComponent*> InSpeakers);


Start Dialogue With Names At (BlueprintCallable)

/**
* Starts the given dialogue at the given node ID. Uses the provided 
* name-speaker pairings for matching with target dialogue.
*
* @param InDialogue - UDialogue*, the dialogue to start.
* @param InNodeID - FName, the target node to start at. 
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue.
*/
void StartDialogueWithNamesAt(UDialogue* InDialogue, FName InNodeID,
	TMap<FName, UDialogueSpeakerComponent*> InSpeakers);


Start Dialogue At (BlueprintCallable)

/**
* Starts the given dialogue at the given node ID. Uses the provided 
* speakers' dialogue names for matching with target dialogue. Duplicate 
* or unfilled dialogue names not allowed.
*
* @param InNodeID - FName, the target node to start at. 
* @param InDialogue - UDialogue*, the dialogue to start.
* @param InSpeakers - TArray<UDialogueSpeakerComponent*> the conversing
* speakers.
*/
void StartDialogueAt(UDialogue* InDialogue, FName InNodeID,
	TArray<UDialogueSpeakerComponent*> InSpeakers);


End Current Dialogue (BlueprintCallable)

/**
* Ends the dialogue the speaker is currently participating in, if applicable. Does nothing 
* if the speaker is not engaged in dialogue. 
*/
void EndCurrentDialogue();


Try Skip Speech (BlueprintCallable)

/**
* Attempts to skip the current speech that is playing. Does nothing if the 
* speaker component is not engaged in dialogue. 
*/
void TrySkipSpeech();

Note: A common issue encountered here occurs when game input is set to not be allowed in the project settings. This blocks all input, which prevents TrySkipSpeech() getting called. You can bypass this restriction in one of two ways. Either allow game input while in dialogue, or implement an override of OnKeyDown() or OnMouseDown() in a custom Dialogue Widget.

2. Blueprint Implementable Methods

The following methods can have their behavior implemented or altered in blueprints.

Play Speech Audio Clip (BlueprintNativeEvent)

/**
* Plays the given audio clip. Exposed to blueprint to be
* user-overridable. 
* 
* @param InAudio - USoundBase*, the audio clip. 
*/
void PlaySpeechAudioClip(USoundBase* InAudio);


3. Data Attributes

Data attributes associated with the class.

Display Name (EditAnywhere, BlueprintReadWrite)

Dialogue Name (EditAnywhere, BlueprintReadWrite)

Owned Dialogue (EditAnywhere, BlueprintReadWrite)

Gameplay Tags (BlueprintReadOnly)

On Gameplay Tags Changed (BlueprintAssignable)

On Speech Skipped (BlueprintAssignable)