unreal.AbilitySystemLibrary

class unreal.AbilitySystemLibrary(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

Blueprint library for ability system. Many of these functions are useful to call from native as well

C++ Source:

  • Plugin: GameplayAbilities

  • Module: GameplayAbilities

  • File: AbilitySystemBlueprintLibrary.h

classmethod ability_target_data_from_actor(actor) GameplayAbilityTargetDataHandle

Creates single actor target data

Parameters

actor (Actor) –

Return type

GameplayAbilityTargetDataHandle

classmethod ability_target_data_from_actor_array(actor_array, one_target_per_handle) GameplayAbilityTargetDataHandle

Creates actor array target data

Parameters
Return type

GameplayAbilityTargetDataHandle

classmethod ability_target_data_from_hit_result(hit_result) GameplayAbilityTargetDataHandle

Creates a target data with a single hit result

Parameters

hit_result (HitResult) –

Return type

GameplayAbilityTargetDataHandle

classmethod ability_target_data_from_locations(source_location, target_location) GameplayAbilityTargetDataHandle

Creates a target data with a source and destination location

Parameters
Return type

GameplayAbilityTargetDataHandle

classmethod add_asset_tag(spec_handle, new_gameplay_tag) GameplayEffectSpecHandle

Adds NewGameplayTag to this instance of the effect

Parameters
Return type

GameplayEffectSpecHandle

classmethod add_asset_tags(spec_handle, new_gameplay_tags) GameplayEffectSpecHandle

Adds NewGameplayTags to this instance of the effect

Parameters
Return type

GameplayEffectSpecHandle

classmethod add_granted_tag(spec_handle, new_gameplay_tag) GameplayEffectSpecHandle

This instance of the effect will now grant NewGameplayTag to the object that this effect is applied to

Parameters
Return type

GameplayEffectSpecHandle

classmethod add_granted_tags(spec_handle, new_gameplay_tags) GameplayEffectSpecHandle

This instance of the effect will now grant NewGameplayTags to the object that this effect is applied to

Parameters
Return type

GameplayEffectSpecHandle

classmethod add_linked_gameplay_effect(spec_handle, linked_gameplay_effect) GameplayEffectSpecHandle

Adds LinkedGameplayEffect to SpecHandles. LinkedGameplayEffectSpec will be applied when/if SpecHandle is applied successfully. This will initialize the LinkedGameplayEffect’s Spec for you. Returns to NEW linked spec in case you want to add more to it.

Parameters
Return type

GameplayEffectSpecHandle

classmethod add_linked_gameplay_effect_spec(spec_handle, linked_gameplay_effect_spec) GameplayEffectSpecHandle

Adds LinkedGameplayEffectSpec to SpecHandles. LinkedGameplayEffectSpec will be applied when/if SpecHandle is applied successfully. LinkedGameplayEffectSpec will not be modified here. Returns the ORIGINAL SpecHandle (legacy decision)

Parameters
Return type

GameplayEffectSpecHandle

classmethod add_loose_gameplay_tags(actor, gameplay_tags, should_replicate=False) bool

Manually adds a set of tags to a given actor, and optionally replicates them.

Parameters
Return type

bool

classmethod append_target_data_handle(target_handle, handle_to_add) GameplayAbilityTargetDataHandle

Copies targets from HandleToAdd to TargetHandle

Parameters
Return type

GameplayAbilityTargetDataHandle

classmethod assign_set_by_caller_magnitude(spec_handle, data_name, magnitude) GameplayEffectSpecHandle

Sets a raw name Set By Caller magnitude value, the tag version should normally be used

Parameters
Return type

GameplayEffectSpecHandle

classmethod assign_tag_set_by_caller_magnitude(spec_handle, data_tag, magnitude) GameplayEffectSpecHandle

Sets a gameplay tag Set By Caller magnitude value

Parameters
Return type

GameplayEffectSpecHandle

classmethod clone_spec_handle(new_instigator, effect_causer, gameplay_effect_spec_handle_clone) GameplayEffectSpecHandle

Create a spec handle, cloning another

Parameters
Return type

GameplayEffectSpecHandle

classmethod does_gameplay_cue_meet_tag_requirements(parameters, source_tag_reqs, target_tag_reqs) bool

Returns true if the aggregated source and target tags from the effect spec meets the tag requirements

Parameters
Return type

bool

classmethod does_target_data_contain_actor(target_data, index, actor) bool

Returns true if the given TargetData has the actor passed in targeted

Parameters
Return type

bool

classmethod effect_context_add_hit_result(effect_context, hit_result, reset) None

Adds a hit result to the effect context

Parameters
classmethod effect_context_get_effect_causer(effect_context) Actor

Gets the physical actor that caused the effect, possibly a projectile or weapon

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

Actor

classmethod effect_context_get_hit_result(effect_context) HitResult

Extracts a hit result from the effect context if it is set

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

HitResult

classmethod effect_context_get_instigator_actor(effect_context) Actor

Gets the instigating actor (that holds the ability system component) of the EffectContext

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

Actor

classmethod effect_context_get_origin(effect_context) Vector

Gets the location the effect originated from

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

Vector

classmethod effect_context_get_original_instigator_actor(effect_context) Actor

Gets the original instigator actor that started the chain of events to cause this effect

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

Actor

classmethod effect_context_get_source_object(effect_context) Object

Gets the source object of the effect.

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

Object

classmethod effect_context_has_hit_result(effect_context) bool

Returns true if there is a valid hit result inside the effect context

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

bool

classmethod effect_context_is_instigator_locally_controlled(effect_context) bool

Returns true if the ability system component that instigated this is locally controlled

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

bool

classmethod effect_context_is_valid(effect_context) bool

Returns true if this context has ever been initialized

Parameters

effect_context (GameplayEffectContextHandle) –

Return type

bool

classmethod effect_context_set_origin(effect_context, origin) None

Sets the location the effect originated from

Parameters
classmethod equal_equal_active_gameplay_effect_handle(a, b) bool

Equality operator for two Active Gameplay Effect Handles

Parameters
Return type

bool

classmethod equal_equal_gameplay_ability_spec_handle(a, b) bool

Equality operator for two Gameplay Ability Spec Handles

Parameters
Return type

bool

classmethod equal_equal_gameplay_attribute_gameplay_attribute(attribute_a, attribute_b) bool

Simple equality operator for gameplay attributes

Parameters
Return type

bool

classmethod evaluate_attribute_value_with_tags(ability_system, attribute, source_tags, target_tags) -> (float, success=bool)

Returns the value of Attribute from the ability system component AbilitySystem after evaluating it with source and target tags. bSuccess indicates the success or failure of this operation.

Parameters
Returns

success (bool):

Return type

bool

classmethod evaluate_attribute_value_with_tags_and_base(ability_system, attribute, source_tags, target_tags, base_value) -> (float, success=bool)

Returns the value of Attribute from the ability system component AbilitySystem after evaluating it with source and target tags using the passed in base value instead of the real base value. bSuccess indicates the success or failure of this operation.

Parameters
Returns

success (bool):

Return type

bool

classmethod filter_target_data(target_data_handle, actor_filter_class) GameplayAbilityTargetDataHandle

Create a new target data handle with filtration performed on the data

Parameters
Return type

GameplayAbilityTargetDataHandle

classmethod forward_gameplay_cue_to_target(target_cue_interface, event_type, parameters) None

Forwards the gameplay cue to another gameplay cue interface object

Parameters
classmethod get_ability_system_component(actor) AbilitySystemComponent

Tries to find an ability system component on the actor, will use AbilitySystemInterface or fall back to a component search

Parameters

actor (Actor) –

Return type

AbilitySystemComponent

classmethod get_active_gameplay_effect_debug_string(active_handle) str

Returns a debug string for display

Parameters

active_handle (ActiveGameplayEffectHandle) –

Return type

str

classmethod get_active_gameplay_effect_expected_end_time(active_handle) float

Returns the expected end time (when we think the GE will expire) for a given GameplayEffect (note someone could remove or change it before that happens!)

Parameters

active_handle (ActiveGameplayEffectHandle) –

Return type

float

classmethod get_active_gameplay_effect_remaining_duration(world_context_object, active_handle) float

Returns the total duration for a given GameplayEffect, basically ExpectedEndTime - Current Time

Parameters
Return type

float

classmethod get_active_gameplay_effect_stack_count(active_handle) int32

Returns current stack count of an active Gameplay Effect. Will return 0 if the GameplayEffect is no longer valid.

Parameters

active_handle (ActiveGameplayEffectHandle) –

Return type

int32

classmethod get_active_gameplay_effect_stack_limit_count(active_handle) int32

Returns stack limit count of an active Gameplay Effect. Will return 0 if the GameplayEffect is no longer valid.

Parameters

active_handle (ActiveGameplayEffectHandle) –

Return type

int32

classmethod get_active_gameplay_effect_start_time(active_handle) float

Returns the start time (time which the GE was added) for a given GameplayEffect

Parameters

active_handle (ActiveGameplayEffectHandle) –

Return type

float

classmethod get_active_gameplay_effect_total_duration(active_handle) float

Returns the total duration for a given GameplayEffect

Parameters

active_handle (ActiveGameplayEffectHandle) –

Return type

float

classmethod get_actor_by_index(parameters, index) Actor

Returns actor stored in the Effect Context used by this cue

Parameters
Return type

Actor

classmethod get_actor_count(parameters) int32

Returns number of actors stored in the Effect Context used by this cue

Parameters

parameters (GameplayCueParameters) –

Return type

int32

classmethod get_actors_from_target_data(target_data, index)

Returns all actors targeted, for a given index

Parameters
Return type

Array(Actor)

classmethod get_all_actors_from_target_data(target_data)

Returns all actors targeted

Parameters

target_data (GameplayAbilityTargetDataHandle) –

Return type

Array(Actor)

classmethod get_all_linked_gameplay_effect_spec_handles(spec_handle)

Returns handles for all Linked GE Specs that SpecHandle may apply. Useful if you want to append additional information to them.

Parameters

spec_handle (GameplayEffectSpecHandle) –

Return type

Array(GameplayEffectSpecHandle)

classmethod get_data_count_from_target_data(target_data) int32

Returns number of target data objects, not necessarily number of distinct targets

Parameters

target_data (GameplayAbilityTargetDataHandle) –

Return type

int32

classmethod get_effect_context(spec_handle) GameplayEffectContextHandle

Gets the GameplayEffectSpec’s effect context handle

Parameters

spec_handle (GameplayEffectSpecHandle) –

Return type

GameplayEffectContextHandle

classmethod get_float_attribute(actor, attribute) -> (float, successfully_found_attribute=bool)

Returns the value of Attribute from the ability system component belonging to Actor.

Parameters
Returns

successfully_found_attribute (bool):

Return type

bool

classmethod get_float_attribute_base(actor, attribute) -> (float, successfully_found_attribute=bool)

Returns the base value of Attribute from the ability system component belonging to Actor.

Parameters
Returns

successfully_found_attribute (bool):

Return type

bool

classmethod get_float_attribute_base_from_ability_system_component(ability_system_component, attribute) -> (float, successfully_found_attribute=bool)

Returns the base value of Attribute from the ability system component AbilitySystemComponent.

Parameters
Returns

successfully_found_attribute (bool):

Return type

bool

classmethod get_float_attribute_from_ability_system_component(ability_system, attribute) -> (float, successfully_found_attribute=bool)

Returns the value of Attribute from the ability system component AbilitySystem.

Parameters
Returns

successfully_found_attribute (bool):

Return type

bool

classmethod get_gameplay_ability_from_spec_handle(ability_system, ability_spec_handle) -> (GameplayAbility, is_instance=bool)

Provides the Gameplay Ability object associated with an Ability Spec Handle This can be either an instanced ability, or in the case of shared abilities, the Class Default Object

Parameters
Returns

Pointer to the Gameplay Ability object

is_instance (bool): Set to true if this is an instanced ability instead of a shared CDO

Return type

bool

classmethod get_gameplay_cue_direction(target_actor, parameters) Vector or None

Gets the best normalized effect direction for this gameplay cue. This is useful for effects that require the direction of an enemy attack. Returns true if a valid direction could be calculated.

Parameters
Returns

direction (Vector):

Return type

Vector or None

classmethod get_gameplay_cue_end_location_and_normal(target_actor, parameters) (location=Vector, normal=Vector) or None

Gets the best end location and normal for this gameplay cue. If there is hit result data, it will return this. Otherwise it will return the target actor’s location/rotation. If none of this is available, it will return false.

Parameters
Returns

location (Vector):

normal (Vector):

Return type

tuple or None

classmethod get_gameplay_effect_from_active_effect_handle(active_handle) GameplayEffect

Returns the Gameplay Effect CDO from an active handle. This reference should be considered read only, but you can use it to read additional Gameplay Effect info, such as icon, description, etc.

Parameters

active_handle (ActiveGameplayEffectHandle) –

Return type

GameplayEffect

classmethod get_gameplay_effect_ui_data(effect_class, data_type) GameplayEffectUIData

Returns the UI data for a gameplay effect class (if any)

Parameters
Return type

GameplayEffectUIData

classmethod get_hit_result(parameters) HitResult

Returns a hit result stored in the effect context if valid

Parameters

parameters (GameplayCueParameters) –

Return type

HitResult

classmethod get_hit_result_from_target_data(hit_result, index) HitResult

Returns the hit result for a given index if it exists

Parameters
Return type

HitResult

classmethod get_instigator_actor(parameters) Actor

Gets the instigating actor (that holds the ability system component) of the GameplayCue

Parameters

parameters (GameplayCueParameters) –

Return type

Actor

classmethod get_instigator_transform(parameters) Transform

Gets instigating world location

Parameters

parameters (GameplayCueParameters) –

Return type

Transform

classmethod get_modified_attribute_magnitude(spec_handle, attribute) float

Gets the magnitude of change for an attribute on an APPLIED GameplayEffectSpec.

Parameters
Return type

float

classmethod get_origin(parameters) Vector

Gets instigating world location

Parameters

parameters (GameplayCueParameters) –

Return type

Vector

classmethod get_target_data_end_point(target_data, index) Vector

Returns the end point for a given index if it exists

Parameters
Return type

Vector

classmethod get_target_data_end_point_transform(target_data, index) Transform

Returns the end point transform for a given index if it exists

Parameters
Return type

Transform

classmethod get_target_data_origin(target_data, index) Transform

Returns the origin for a given index if it exists

Parameters
Return type

Transform

classmethod has_hit_result(parameters) bool

Checks if the effect context has a hit reslt stored inside

Parameters

parameters (GameplayCueParameters) –

Return type

bool

classmethod is_instigator_locally_controlled(parameters) bool

Returns true if the ability system component that spawned this cue is locally controlled

Parameters

parameters (GameplayCueParameters) –

Return type

bool

classmethod is_instigator_locally_controlled_player(parameters) bool

Returns true if the ability system component that spawned this cue is locally controlled and a player

Parameters

parameters (GameplayCueParameters) –

Return type

bool

classmethod is_valid(attribute) bool

Returns true if the attribute actually exists

Parameters

attribute (GameplayAttribute) –

Return type

bool

classmethod make_filter_handle(filter, filter_actor) GameplayTargetDataFilterHandle

Create a handle for filtering target data, filling out all fields

Parameters
Return type

GameplayTargetDataFilterHandle

classmethod make_spec_handle(gameplay_effect, instigator, effect_causer, level=1.000000) GameplayEffectSpecHandle

Create a spec handle, filling out all fields

Parameters
Return type

GameplayEffectSpecHandle

classmethod not_equal_active_gameplay_effect_handle(a, b) bool

Inequality operator for two Active Gameplay Effect Handles

Parameters
Return type

bool

classmethod not_equal_gameplay_ability_spec_handle(a, b) bool

Inequality operator for two Gameplay Ability Spec Handles

Parameters
Return type

bool

classmethod not_equal_gameplay_attribute_gameplay_attribute(attribute_a, attribute_b) bool

Simple inequality operator for gameplay attributes

Parameters
Return type

bool

classmethod remove_loose_gameplay_tags(actor, gameplay_tags, should_replicate=False) bool

Manually removes a set of tags from a given actor, with optional replication.

Parameters
Return type

bool

classmethod send_gameplay_event_to_actor(actor, event_tag, payload) None

This function can be used to trigger an ability on the actor in question with useful payload data.

Parameters
classmethod set_duration(spec_handle, duration) GameplayEffectSpecHandle

Manually sets the duration on a specific effect

Parameters
Return type

GameplayEffectSpecHandle

classmethod set_stack_count(spec_handle, stack_count) GameplayEffectSpecHandle

Sets the GameplayEffectSpec’s StackCount to the specified amount (prior to applying)

Parameters
Return type

GameplayEffectSpecHandle

classmethod set_stack_count_to_max(spec_handle) GameplayEffectSpecHandle

Sets the GameplayEffectSpec’s StackCount to the max stack count defined in the GameplayEffect definition

Parameters

spec_handle (GameplayEffectSpecHandle) –

Return type

GameplayEffectSpecHandle

classmethod target_data_has_actor(target_data, index) bool

Returns true if the given TargetData has at least 1 actor targeted

Parameters
Return type

bool

classmethod target_data_has_end_point(target_data, index) bool

Returns true if the target data has an end point

Parameters
Return type

bool

classmethod target_data_has_hit_result(hit_result, index) bool

Returns true if the target data has a hit result

Parameters
Return type

bool

classmethod target_data_has_origin(target_data, index) bool

Returns true if the target data has an origin

Parameters
Return type

bool