Respond to GameplayAbility (GA) "OnEndAbility" Event Inside of a Behavior Tree Task (BTT)

[The following is all in blueprints]

Under a Sequence Composite Node in a Behavior Tree (BT) there exists a node that triggers a Gameplay Ability (GA). The next node in the sequence immediately after the one triggering the GA attempts to wait for the GA to complete.

The logic for waiting to complete is to get the GA corresponding to the Gameplay Ability Spec Handle and attach a custom event to an Event Dispatcher inside of the GA that is called when the GA finishes execution. However, it seems like I must be attaching to an instance of the GA that is not triggered by the previous node in the BT.

Does anyone have any ideas for getting the instance of the GA that is active?

The delegate-event logic works if i apply it inside of the blueprint class that registers a gameplay ability via “give ability.” I think I’ll work towards a different solution to the problem by rewriting some of my GAS logic in c++

Well can be not sure how GA ability is set but

if its an instancing you can directly access

However other ways to do it. You can just have a gameplay effect and a tag over target and wait for tag to be removed also can solve your problems.

Let me know if I am understanding your problem right.

I had a similar one for multiple attack type from enemy but I generally bind event to character itself not GA or you can add GA but pass variable as owner to make distinction between events of different instances.

Thank you for your reply!

Yeah, I think one of the various alternative solution approaches is the way forward.

In the instancing solution, are you able to grant an ability from within a BTT, is that where the screenshot is from? Does it matter if “Give ability …” is ran multiple times for the same GA on the same ABC?

Hey, its from the abilty settings from the ability blueprint.

Depending on the instancing policy an ability

*Can be non instanced
*Instanced per actor and that actor can use same ability instanced if already exist.
*Can always refresh per execution no matter who is the owner actor.

Instanced per actor meaning using the same ability over and over again without removing it unless you define a removal mechanic on it. There is a retrigger setting over there available also so you can define one time or not. Cause generally ending an ability doesn’t really mean that ability is garbage unless you set so.

Generally you want to instance per actor an ability if its over and over used so its more efficient. Like let’s say AICommonAttack_ABP

However if there is an ability AI rarely uses, like AIEnrage_ABP that is one time will be used so can be per execution so we can use and discard, doesn’t have to stay ready for next execution, probably never.

Here is a nice breakdown of GAS Instancing Policies

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.