Abilities overview - EmbersGames/MurkyDiversMod GitHub Wiki

Abilities overview

Abilities are behaviors that can be triggered both on players or on NPCs. They each have an owning tag and can be interrupted if another ability is configured like so. For example, dashing is interrupted if the death ability is triggered.

Structure

For players

Abilities are triggered by a BP_PlayerAbilityManagerComponent_Base child component.

These are prefixed with

BP_AMC_[AbilityName]

These AMCs act as triggers, they run for each player. They create the ability instance specified by the Ability class property.

To trigger the ability you can use an Input Action node, add a WaitGameplayTagChange after Component Initialization, or even perform a check at tick as you please.

Run the ability with

HandleNewTriggers

and cancel it if needed with

CancelAbility

When creating a new AMC, you’ll need to add it using the AddAMC function on the BP_PlayerCharacter. Check the BP Graph Abilities section in BP_Mod_InitGame for an example of its implementation.

The abilities are child classes of BP_Phare_Player_GameplayAbility_Base, prefixed with

BPA_[AbilityName]

When triggered, they’ll run only on the server and on the owning client. You can specify in the class defaults a bunch of gameplay tags

  • The tags of the ability, that will be set when it starts and replicated as it runs on the server as well
  • Tags to cancel the ability
  • Tags to lock movement or camera for example
  • Cooldown tags

The ability instance is created once when the AMC is created, so make sure to clean your temporary variable between two executions.

Start your logic with :

Event Activate Ability

and end it with :

Event Finish Ability

By default an ability plays an anim montage that is replicated and ends automatically when the montage is finished. You can override GetMontageToPlay to specify the desired montage, and check Self Can Cancel Anim End on the AMC class defaults to avoid ending the ability at the end of the montage.

Advanced

By default abilities Net Execution Policy is set to Local Predicted, which is correct for any ability related to a player input as it doesn’t create latency. For example dashing. This is usually not desired when the trigger is linked to an event handled by the server, for example a player dying as he reaches 0 HP. In that case, use Server Initiated instead to avoid weird behaviors.

Next Page

⚠️ **GitHub.com Fallback** ⚠️