• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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