How-To: Make a Cast-Time Ability

Goal: an ability that winds up for a duration, can be interrupted, and only pays its cost when the cast completes.

Prerequisites
Quick Start.

1. Subclass the cast-time base

Right-click -> Blueprint Class -> `CrimsonGameplayAbility_WithCastTime`.

Verify
The new class exposes a Cast Time category in Class Defaults.

2. Set the cast time and commit point

ECrimsonAbilityCommitTime decides when the cost is actually paid.

ValueCost is paid
On ActivationImmediately, before the cast runs. Interrupting still costs the player.
On Cast CompletedOnly if the cast finishes. Interruption is free.
On Cast Completed and on InterruptedOn completion, and also when interrupted.
Cast time can be dynamic
Override Update Ability Cast Time (a BlueprintNativeEvent) to compute the duration from attributes - haste, a stack count, whatever. Read the resolved value back with Get Calculated Cast Time.
Verify
Activate the ability and confirm the cost is only deducted at the point you chose.

3. Handle interruption

The plugin tags casting state for you: Ability.State.Casting while the cast runs and Ability.State.Interrupted when it breaks. Listen for those rather than inventing your own.

Use Wait Gameplay Tag Add / Wait Gameplay Tag Remove on Ability.State.Casting to drive a cast bar.

Verify
Interrupt a cast. The tag is removed and, with On Cast Completed, no cost was paid.

See also

  • How-To: Use Toggle, Charges and Channeling
  • Concept: Ability Subclasses