#GA not commiting Cost / CD right away
1 messages ยท Page 1 of 1 (latest)
Check message (use Jump)
Original message: #gameplay-ability-system message
Main answer: #gameplay-ability-system message
Since the ability does not activate unless the gameplay effect cost can be applied, I would need to also overwrite the CanActivateAbility, right?
Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Private\Abilities\GameplayAbility.cpp:485
Regarding this message, do you mean override the function in c++? (Just double checking so I am not missing anything)
#gameplay-ability-system message
You could also add a bool bUseCost to true.
if true, regular behavior.
If false: won't be used in canactivate / commitcost won't be called automatically)
you'd have to call if manually.
that would help designer in the end
I think this is a good idea ๐
or even maybe another like: bCommitCost = true.
You know, something to make the cost relevant in canbeactivated / commit based on what you want
An enum with a clear desc would even be better
- Do not check or apply cost
- Check cost only, do not apply
- Do no check cost but apply on activation
- Check and apply cost automatically (default)
this way, it's easy.
That's what I would do ๐
Enums are generally better than a bunch of bools
@cosmic cipher
Btw, I don't know if you ever overriden CanActivateAbility() in BP but: DON'T CALL THE PARENT
it will lead to strange behaviors ...
maybe it's just our game that has issues, but be aware of it
I believe the cost and cooldown is only applied if you call Commit inside the ability blueprint.
There is also an CommitAbilityCooldown and CommitAbilityCost node if you want to commit them separately.
(I haven't actually tried these nodes yet thought)
yup
CheckAbilityCost/Cooldown too IIRC
I will most likely override it in c++. There seems to be a lot of logic that I do not want to write in bp by hand 
I would do it in c++ too ๐
Are there any callbacks for when an ability fails to activate due to cooldown/cost?
I am guessing I need to create it by hand?
I didn't want to suggest it in case you were not comfortable enough in cpp
there is on the ASC IIRC
obv, canactivateability will return false
@cosmic cipher
-> UAbilitySystemComponent::InternalTryActivateAbility
this method is very informative, I can't recommand enough to read through it
which you can plug diff costs
this is a callback on the GA itself
Btw, when I tried to copy the code from CanActivateAbility into my own override implementation then I get this error. I can see that it is defined inside the GameplayAbility.cpp file, but I don't understand this error.
Am I missing an include or something?
When it comes to includes and forward declarations then I am a complete newbie.
It is defined in the GameplayAbility.ccp file, so I don't know how to reference that... ๐ค
Is it safe if I just redefine it in my ExtendedGameplayAbility.cpp? ๐ The error seems to disappear
Since I never know what I am removing, I will forever be haunted by the removed code. ๐ป