x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Gameplay Ability Plugin: Cannot derive gameplay effect stats from Source actor attributes for cooldown

I've been wrestling for a few days about why this isn't working.

I have a character class, MyCharacter, with an Ability System Component. It also has an attribute set, we'll call it HealthSet, with attribute CurrentHealth inside.

I have created an ability "Shoot" that has gameplay effect "TestCooldownEffect" as its cooldown effect. Cooldown effect is set to derive its duration from the CurrentHealth value of the effect source. However, doing so causes the ability to only evaluate once, and be stuck in perpetual cooldown forever. Oddly, setting the effect to derive from the Target's CurrentHealth makes it work correctly. This is odd because the source and the target are the same actor in this case!

This almost seems like an engine bug.

Product Version: UE 4.20
Tags:
more ▼

asked Aug 15 '18 at 05:46 AM in C++ Programming

avatar image

Grug
31 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

For those lost souls, I found the answer.

The function FGameplayEffectContext::AddInstigator(class AActor *InInstigator, class AActor *InEffectCauser) in gameplay effect types takes the Instigator, in this case MyCharacter and saves it. This is considered the source in future calculations for the ability. However, during this process it attempts to cast the instigator to the Interface IAbilitySystemInterface and use the one built-in function "GetAbilitySystemComponent" to get a reference to the component. In my case, MyCharacter didn't implement that interface! So nothing happened and it failed silently.

Yet when MyCharacter is evaluated as the Target of the effect, it doesn't matter that the class doesn't implement IAbilitySystemInterface.

This seems like odd behavior, but at least I know the reason.

more ▼

answered Aug 15 '18 at 06:10 AM

avatar image

Grug
31 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question