Detecting What Buffs a Unit Has

Jonnycakes

New Member
Reaction score
6
I am working on a counter ability and I want to stop negative buffs from being added to the unit if a spell is cast on it. Is there a way to detect when a buff is added to a unit, get what specific buffs a unit has at a given time, or stop buffs from being added to a unit for a given time?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
> Is there a way to detect when a buff is added to a unit,
Not directly. Often, there's an accompanying damage event, but not always.

> get what specific buffs a unit has at a given time,
You can if you already know what specific buffs you want to detect, since you can test whether a unit has a specific buff - but considering there's no "buff group" variable type, you can't get a whole list of the buffs on a unit.

> or stop buffs from being added to a unit for a given time?
Only by periodically removing buffs from the unit, unless using a custom buff system (1, 2, 3) for all your buffs.

You might be well-served by UnitRemoveBuffs or UnitRemoveBuffsEx - they can be limited to negative buffs only. Calling one repeatedly on your unit with a short period might have the effect you want.

Another alternative would be to give the unit the Spell Shield ability with no cooldown, but this has high potential to interfere with the function of triggered spells.
 

Jonnycakes

New Member
Reaction score
6
Yeah, I don't think spell shield would work-I need to return the damage of the spell/attack to the caster/damage source. As for removing buffs periodically, I don't want to remove buffs the unit had previously if I don't have to. I don't have THAT many buffs in my map (at least not yet :D), so I guess the only way is to have a condition for all of them. Thanks for your help, even though it isn't quite the answer that I wanted... +rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top