• 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.

Add buffs to units via triggers

Status
Not open for further replies.
Level 11
Joined
Dec 5, 2009
Messages
846
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.
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
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
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
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.
Top