• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Add buffs to units via triggers

Status
Not open for further replies.
So is there a way of doing this? I guess you could make a dummy unit and make it cast a spell which will put a buff on the target.
But I want to add it via triggers, GUI or JASS doesn't matter.

No, you cant add buff, you should make it work with the spell by casting the spell, it will add the buff. In triggers, you can only remove buffs but you cant add one in triggers.
 
UnitAddAbility
Idk if this works though,because UnitRemoveAbility works for removing buffs(buffs are abilities, type buff extends ability
JASS:
//===========================================================================

function UnitHasBuffBJ takes unit whichUnit, integer buffcode returns boolean

    return (GetUnitAbilityLevel(whichUnit, buffcode) > 0)

endfunction



//===========================================================================

function UnitRemoveBuffBJ takes integer buffcode, unit whichUnit returns boolean

    return UnitRemoveAbility(whichUnit, buffcode)

endfunction
 
You may use an aura ability though and give it to the target directly to avoid having dummy units and ordering casts.

@Almia: No. Buffs inherit the behaviors of the ability they were casted through, which is probably a reason why there is no simple UnitAddBuff function. You would not have options how the buff would react to different events like unit death for example.
 
Status
Not open for further replies.
Back
Top