Effects

Full API reference for the DialogueEffect base class and built-in effect types — SetRecords and ToggleEntitiesActive.

Effects are synchronous actions executed from EffectsNodeData nodes within a dialogue sequence. When the Dialogue Sequencer encounters an Effects node, it calls DoEffect() on each DialogueEffect in the node’s list in order, then immediately advances to the next node.

All effects are polymorphic — extending the base class automatically populates the effects list in the dialogue editor at startup.

For usage guides and setup examples, see The Basics: GS_Cinematics.

 

Contents


DialogueEffect (Abstract Base)

The base class for all dialogue effects. Effects execute synchronously and can be reversed for rollback scenarios.

PropertyTypeDescription
TypeId{71E2E05E-A7A3-4EB3-8954-2F75B26D5E3A}

Virtual Methods

MethodDescription
DoEffect()Executes the effect. Called by the sequencer when the EffectsNodeData is processed.
ReverseEffect()Undoes the effect. Used for rollback or undo scenarios.

Lifecycle

  1. The sequencer encounters an EffectsNodeData node.
  2. The sequencer calls DoEffect() on each effect in the node’s list in order.
  3. All effects complete synchronously within the same frame.
  4. The sequencer immediately advances to the next node.

SetRecords_DialogueEffect

Sets one or more game records in the GS_Save RecordKeeper system. Commonly used to flag quest progress, NPC disposition, or world state changes triggered by dialogue.

PropertyTypeDescription
TypeId{FFCACF63-0625-4EE5-A74B-86C809B7BF80}
RecordsAZStd::vector<RecordEntry>List of record name/value pairs to set on execution.

ToggleEntitiesActive_DialogueEffect

Activates or deactivates a list of entities in the level. Used to show or hide objects, enable or disable triggers, or change world state during dialogue.

PropertyTypeDescription
TypeId{F97E1B87-EE7A-4D26-814C-D2F9FA810B28}
EntitiesAZStd::vector<AZ::EntityId>The entities to activate or deactivate.
ActiveboolTarget active state: true to activate, false to deactivate.

Complete Effect Type Reference

TypeTypeIdDescription
DialogueEffect{71E2E05E-A7A3-4EB3-8954-2F75B26D5E3A}Abstract base
SetRecords_DialogueEffect{FFCACF63-0625-4EE5-A74B-86C809B7BF80}Sets game records
ToggleEntitiesActive_DialogueEffect{F97E1B87-EE7A-4D26-814C-D2F9FA810B28}Activates/deactivates entities

Creating a Custom Effect

To add a custom effect type from an external gem:

1. Define the class

#pragma once
#include <GS_Cinematics/Dialogue/Effects/DialogueEffect.h>

namespace MyGem
{
    class PlaySound_DialogueEffect : public GS_Cinematics::DialogueEffect
    {
    public:
        AZ_RTTI(PlaySound_DialogueEffect, "{YOUR-UUID-HERE}", GS_Cinematics::DialogueEffect);
        AZ_CLASS_ALLOCATOR(PlaySound_DialogueEffect, AZ::SystemAllocator);

        static void Reflect(AZ::ReflectContext* context);

        void DoEffect() override;
        void ReverseEffect() override;

    private:
        AZStd::string m_soundEvent;
    };
}

2. Implement and reflect

#include "PlaySound_DialogueEffect.h"
#include <AzCore/Serialization/SerializeContext.h>

namespace MyGem
{
    void PlaySound_DialogueEffect::Reflect(AZ::ReflectContext* context)
    {
        if (auto sc = azrtti_cast<AZ::SerializeContext*>(context))
        {
            sc->Class<PlaySound_DialogueEffect, GS_Cinematics::DialogueEffect>()
                ->Version(1)
                ->Field("SoundEvent", &PlaySound_DialogueEffect::m_soundEvent);

            if (auto ec = sc->GetEditContext())
            {
                ec->Class<PlaySound_DialogueEffect>("Play Sound", "Fires a sound event during dialogue.")
                    ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                        ->Attribute(AZ::Edit::Attributes::Category, "MyGem/Effects")
                    ->DataElement(AZ::Edit::UIHandlers::Default, &PlaySound_DialogueEffect::m_soundEvent, "Sound Event", "");
            }
        }
    }

    void PlaySound_DialogueEffect::DoEffect()
    {
        // Fire the sound event
    }

    void PlaySound_DialogueEffect::ReverseEffect()
    {
        // Stop the sound if needed
    }
}

Custom effects are discovered automatically at startup through O3DE serialization — no manual registration step is required.


See Also

For conceptual overviews and usage guides:

For component references:

For related resources:


Get GS_Cinematics

GS_Cinematics — Explore this gem on the product page and add it to your project.