• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

how to give a unit a buff?

Status
Not open for further replies.
Level 20
Joined
Aug 13, 2013
Messages
1,696
JASS:
call UnitAddAbility(udg_YourUnit, udg_YourBuffID)
Can be written on custom script;
YourBuffID is an integer variable which stores the rawcode of your desired buff.
Get Rawcode: Press Ctrl+D and go to your buff; it should look like 'B000'... or etc.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Using UnitAddAbility() doesn't work if you want to directly add the buffs.

What most people do is add the Slow Aura (Tornado) ability to the unit since it doesn't show up in the unit's command card. All you will have to do is make sure that the movement speed, attack speed, etc values are all set to 0, the affected targets are set to "Self," and that you edit the Buff field to whatever buff you want.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
As KILLCIDE said, make an ability customized Slow Aura ( Tornado ) and of course put your specific buff inside it's buff field. Make sure it's data speed are zeroed. Then add that ability to your desired unit through trigger; GUI func of:
Unit - Add (YourSlowAuraTornadoCustom) Ability.

SlowAuraTornado is chosen because the ability is not showed in the command card/slots unlike other auras.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Go to the object editor.
Create a new ability based of: Abilities -> Neutral Passive -> Units -> Slow Aura (Tornado)
Set Data - Movement Speed Factor to 0.00
Set Stats - Targets Allowed to Self, Invulnerable, Vulnerable
Set Stats - Buffs to the buff(s) you want to show.

Add that ability to your unit when you want to give the buff.
Remove that ability and remove the buff when you want to remove the buff.
 
Level 11
Joined
Jan 23, 2015
Messages
788
Using UnitAddAbility() doesn't work if you want to directly add the buffs.

What most people do is add the Slow Aura (Tornado) ability to the unit since it doesn't show up in the unit's command card. All you will have to do is make sure that the movement speed, attack speed, etc values are all set to 0, the affected targets are set to "Self," and that you edit the Buff field to whatever buff you want.

I don't use this AT ALL.

Slow Aura (Tornado) is a negative buff which will display with red letters. It's easy to change the color of the Tooltip, but it will still be recognized as negative by certain abilities that remove positive/negative buffs.
What I do is make a dummy ability based on Slow (the Sorceress ability) for a negative buff and Unholy Frenzy for a positive one and set all it's effect values to 0.00 and range to 9999. Set the duration as desired, if you want your buff to be permanent, then set it like 9999999 seconds and remove the buff with triggers if you ever want to.
In the trigger, where you add the hunger buff, create a dummy unit and give it the dummy ability, then in the same trigger order the unit to "Human Sorceress - Slow" the unit you give the buff to and add a 0.4+ sec expiration timer to the dummy.
To avoid Magic Immunity, simply set the ability to "Hero Ability", set the required level to 6 and then return it back to "Non-hero ability".
 
Last edited:
Status
Not open for further replies.
Top