Prevent Application AND Remove Stack of Other Gameplay Effect?

Hello,

I’m working with GAS in 4.25 and I’m trying to setup an invulnerability stack system. When a player receives damage, it removes a stack of the invulnerability and ignores the damage. I have this working, however I want to extend this to status effects, too.

For example: I have a stun gameplay effect that can be applied to the player. If the player has at least 1 stack of invulnerability, I want it to prevent applying the stun gameplay effect, but also remove 1 stack of invulnerability.

I can prevent it from applying the stun effect, but I don’t know how I can go about removing 1 stack of invulnerability at the same time.

Is there a way, either within the default Gameplay Effect features or by extending C++, that I can accomplish this?

Thanks!

I’ve sort of solved my own issue, but it’s pretty hacky.

In my stun Gameplay Effect, I added a Conditional Gameplay Effect that applies a separate Gameplay Effect – we’ll call it GE_InvulnStackRemove

GE_InvulnStackRemove has an Application Requirement of the invulnerability tag, we’ll say Combat.State.Buff.Invuln

GE_InvulnStackRemove also has a Remove Gameplay Effects with Tags entry for the tag the stun Gameplay Effect adds. We’ll call it Combat.State.Debuff.Stun

Lastly, GE_InvulnStackRemove has a Granted Ability GA_RemoveInvulnStack, which is setup to activate when granted (See the GAS Documentation here to do this.) This Gameplay Ability then removes a stack of any Gameplay Effect with the tag Combat.State.Buff.Invuln

NOTE: GE_InvulnStackRemove must have its Duration Policy set to Has Duration or Infinite in order to grant a Gameplay Ability. I set mine to Has Duration and set the duration to 0.1

It’s really convoluted but it works for my purposes.