Skip to content

UCrowdControlEffectComponent

Inherits UActorComponent

A self-contained Crowd Control effect. Add one component per effect to an actor, or create a Blueprint subclass for each effect. The component can register itself on BeginPlay, route matching requests to OnEffectTriggered, send the returned response, and manage the lifecycle of timed effects.

See the Effect Components tutorial for a walkthrough.

Public Member Functions

virtual

ECrowdControlEffectResult

OnEffectTriggered(const FString& RequestID, int32 Quantity, const FJsonObjectWrapper& Parameters, const FString& ViewerName)

Override in Blueprint or C++ to apply the effect. Return Pending when the request will be completed later with a Complete function. ViewerName may be empty for test effects.

virtual

void

OnEffectPaused()

Override to react when a timed effect is paused.

virtual

void

OnEffectResumed()

Override to react when a timed effect resumes.

virtual

void

OnEffectStopped()

Override to remove a timed effect's gameplay state when its duration expires or it is stopped early.

void

Register()

Registers menu metadata and routes matching requests to this component. Called automatically on BeginPlay when bAutoRegister is true.

void

Unregister()

Removes this component from request routing.

void

CompleteSuccess()

Completes the request that returned Pending with success.

void

CompleteFailTemporary(const FString& Message)

Completes the request that returned Pending with a temporary failure.

void

CompleteFailPermanent(const FString& Message)

Completes the request that returned Pending with a permanent failure.

bool

IsRunning()

Returns whether this timed effect is currently running.

bool

IsPaused()

Returns whether this timed effect is paused.

float

GetTimeRemaining()

Returns the remaining local duration in seconds.

void

Pause()

Pauses the local countdown, invokes OnEffectPaused, and notifies Crowd Control.

void

Resume()

Resumes the local countdown, invokes OnEffectResumed, and notifies Crowd Control.

void

Stop()

Ends the timed effect early and invokes OnEffectStopped.

bool

SetVisibility(bool bVisible)

Shows or hides this effect in the menu.

bool

SetAvailability(bool bAvailable)

Enables or disables purchases for this effect without changing its visibility.

void

HandleTrigger(const FString& RequestID, const FString& RoutedEffectID, float InDuration, int32 Quantity, const FJsonObjectWrapper& Parameters, const FString& ViewerName)

C++ only. Called by the subsystem to route a matching request into this component.

override

void

BeginPlay()

Registers the component when bAutoRegister is true and enables ticking only while needed.

override

void

EndPlay(const EEndPlayReason::Type EndPlayReason)

Unregisters the component and cleans up an active timed effect.

override

void

TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)

Advances the local countdown for a running timed effect.

Public Attributes

FString

EffectID

Unique effect ID. It must be lowercase, contain no spaces, and match the effect pack.

FString

DisplayName

The effect name shown to viewers.

FString

Description

The effect description shown to viewers.

int32

Price

The default price in coins. The editor clamps this to at least 1.

TArray

Categories

Menu categories assigned to the effect.

float

Duration

Duration in seconds. Zero creates an instant effect; a positive value creates a timed effect. The editor range is 0 to 600 seconds.

bool

bAutoRegister

Whether to register the effect automatically during BeginPlay. Defaults to true.