GameplayAbilities and you

I am currently working on have a regeneration of health over time. Substitute hunger increasing.

With GameplayAbilities or your own system?

GameplayAbilities all the way. I had started with my own system, then of course found this. However, I am currently using GameplayEffects portion and all through C++. I am only at beginning student level in my experience with this plugin. I have relied heavily on the two posts and I have lurked on the Discord channel. I have used the the unit testing code in the plugin and the github project referenced in the post to learn.

How to make a Cast-time ability?

A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

Hey,

i’m in the process of migrating my UE4.18 project to the GameplayAbilities plugin and encountered a problem.

When i try to hot reload the GameplayCueEditor it says that it couldnt save a makefile:

Has anyone got the same error and fixed it?

The GameplayCues work, but it would be nice to get rid of that error to use the manager to its full extent.

Any help would be greatly appreciated

I’m working on an FPS and a lot of times I need an AnimMontage to play on the weapon actor the player is holding in addition to the character. I had a working state machine system for single player before this but decided to switch to Abilities since it does pretty much the same things but has all the headaches of networking figured out for the most part. And I actually need the other features too, like Effects and Attributes.

I see things like PlayMontageAndWait specifically targeting the Owner character with no way to specify the AnimInstance on the weapon actor. It shouldn’t be too hard to modify, but can things break in networked games if I try to play montages on other actors, not just the owner actor? I can see there needing to be all sorts of checks for if the other actor is pendingKill or some other weird states.

I’m even setting it up so the Weapon actor itself has its own abilities system, which may seem a little weird but I put in some thought into it. Things like reloading animations are character actions, while firing and other things are on the weapon and character at the same time. This way when you die and drop the weapon, the weapon can keep playing a firing animation independently of the character. The pair of abilities only get activated if both of their CanActivate checks succeed.

@KZJ So I’m having difficulty figuring out how to handle temporary shields through the AttributeSet and GameplayEffects.

My process:

  • Defined a separate Shield attribute.
  • I apply a GameplayEffect with an Additive Modifier to the Shield value (Duration Policy: Duration).
  • In my damage execution class, I calculate the damage, subtract any absorbed damage from the Shield attribute, then subtract any remaining damage from the Health attribute.

My problem:

  • GameplayEffects with a duration policy only changes the current attribute value, not the base. So when I apply my temporary Shield GameplayEffect, it looks like this:

Shield Current Value = 10
Shield Base Value = 0

I hit them with an ability that does 5 damage:

Shield Current Value = 5
Shield Base Value = -5

When the GameplayEffect’s duration ends:

Shield Current Value = -5
Shield Base Value = -5

What I want:

  • To be able to subtract from the current value of an attribute in my damage execution class, not the base value.

I know I could apply a GameplayEffect with an Instant or Infinite Duration Policy then remove the GameplayEffect after a desired amount of time, but that just feels wrong. Am I overlooking something here, or solving the shield problem in the wrong way?

Also, has anyone figured out how to properly create a GameplayEffectTemplate?

Hello,
I get this error:
2>D:\engine\Engine\Source\Runtime\CoreUObject\Public\UObject/Object.h(83): error C2027: use of undefined type ‘UAbilitySystemComponent’
2>D:\engine\Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Public\AbilitySystemInterface.h(10): note: see declaration of ‘UAbilitySystemComponent’
2>D:\build\IS\Game\Source\InnerSanctum\ISPlayer.cpp(45): note: see reference to function template instantiation ‘TReturnType *UObject::CreateDefaultSubobject<UAbilitySystemComponent>(FName,bool)’ being compiled
2> with
2>
2> TReturnType=UAbilitySystemComponent
2> ]
2>D:\engine\Engine\Source\Runtime\CoreUObject\Public\UObject/Object.h(84): error C2440: ‘static_cast’: cannot convert from ‘UObject *’ to ‘UAbilitySystemComponent *’
2>D:\engine\Engine\Source\Runtime\CoreUObject\Public\UObject/Object.h(84): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
when i add this:
AbilitySystem = CreateDefaultSubobject<UAbilitySystemComponent>(TEXT(“AbilitySystem”));
to my class

AbilitySystem is a class UAbilitySystemComponent*

my engine is currently 4.18

Does anyone know how to resolve this error?

using FGameplayAbilityInputBinds = FGameplayAbiliyInputBinds; … just sayin.

Hi, thanks so much for this post, it is helping me understand how this plugin works.

I am starting to set the ability system up and I am having problems with firing GameplayEvents in my attribute set.

