Difficulties with Generic Ability + TryStartAbility(ability, true)

DavidC

Active member
So the initial and biggest issue is that for the Generic Ability, even if I turn it to "Automatic" during runtime, it never says Generic "___" (active).

However, if I add damage to the player, they are healing like you might expect (and not when I haven't changed the start type).

I tried stop type of both "manual" and "Fire2" and either way, I get the strange behavior.

image.png


What I am trying to accomplish is that when a player interacts with a bowl of food, an animation plays and they begin to heal, and their item set swaps to a specific item set, which is just a spoon that is otherwise inaccessible to the player. So far, my script does cause them to switch to switch to the spoon. I also can see the interact ability fire off. I've debugged enough to see that there is an ability passed into TryStartAbility, which it's the 9th one in my list so I used index 8. (As an aside, having the "Ability Index" value in the inspector was odd and threw me off as I initially tried to use 701 but got a null reference error.)

The animation doesn't start either. I added it to the full body blend tree where there is an index ID of 701. I'm not sure, at this point, if that's related to this or some misunderstanding of the animation tree, although I have done similar before without issue when I made custom abilities.
 
This is likely a priority issue. The Generic ability doesn't override CanStartAbility so that means the only times it will be stopped is because of the priority or because another ability implemented ShouldBlockAbilityStart and is stopping that ability from starting. For this it's best to place a breakpoint within TryStartAbility and see why it's not starting.
 
This is likely a priority issue. The Generic ability doesn't override CanStartAbility so that means the only times it will be stopped is because of the priority or because another ability implemented ShouldBlockAbilityStart and is stopping that ability from starting. For this it's best to place a breakpoint within TryStartAbility and see why it's not starting.

I figured out most of the issues I was running into.

1. If you use the attribute function to regenerate health, that function itself seems to force the ability to stop when the player reaches full health. Unfortunately, I want the ability to continue until my script stops it. This also means if it starts when the player is at full health, it immediately stops, which makes it look like it was never active.

For the animator "Ability Float Data" like in "quick turn" is that a value that doesn't exist in Generic and something I need to script in myself?
 
Last edited:
Glad you got it working. The Generic ability doesn't expose AbilityFloatData but you could subclass the Generic ability and provide the override.
 
Top