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

[Trigger] How to add a buff to a unit?

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
You can add a buff using a passive ability ( spell ) , just use Unit - Add Ability To Unit
:)
You need to understand the difference between buff and ability.
If you add an aura-ability, it looks like it applies a "buff" to your unit because you have a tooltip at your Status, but it's not a buff, since you can't debuff it (because it's an aura, not a buff).
A buff can be debuffed while aura cannot.

People have made a Buff System which applies to your unit when called, it uses a dummy unit to cast the specific ability to apply the buff.

I think there is one in the Spell Section, check it out.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
No you can't cast buff/debuff.
You can only (force) cast an ability which applies a (de)buff.

Meaning you can't just apply Inner Fire buff on your unit via other unit.
But you can order other unit to cast Inner Fire spell which automatically applies Inner Fire buff on the unit.
 
Level 13
Joined
Mar 13, 2013
Messages
299
No you can't cast buff/debuff.
You can only (force) cast an ability which applies a (de)buff.

Meaning you can't just apply Inner Fire buff on your unit via other unit.
But you can order other unit to cast Inner Fire spell which automatically applies Inner Fire buff on the unit.

cool. any chance you could show me what the trigger action would look like for forcing a unit to cast a custom ability? I can't seem to find it..
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
There are no "custom" abilities really, only modified copies of original ones.
The reason why I wrote it like that is because both (the original ability and the custom ability based off the original one) have same order id, so you cannot have both abilities on same unit (well, you can, but casting them will result in problems).

To order unit to cast Shockwave, you have to order unit to "cast Tauren Chieftain - Shockwave".
If you make your own custom ability based off Shockwave (with all values, names, etc. different) it's order id is still Shockwave, so to order unit to cast your own custom spell (custom shockwave in this case), the unit has to have the spell and you order it to "cast Tauren Chieftain - Shockwave".

If your custom ability was based off Firebolt, then you order unit to cast "Neutral - Firebolt".


There are a few exceptions to this rule - like "Channel" ability, where you have field where you chose its order id, but that's pretty much all.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
In WC3 sadly you need to use either dummy abilities with buffs (like an aura) inside a hidden spell book or use a dummy unit to cast a dummy ability which gives the buff. Both will need non-trivial triggering and in GUI when using the dummy unit approach care must be taken to minimize leaks.

If this was SC2 it would be super easy, just add a behaviour which is visible to the unit. It literally is a single GUI action! That is if you even need triggers and cannot add it via an effect.
 
Level 13
Joined
Mar 13, 2013
Messages
299
In WC3 sadly you need to use either dummy abilities with buffs (like an aura) inside a hidden spell book or use a dummy unit to cast a dummy ability which gives the buff. Both will need non-trivial triggering and in GUI when using the dummy unit approach care must be taken to minimize leaks.
what kind of 'care'? I'm guessing simply creating a unit, casting the spell, and then removing the unit isn't careful enough?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I'm guessing simply creating a unit, casting the spell, and then removing the unit isn't careful enough?
There are a few points to be careful with.
1. The position of the dummy unit in GUI will need to be a location. This can leak unless the location object is removed.
2. Creating the dummy unit itself is not simple. It needs to be locust with no collision so as not to influence the game beyond casting the dummy ability. 0 animation delay is a must for responsive and immediate casting.
3. Where the dummy unit is created is also difficult. Creating it under an existing unit results in a massive performance penalty due to displacement.
4. Removing dummies may or may not be completely leak free. Mostly this can be ignored however if poorly written damage detection systems are present or if a lot of dummy units are being used it may be best to recycle the dummy units (place them in the corner of the map, and move them nearby as you need them).
5. Some dummy abilities cannot be cast in GUI as no order string exists for them. Most notable is "Wand of Illusion" item ability which makes a mirror image of the target unit, something people commonly use. You will need to use a JASS call to issue the order directly as an order ID integer.
6. Care must be taken with dummy units to avoid them interacting with other triggers unintentionally. Although dummy units with locust are ignored from area search results they will still show up as player unit results. The best example would be a player leaving in the middle of casting an ability involving dummies where on leave all his units get removed, this could potentially remove his dummy units in the middle of an ability cast (eg if the dummies are for graphics) which could cause catastrophic errors to occur.
7. Dummy units usually do not exist on map load. As such their data is not loaded and cached resulting in poor performance when they are first initially created (the game will drop many frames while they get loaded). As such you either need to pre-place an example of the dummy or create one at map initialization. You cannot create them after map initialization as this will result in poor in-game performance when ever they are created (potentially even calling up the "waiting for player" dialog as a result).

Yeh so dummy units are not easy in WC3.
 
if you want to add buff for unit only for visual effect and icon in status then just simply use Slowing aura (tornado) [Aasl] (im not sure how its name on original editor)

this ability has buff, and dont have icon in order panel, if you want positive buff, then
1) copy buff with positive effect based
2) make name of buff to |cff00ff00Positive Buff|r

then you can simply add this ability that contain your buff, good thing is that they stack and dont conflict on each other
 
Level 13
Joined
Mar 13, 2013
Messages
299
There are a few points to be careful with.
1. The position of the dummy unit in GUI will need to be a location. This can leak unless the location object is removed.
2. Creating the dummy unit itself is not simple. It needs to be locust with no collision so as not to influence the game beyond casting the dummy ability. 0 animation delay is a must for responsive and immediate casting.
3. Where the dummy unit is created is also difficult. Creating it under an existing unit results in a massive performance penalty due to displacement.
4. Removing dummies may or may not be completely leak free. Mostly this can be ignored however if poorly written damage detection systems are present or if a lot of dummy units are being used it may be best to recycle the dummy units (place them in the corner of the map, and move them nearby as you need them).
5. Some dummy abilities cannot be cast in GUI as no order string exists for them. Most notable is "Wand of Illusion" item ability which makes a mirror image of the target unit, something people commonly use. You will need to use a JASS call to issue the order directly as an order ID integer.
6. Care must be taken with dummy units to avoid them interacting with other triggers unintentionally. Although dummy units with locust are ignored from area search results they will still show up as player unit results. The best example would be a player leaving in the middle of casting an ability involving dummies where on leave all his units get removed, this could potentially remove his dummy units in the middle of an ability cast (eg if the dummies are for graphics) which could cause catastrophic errors to occur.
7. Dummy units usually do not exist on map load. As such their data is not loaded and cached resulting in poor performance when they are first initially created (the game will drop many frames while they get loaded). As such you either need to pre-place an example of the dummy or create one at map initialization. You cannot create them after map initialization as this will result in poor in-game performance when ever they are created (potentially even calling up the "waiting for player" dialog as a result).

Yeh so dummy units are not easy in WC3.

how does one make the animation delay zero? I can't seem to find it.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Find that unit in object editor and search for the field "Animation - Cast Point" (and you can also find Animation - Cast Backswing, tho that's not required afaik) and set it to 0.00.
Cast Point and Cast Backswing delay the effect of a spell cast by the unit so it is in appropriate animation when the effect takes place (example: imagine undead Lich unit casting Frost Nova without even waving his hands - that would look silly. With Cast point the Frost Nova and other spells are delayed a bit so he waves his hands and then the spell's effect takes place)
 
Status
Not open for further replies.
Top