UGantryAsyncAction_ListenForHook
Listen For Hook: a Blueprint node that takes part each time a hook runs, until you cancel it or the object that started it is destroyed.
For example, a hard difficulty mode doubles the damage a crate does:
- Add Listen For Hook. Set Channel to the game's damage hook and Payload Type to its struct.
- From On Hook, call Get Hook Payload on the Async Action pin into a variable of that struct, change the variable, and call Set Hook Payload with it: the game reads your change back.
- Call Mark Handled to tell the game you did the work yourself, or Cancel Hook to stop it (no later listener runs, and the game should not go on).
Priority orders the listeners: higher runs first. Payload access and Mark Handled / Cancel Hook work only inside On Hook, which runs while the game waits.
- Inherits
UCancellableAsyncAction
Properties
| Property | Type | Default | Description |
|---|---|---|---|
OnHook | FGantryOnHook | () | Fires each time the hook runs. Read and change the payload through the node while it runs. |
PayloadType | TObjectPtr<UScriptStruct> | None |
Functions
CancelHook
Stops the hook: no later listener runs, and the game should not go on.
Only inside On Hook.
GetPayload
Copies the hook's payload into a struct variable.
Works only inside On Hook.
| Pin | Type | Direction | Description |
|---|---|---|---|
OutPayload | int32 | out | A variable of the payload's struct type, or of a parent struct. |
| Return Value | bool | out | False outside On Hook, or when the payload is not of that type. |
ListenForHook
Listens for a hook until cancelled or until the listening object is destroyed.
| Pin | Type | Direction | Description |
|---|---|---|---|
WorldContextObject | UObject* | in | The object listening; the listener ends with it. |
Channel | FGameplayTag | in | The hook. |
PayloadType | UScriptStruct* | in | The struct expected. Empty takes any, and Get Hook Payload then succeeds only when given the type actually run with. |
Priority = 0 | int32 | in | Higher runs first. |
Match = Exact | EGantryTagMatch | in | Exact, or Partial for the hook and every hook under it. |
| Return Value | UGantryAsyncAction_ListenForHook* | out | The node, to cancel it. |
MarkHandled
Tells the game this listener did the work itself.
Later listeners still run. Only inside On Hook.
SetPayload
Writes a struct back into the hook's payload: the change the game reads.
Works only inside On Hook.
| Pin | Type | Direction | Description |
|---|---|---|---|
Payload | int32 | out | A variable of the payload's struct type. |
| Return Value | bool | out | False outside On Hook, or when the struct is not the payload's type. |
C++
Public C++ members that Blueprint does not see.
DECLARE_FUNCTION
Get Hook Payload's custom thunk.
DECLARE_FUNCTION
Set Hook Payload's custom thunk.
Activate
virtual void
Registers the listener.
SetReadyToDestroy
virtual void
Removes the listener.