Hi there, glad to know we are good. Yes, the original code has no if statement, however, the only way Visual Studio would allow me to build my 5.1 solution was replacing the “check(AbilitySystemComponent);” by something else not clear to me back in the day. Because I didn’t receive any feedback from the community, I decided to use Lyra’s latest reference: “UAbilitySystemComponent* ASC = GetTargetASC();
if (ASC)”,
That was the only way to build my solution without errors. But, as you pointed well, perhaps the final “if(ASC);” is either unfinished or even unnecessary. So, once I return to my project, I’ll try both codes and see if I can find any errors while cancelling an ability by external event. Typically, this node is triggered when one gameplay effect has a tag that cancels an active ability, or when player triggers the cancel input. One of my prototypes has an ability cancellation by input (grenade), and I haven’t had any problem so far.
If ASC doesn’t exist, more than likely, either player or NPC has died while waiting for valid target data (e.g. Aiming) and all active abilities will be cancelled. The only way to know is via debugging the delegate “OnAbilityCancelled()” and see where it leads to. Typically, it will send an event to the listening node “Wait Target Data”, resulting in an active ability that is listening for external cancellation events being cancelled. Keep in mind that “URPGAbilityTask_PlayMontageAndWaitForEvent” is a custom task created as a learning example for that game, extended from “UAbilityTask_PlayMontageAndWait”. Therefore, another way to debug this code is by comparing both objects.
Also, Action RPG was created as a learning source, and it is very likely that a few parts of the code were left unfinished because we had UE5, and Lyra came to replace it. Lyra is multiplayer-ready and has way more advanced Gameplay Ability System than Action RPG.
I’ll update here if I find anything. Keep up the good and good luck with your project.