unreal.AbilitySystemComponent

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

Bases: unreal.GameplayTasksComponent

The core ActorComponent for interfacing with the GameplayAbilities System

C++ Source:

  • Plugin: GameplayAbilities

  • Module: GameplayAbilities

  • File: AbilitySystemComponent.h

Editor Properties: (see get_editor_property/set_editor_property)

  • activatable_abilities (GameplayAbilitySpecContainer): [Read-Write] The abilities we can activate.

    -This will include CDOs for non instanced abilities and per-execution instanced abilities. -Actor-instanced abilities will be the actual instance (not CDO)

    This array is not vital for things to work. It is a convenience thing for ‘giving abilities to the actor’. But abilities could also work on things without an AbilitySystemComponent. For example an ability could be written to execute on a StaticMeshActor. As long as the ability doesn’t require instancing or anything else that the AbilitySystemComponent would provide, then it doesn’t need the component to function.

  • affected_anim_instance_tag (Name): [Read-Write] The linked Anim Instance that this component will play montages in. Use NAME_None for the main anim instance.

  • asset_user_data (Array(AssetUserData)): [Read-Write] Array of user data stored with the component

  • auto_activate (bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.

  • can_ever_affect_navigation (bool): [Read-Write] Whether this component can potentially influence navigation

  • component_tags (Array(Name)): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

  • default_starting_data (Array(AttributeDefaults)): [Read-Write] Default Starting Data

  • editable_when_inherited (bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor class

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

  • on_claimed_resources_change (OnClaimedResourcesChangeSignature): [Read-Write] On Claimed Resources Change

  • on_component_activated (ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • replicates (bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

property activatable_abilities
[Read-Only] The abilities we can activate.

-This will include CDOs for non instanced abilities and per-execution instanced abilities. -Actor-instanced abilities will be the actual instance (not CDO)

This array is not vital for things to work. It is a convenience thing for ‘giving abilities to the actor’. But abilities could also work on things without an AbilitySystemComponent. For example an ability could be written to execute on a StaticMeshActor. As long as the ability doesn’t require instancing or anything else that the AbilitySystemComponent would provide, then it doesn’t need the component to function.

Type

(GameplayAbilitySpecContainer)

property affected_anim_instance_tag

[Read-Write] The linked Anim Instance that this component will play montages in. Use NAME_None for the main anim instance.

Type

(Name)

apply_gameplay_effect_spec_to_self(spec_handle)ActiveGameplayEffectHandle

Applies a previously created gameplay effect spec to this component

Parameters

spec_handle (GameplayEffectSpecHandle) –

Returns

Return type

ActiveGameplayEffectHandle

apply_gameplay_effect_spec_to_target(spec_handle, target)ActiveGameplayEffectHandle

Applies a previously created gameplay effect spec to a target

Parameters
Returns

Return type

ActiveGameplayEffectHandle

apply_gameplay_effect_to_self(gameplay_effect_class, level, effect_context)ActiveGameplayEffectHandle

Apply a gameplay effect to self

Parameters
Returns

Return type

ActiveGameplayEffectHandle

apply_gameplay_effect_to_target(gameplay_effect_class, target, level, context)ActiveGameplayEffectHandle

Apply a gameplay effect to passed in target

Parameters
Returns

Return type

ActiveGameplayEffectHandle

get_active_effects(query)

Returns list of active effects, for a query

Parameters

query (GameplayEffectQuery) –

Returns

Return type

Array(ActiveGameplayEffectHandle)

get_active_effects_with_all_tags(tags)

Returns list of active effects that have all of the passed in tags

Parameters

tags (GameplayTagContainer) –

Returns

Return type

Array(ActiveGameplayEffectHandle)

get_effect_context()

deprecated: ‘get_effect_context’ was renamed to ‘make_effect_context’.

get_gameplay_effect_count(source_gameplay_effect, optional_instigator_filter_component, enforce_on_going_check=True)int32

Get the count of the specified source effect on the ability system component. For non-stacking effects, this is the sum of all active instances. For stacking effects, this is the sum of all valid stack counts. If an instigator is specified, only effects from that instigator are counted.

Parameters
  • source_gameplay_effect (type(Class)) – Effect to get the count of

  • optional_instigator_filter_component (AbilitySystemComponent) – If specified, only count effects applied by this ability system component

  • enforce_on_going_check (bool) –

Returns

Count of the specified source effect

Return type

int32

get_gameplay_effect_magnitude(handle, attribute)float

Raw accessor to ask the magnitude of a gameplay effect, not necessarily always correct. How should outside code (UI, etc) ask things like ‘how much is this gameplay effect modifying my damage by’ (most likely we want to catch this on the backend - when damage is applied we can get a full dump/history of how the number got to where it is. But still we may need polling methods like below (how much would my damage be)

Parameters
Returns

Return type

float

get_user_ability_activation_inhibited()bool

This is meant to be used to inhibit activating an ability from an input perspective. (E.g., the menu is pulled up, another game mechanism is consuming all input, etc) This should only be called on locally owned players. This should not be used to game mechanics like silences or disables. Those should be done through gameplay effects.

Returns

Return type

bool

init_stats(attributes, data_table)None

K2 Init Stats

Parameters
is_gameplay_cue_active(gameplay_cue_tag)bool

Allows polling to see if a GameplayCue is active. We expect most GameplayCue handling to be event based, but some cases we may need to check if a GamepalyCue is active (Animation Blueprint for example)

Parameters

gameplay_cue_tag (GameplayTag) –

Returns

Return type

bool

make_effect_context()GameplayEffectContextHandle

Create an EffectContext for the owner of this AbilitySystemComponent

Returns

Return type

GameplayEffectContextHandle

make_outgoing_spec(gameplay_effect_class, level, context)GameplayEffectSpecHandle

Get an outgoing GameplayEffectSpec that is ready to be applied to other things.

Parameters
Returns

Return type

GameplayEffectSpecHandle

remove_active_effects_with_applied_tags(tags)int32

Removes all active effects that apply any of the tags in Tags

Parameters

tags (GameplayTagContainer) –

Returns

Return type

int32

remove_active_effects_with_granted_tags(tags)int32

Removes all active effects that grant any of the tags in Tags

Parameters

tags (GameplayTagContainer) –

Returns

Return type

int32

remove_active_effects_with_source_tags(tags)int32

Removes all active effects with captured source tags that contain any of the tags in Tags

Parameters

tags (GameplayTagContainer) –

Returns

Return type

int32

remove_active_effects_with_tags(tags)int32

Removes all active effects that contain any of the tags in Tags

Parameters

tags (GameplayTagContainer) –

Returns

Return type

int32

remove_active_gameplay_effect(handle, stacks_to_remove=- 1)bool

Removes GameplayEffect by Handle. StacksToRemove=-1 will remove all stacks.

Parameters
Returns

Return type

bool

remove_active_gameplay_effect_by_source_effect(gameplay_effect, instigator_ability_system_component, stacks_to_remove=- 1)None

Remove active gameplay effects whose backing definition are the specified gameplay effect class

Parameters
  • gameplay_effect (type(Class)) – Class of gameplay effect to remove; Does nothing if left null

  • instigator_ability_system_component (AbilitySystemComponent) – If specified, will only remove gameplay effects applied from this instigator ability system component

  • stacks_to_remove (int32) – Number of stacks to remove, -1 means remove all

set_active_gameplay_effect_level(active_handle, new_level)None

Updates the level of an already applied gameplay effect. The intention is that this is ‘seemless’ and doesnt behave like removing/reapplying

Parameters
set_active_gameplay_effect_level_using_query(query, new_level)None

Updates the level of an already applied gameplay effect. The intention is that this is ‘seemless’ and doesnt behave like removing/reapplying

Parameters
set_user_ability_activation_inhibited(new_inhibit)None

Disable or Enable a local user from being able to activate abilities. This should only be used for input/UI etc related inhibition. Do not use for game mechanics.

Parameters

new_inhibit (bool) –

target_cancel()None

Any active targeting actors will be stopped and canceled, not returning any targeting data

target_confirm()None

Any active targeting actors will be told to stop and return current targeting data

try_activate_abilities_by_tag(gameplay_tag_container, allow_remote_activation=True)bool

Attempts to activate every gameplay ability that matches the given tag and DoesAbilitySatisfyTagRequirements(). Returns true if anything attempts to activate. Can activate more than one ability and the ability may fail later. If bAllowRemoteActivation is true, it will remotely activate local/server abilities, if false it will only try to locally activate abilities.

Parameters
Returns

Return type

bool

try_activate_ability_by_class(ability_to_activate, allow_remote_activation=True)bool

Attempts to activate the ability that is passed in. This will check costs and requirements before doing so. Returns true if it thinks it activated, but it may return false positives due to failure later in activation. If bAllowRemoteActivation is true, it will remotely activate local/server abilities, if false it will only try to locally activate the ability

Parameters
  • ability_to_activate (type(Class)) –

  • allow_remote_activation (bool) –

Returns

Return type

bool

try_activate_ability_by_tag(gameplay_tag_container, allow_remote_activation=True)

deprecated: ‘try_activate_ability_by_tag’ was renamed to ‘try_activate_abilities_by_tag’.