#GA not commiting Cost / CD right away

1 messages ยท Page 1 of 1 (latest)

next delta
#

Check message (use Jump)

cosmic cipher
#

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

next delta
#

If you have a cost, yes

#

If you don't have a cost on the GA: no

cosmic cipher
next delta
#

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

cosmic cipher
next delta
#

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

cosmic cipher
next delta
#

CheckAbilityCost/Cooldown too IIRC

cosmic cipher
next delta
cosmic cipher
#

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?

next delta
#

I didn't want to suggest it in case you were not comfortable enough in cpp

next delta
#

obv, canactivateability will return false

#

@cosmic cipher

#

-> UAbilitySystemComponent::InternalTryActivateAbility

#

this method is very informative, I can't recommand enough to read through it

sharp blade
#

you could also have overridable cost objects

#

aka lyra aka myplugin

next delta
sharp blade
#

which you can plug diff costs

next delta
cosmic cipher
# next delta I would do it in c++ too ๐Ÿ™‚

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

next delta
#

or just skip it ... ๐Ÿ˜„

#

remove it from the code.

cosmic cipher
#

Since I never know what I am removing, I will forever be haunted by the removed code. ๐Ÿ‘ป