I made a GameplayEffect that grants and Ability. The Ability is triggered by the “Event.Damage” tag, and it just prints “Hello” for now.

When I call the “SendGameplayEventToActor” from the player character (I bound that to f5) this works fine and it prints “Hello”.

When I try to send the event from my attribute set cpp it is not working.

Here is a picture Imgur: The magic of the Internet.

Help plz!!

Have you found the reason the calculation was not working? I have the issue my calculation is not called, never. Not sure but I try to do a minimum code setup and just tried to apply the effects with the standard blueprint applygameplayeffecttotarget and similar vanilla gameplay ability calls, but nothing will trigger.

So my gameplay effect now plays well by providing a proper target. Since I’m on a dedicated server scenario the target always null on aserver without target no execution of gameplay effect. With the target replicated to the server (actor below mouse cursor if some might ask why rep from cleint to server) and used in the call to apply gameplayeffect to target everything was fine.

Now I have a gameplay related question I am not sure how to solve this, and have not found this in the wiki covered. How or where do I make a functionality like a% to hit chance roll which only the triggers the abilities. I tried the % roll to be on the authoritive side and replicate to the client. I even placed net sync nodes to be sure I have the avlue set, but client and server used different rolls to decide after the sync. So I am not sure the documentation covers any such case. To me it seems it is more relying on everything doing the same fixed calculations.

Anybody an idea how to introduce authoritive random values like skill rolls with gameplay abilities?

Hi!

I’m beggining to use the Gameplay Abilities modules since few days, and I’m a bit confused about the Attribute Set.

Each Attribute got a Base Value, who will define the value at initalization. They also got a Min and Max Value, but when I upgrade the current Value, (not the base one) it can go over these value, I actually need to make a clamp with PreAttributeChange.

I wonder how to get the Max Value in order to put in the PreAttributeChange clamp?
Or maybe the more ideal approach is to make an other attribute like “MaxHealth” or “MaxStamina” and use the clamp with it? If this the case, what is the use of Min Value and Max Value?

@Naerly I’d think it’s qute good explained in the wiki. An attribute can change through buffs, therefore you have a base value and a buffed current value. In some games Attributes have some valid range like 1-20 or 1-100 for % etc. To get the base value clamping use PreAttributeBaseChange. Have also a look at the function description.
On the other hand you have less static attributes that go up and down like health and mana. These use the concept of Attribute + MaxAttribute, where the maxed one is just the level you have when you are fully refreshed and thing should not get higher than this. Like health is 25 and any heal spell should not bring you above this. Then use PreAttributeChange to clamp it like “Health = Clamp(Health, 0, MaxHealth)” The standard initializer does nothing with min or max value and just uses the BaseValue, ev.it’s in there for some future use or some auto clamping which was then not released.

Where did you find the Min/Max value? FGameplayAttributeData only contains the members BaseValue and CurrentValue.

Or do you mean FAttributeMetaData (which indeed has Min/Max/Base)? However this is only a subclass for a datatable but not used in an AttributeSet as attribute.

Why the damage is applied to the base value, too?

Quick question: I’m using a lot of code from ActionRPG and setup passive effects the same way they did.

How do infinite effects work on overhead?

say I have a character that regens health at a constant rate

right now I check if current health is less than max health then I trigger an ability with health regen effect. When health reaches max I turn off the effect manually by removing the tag.

alternately I could put health regen as a passive effect, always on, if health reaches max does it turn off the infinite effect? Similar to what I’m already doing by controlling it manually?

Has anyone implemented this when it comes to weapons like rifles, pistols, etc? I am just starting to learn about Gameplay Abilities, watching videos about it on Youtube and Udemy, and I am trying to wrap my head around how Fortnite implemented this using projectile-based weapons.

Hi !! First of all thank you So much for taking the time to make this wiki, it helped me a lot to understand how the gameplay ability plugin works. For my project I simply created a project from the ARPG demo and got rid of the barbarous character, but kept the controller because this is what I wanted anyway.

I am now playtesting using the weapons provided in the demo, but would like to create my own melee and ranged using the ability system but am completely confused as to what I need in order to make them work. I’m trying to duplicate the melee weapons (replacing meshes and combo montages could also work) and to create skills that would be attached to ranged weapon blueprints so I can have them equipped and then customize them as I wish.

I anyone on this thread has an idea of what I need to create and link to make everything work, any help would be greatly appreciated. I know I need to create child blueprint from the WeaponActor blueprint for melee but then I’m lost when it come to attaching the mesh and then the GE and also I think there’s a curve table but don’t know how to put everything together.

Thanks to all!