Consequence Scripting Manager

The Consequence Scripting Manager is an optional Blueprint class that provides project-specific hooks into global Consequence runtime behavior.

Use it when your project needs to extend Consequence with game-specific logic without modifying the Consequence plugin itself.

Creating a Consequence Scripting Manager

Create a Blueprint class inheriting from:

ConsequenceScriptingManager

Then open:

Project Settings → Plugins → Consequence Runtime Settings

and assign your Blueprint to:

Scripting Manager Class

When the Consequence System initializes at runtime, it will automatically create and manage an instance of the configured Scripting Manager.

You do not need to place the Scripting Manager in a level or create it manually.

See Engine Settings for the other Consequence Runtime Settings.

Initialization and Shutdown

The Scripting Manager provides optional hooks for project startup and shutdown.

Initialize Blueprint

Called after the Consequence System creates and initializes the Scripting Manager.

Use this for any project-specific setup that should happen when Consequence becomes available.

Deinitialize

Called when the Consequence System deinitializes.

Use this to perform any project-specific cleanup associated with your Scripting Manager.

Custom Payload Operations

Payloads can request project-specific behavior using the Operation Payload type.

Override:

Handle Payload Operation

to define how your project responds to these operations.

The function receives:

  • the Gameplay Tags supplied by the Payload
  • an optional numeric Payload value
  • the Consequence Conversation associated with the Payload, if applicable
  • the current or most recent speaking Actor, if applicable

A common convention is to use the first Payload Fact to identify the operation being requested, with any additional Facts or the numeric value supplying parameters.

This allows narrative content to request game-specific actions while keeping the implementation of those actions inside your game.

See Facts and Game State for more information about Payloads.

Triggering Events From Payloads

Consequence Payloads can also trigger another Consequence Event.

Handle Payload Trigger Event

provides the behavior used for Trigger Event Payloads and can be overridden if your project needs custom routing or context.

By default, the first Gameplay Tag supplied by the Payload identifies the Consequence Trigger Tag to fire.

A second optional tag can identify either:

  • a specific Character / speaker to use for the new Trigger, or
  • a project-specific speaker-selection method

Speaker-selection tags should use the:

Consequence.SpeakerSelection

Gameplay Tag hierarchy.

Consequence will still attempt to trigger the Event if no optional speaker is supplied or resolved.

Custom Speaker Selection

Override:

Select Speaker Based On Selection Tag

when your project uses Consequence.SpeakerSelection tags to describe game-specific ways of choosing a speaker.

For example, a project might define selection tags representing concepts such as:

Consequence.SpeakerSelection.NearestCompanion

or:

Consequence.SpeakerSelection.CurrentTarget

The exact tags and selection logic are project-defined.

The function receives the Payload Facts, the requested selection tag, and the most recent speaking Actor where available, and returns the Actor that should be used as the speaker for the new Event.

Adding Context to Payload-Triggered Events

Override:

Select Fact Context Objects For Payload Trigger Event

to provide additional UObject context for an Event triggered from a Payload.

This is useful when the new dialogue query needs information from game objects related to the previous conversation or the gameplay event that caused it.

The function can also provide a replacement speaker Actor if the project determines that a different Actor should be used after gathering the relevant context.

Adding Temporary Query Context

The Scripting Manager can add game-specific context immediately before Consequence performs dialogue selection.

Override:

Handle Additional Query Context

to modify the Additional Context of a Consequence Event Trigger before the best matching dialogue is selected.

This is useful for temporary information that should influence the current query but should not be permanently stored as saved Facts.

Examples include:

  • current player health
  • combat state
  • current location
  • relationships between the speaker and other Actors
  • properties of the current target
  • other short-lived gameplay context

Additional context can include temporary true Facts, numeric Fact Values, and UObject context references.

See Facts and Game State for more information about temporary query context.

Direct Event Query Context

Override:

Handle Direct Event Query Context

to provide the same kind of additional context when a Consequence Event is being triggered directly by Event reference rather than selected through a Trigger Tag.

This is useful if Line Conditions within a directly triggered Event still depend on temporary game context.

Subtitle Tiers

Override:

Determine Subtitle Tier

to assign a project-specific display tier to a subtitle.

The function receives the current Consequence Subtitle Data by reference, allowing you to modify its Tier value before the subtitle line widget handles its final presentation.

Your Subtitle Line Widget can then override:

Handle Subtitle Tier

to change visual treatment based on that value.

For example, a project could use different subtitle tiers for foreground conversations, background dialogue, radio dialogue, or other project-specific presentation categories.

See Subtitle Widgets for more information.

Gender-Aware Subtitle Text

The Scripting Manager provides several hooks used by Consequence's subtitle text processing:

Get Hero Gender

Returns the current gender to use when resolving text referring to the player-controlled hero.

Get Hero Actor

Returns the Actor that should be considered the hero. Override this if your project does not use Unreal's default Player Character for this purpose.

Get Speaker Gender

Returns the gender to use when resolving gender-aware text relating to the current speaking Actor.

Get Target Gender

Returns the gender to use when resolving gender-aware text relating to the target Actor associated with the subtitle.

These hooks allow localized FText gender formatting to use the correct runtime context.

See Localization for more information about Consequence's Unreal localization workflow.

Choice Input

Override:

Handle Choice Input

if your project needs additional game-specific behavior when the player selects a dialogue choice.

This hook is called by the Consequence System as part of choice input handling.

The configured Consequence Subtitle Widget is also given the choice input so that its displayed choice state can respond appropriately.

Responding to Save Loads and Respawns

When your project loads a saved game or otherwise restores gameplay state, call:

Respawned Or Loaded From Save

on the Consequence System as part of your game's load / respawn process.

The Scripting Manager's corresponding:

Respawned Or Loaded From Save

hook is then called, allowing project-specific logic to respond to the same event.

This is useful when your game needs to reset or rebuild other systems alongside Consequence's saved dialogue state, cooldowns, and currently playing Conversations.