Apply & Remove

Function ApplyEffect allows to apply an effect.

  • Type - effect type
  • Duration - how long effect will lasts
  • Method - whether duration should be replaced or stacked
  • Applier - who applied the effect

Functions RemoveEffect and RemoveEffects allows to remove and effect.

Effect time can also be adjusted (replaced) with AdjustEffectTime function.

Why do we need it? An example would be attacker applying Stun effect to his victim for 1 second,
but victim want to adjust it to last as long as stun animation instead of 1 second.
In this case he can play animation and set it’s duration as adjusted effect time.

Whenever new effect is applied or removed, event dispatcher OnEffectApplied / OnEffectRemoved is called.

If we want to get any behavior when effect is applied / removed we should assign events on owner blueprints to these dispatchers.

Let’s take a look at BP_BaseAI.

When stun effect is applied, AI will activate function Stunnned and set it’s state to Disabled etc.

When stun effect is removed, AI will reset it’s state if it’s possible etc.