• 🏆 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!

Adding a specific buff to a unit

Status
Not open for further replies.
Level 4
Joined
May 17, 2011
Messages
106
This is dumb... you can add ability, remove ability, remove buff, remove specific buff but you can't add a buff to a unit... sigh

What I want is to add a certain buff to a hero whenever he enters an area.

Can someone explain me why there is no add buff in this editor and tell me how to add a buff?

Here's the idea, a unit enters X region and while in this region he's under Y effect (let's say curse effect)... is there a way to simply add that buff to this entering unit??? Or is the only way of doing this would be with an invisible/invulnerable/untargetable unit that would add an aura to any enemy in X region?
 
Level 4
Joined
May 17, 2011
Messages
106
So there's no way of just adding a buff to the unit when it enters the region? :(
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Maker has already told you how.
Create a dummy unit and a dummy ability (an ability that does nothing) that applies your buff. When you want to apply the buff, create a dummy unit and order it to cast the dummy ability on the entering unit.

To create a dummy unit, give it locust, remove shadow, remove model (set path to ".mdx"), set Animation - Cast Backswing and Cast Point to 0 and give it dummy ability.
To create a dummy ability, base it off the ability that originally applies your buff, remove it's effects, add your buff to it and remove mana cost.
To cast the dummy ability, use the action "Issue Order...",
  • Untitled Trigger 002
    • Events
      • Unit - A unit enters YourRegion
    • Conditions
    • Actions
      • Set Loc = Position of (Entering Unit)
      • Unit - Create 1 Dummy unit for Neutral Hostile at Loc facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Orc Shaman - Bloodlust (Entering Unit)
      • Custom script: call RemoveLocation(udg_Loc)
and put instead of Bloodlust the ability you based off the dummy ability.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
If you simply just want to add a buff to a unit, you could use Slow Aura (Tornado) to display a buff icon that's considered negative.
Besides setting the buff to what you want in the ability, you should also set the Targets Allowed to Self and specify any sfx you want to display on the unit in Art - Target. Also set the Movement Speed Factor to 0.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I thought buff can be added through trigger by using Custom Script ?

  • Custom script: call AddUnitAbility(*YourUnit*, *YourBuff*)
Example:
  • Custom script: call AddUnitAbility(udg_Caster, 'Broa')
This trigger is to add Roar buff to Caster.
 
Level 4
Joined
May 17, 2011
Messages
106
Didn't expect so much replies... thanks all

I have another question... There are different regions in my map and I want them all to apply different buffs (depending in which region the hero is) and I guess it is possible to make this happen with only 1 dummy unit being able to cast 6 different spells, right?

I also want creatures in those region to have a certain buff too (depending on their region)... do I have to create 1 dummy unit per region in order to apply that buff to every hostiles creatures in X region? or is there another way to do this?

Edit: To defskull: Your custom script calls an ABILITY, what I'm looking for is a BUFF (those aren't the same). I've been searching for add buff function, but blizzard forgot to add it to its list I guess... Btw can someone tell me why I can't find my spell on the "issue order" spell list? (Unit - issue order targeting a unit) I just created a spell but I can't find it on that list :p
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
I wish it was that simple, defskull. Sadly not.

It's quite simple if you have an automated system.

I have another question... There are different regions in my map and I want them all to apply different buffs (depending in which region the hero is) and I guess it is possible to make this happen with only 1 dummy unit being able to cast 6 different spells, right?

If these abilities can be cast instantly. Waits like the cast point of the dummy should be set to zero. But if you use the aura method you do not even have to cast abilities or have a dummy unit.

I also want creatures in those region to have a certain buff too (depending on their region)... do I have to create 1 dummy unit per region in order to apply that buff to every hostiles creatures in X region?

As said, if these abilities are insta-casted, you can use only one dummy for every buff.

Edit: To defskull: Your custom script calls an ABILITY, what I'm looking for is a BUFF (those aren't the same).
I've been searching for add buff function, but blizzard forgot to add it to its list I guess... Btw can someone tell me why I can't find my spell on the "issue order" spell list? (Unit - issue order targeting a unit) I just created a spell but I can't find it on that list :p

Nonetheless, the functions GetUnitAbilityLevel and UnitRemoveAbility work for buffs, too. Buffs are a part/asset of abilities, they mark units and hold data of the ability/relink. That should also be the reason why Blizzard did not include a UnitAddBuff native as this would create an empty buff with no host ability and therefore no information how to react to anything whatsoever.
 
Level 4
Joined
May 17, 2011
Messages
106
If these abilities can be cast instantly. Waits like the cast point of the dummy should be set to zero. But if you use the aura method you do not even have to cast abilities or have a dummy unit.

Aura method? Please explain.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
If you simply just want to add a buff to a unit, you could use Slow Aura (Tornado) to display a buff icon that's considered negative.
Besides setting the buff to what you want in the ability, you should also set the Targets Allowed to Self and specify any sfx you want to display on the unit in Art - Target. Also set the Movement Speed Factor to 0.

If you want the buff to look positive (name in green), use a color code in its name field or another aura ability. The specialty of auras is that they stack when deploying a different buff.
 
Level 4
Joined
May 17, 2011
Messages
106
Is there a way to apply the aura's debuff to units which are in X region only? Or is it only working with range acquisition?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Well, you may use the circle area range of the aura ability but that is not what you want and to generalize things and improve precision, we or me actually meant that you buff the units separately, the aura only affecting the holder. You can then catch region entering/leaving via jass events and add/remove the ability to/from the entering/leaving unit.
 
Level 4
Joined
May 17, 2011
Messages
106
I made a trigger with the dummy unit applying a debuff to every units in X region, but there's a problem, when some monsters are killed, how am I suposed to re-apply debuffs on respawning monsters? I'm not gonna spam that trigger every 3 secs of the game for every monsters on the map... no?
 
Status
Not open for further replies.
Top