• 🏆 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 buff via trigger (without dummy) possible?

Status
Not open for further replies.
Level 12
Joined
Jan 2, 2016
Messages
973
JASS:
function UnitRemoveBuffBJ takes integer buffcode, unit whichUnit returns boolean
    return UnitRemoveAbility(whichUnit, buffcode)
endfunction
and
JASS:
function UnitHasBuffBJ takes unit whichUnit, integer buffcode returns boolean
    return (GetUnitAbilityLevel(whichUnit, buffcode) > 0)
endfunction
When I saw this, I thought that I could add buffs by adding ability to the unit, using the buff's ID.
It didn't work tho.
However, has anyone discovered any way to add a buff to a unit, without making a dummy, giving it an ability (that aplies the buff), and making the dummy cast the buffing spell?

~I kind a need only the icon of the buff, not its effect~
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Well if you can remove a buff by removing an ability I suppose you can just add the same ability to apply the buff.

Quite interesting I need to try this myself.

edit: did not work that easily, sadly. Though you can still use the same method. Make an item ability with a buff, it wont have an icon but still works.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
If the unit can use items you can give it a powerup item with an ability which applies the buff. You have to be aware of item leaks though.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Make an ability based on Tornado Aura (slow) or Slow Aura (tornado)... I forgot the name.
Make that aura target (Invulnerable, Vulnerable) and give it your buff.

Then when you want to add the buff, add the aura to the unit.
When you want to get rid of the buff, remove both the aura and the buff.

The aura is classified as negative so it will show the title of the buff in red text.
You can change (overwrite) the colors if you use color codes in the buff's title.
 
Level 12
Joined
Jan 2, 2016
Messages
973
I kind a went for Chaosy's suggestion.
Seems to be the simplest.
I just needed to add a custom (item) ability, set its Y to some -24xxxxxxx value, and give it the custom buff.
When I need the buff - I add the ability; When I don't need it - I remove the ability.
1 row of code each.

Tho the "tornado aura" suggestion seems to be almost the same :D
 
Level 12
Joined
May 22, 2015
Messages
1,051
The tornado aura solution will show the buff on the unit. This might be desirable, and it is the easiest way to have the buff show up. I actually asked this same question a week or two ago lol.

Anyway, if you use something like "Item damage bonus", it has no icon. You don't need to do weird X or Y values. Those can cause problems as well (no idea on the specifics, but I heard something like this crashes the game for Mac users or something).

I use this method for hidden tags on units - instead of storing it in some array or hashtable, I just put a blank ability (does nothing and has no icon) and use the ability ID in triggers. An example I used is I made it so paladins can't be zombified in my map by giving them an ability that just marks them as "can't be zombified".
 
Level 12
Joined
Jan 2, 2016
Messages
973
Yeah, I remeber you had asked something similar, more than 2 weeks ago, but back then I didn't really understand what's going on (in the solutions provided).

And I didn't really try it with abilities that have no icon.
From previous experience - when I give a buff to a spell, that doesn't have a buff by default - nothing happens, so I just used an item ability with a buff (permanent imolation). But it also has an icon, so I had to hide it.

Using X = 0 and Y = -11 crashes for Mac users, but using X = 0 and Y = -24xxxxxxx is safe.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Yeah, I remeber you had asked something similar, more than 2 weeks ago, but back then I didn't really understand what's going on (in the solutions provided).

And I didn't really try it with abilities that have no icon.
From previous experience - when I give a buff to a spell, that doesn't have a buff by default - nothing happens, so I just used an item ability with a buff (permanent imolation). But it also has an icon, so I had to hide it.

Using X = 0 and Y = -11 crashes for Mac users, but using X = 0 and Y = -24xxxxxxx is safe.

Interesting. You could also try the disabled spellbook trick, but then you'd need the spellbook, the ability, and the buff for each buff you want. It's easier to use the tornado aura buff.

Either way works, though.
 
Level 12
Joined
Jan 2, 2016
Messages
973
I have 1 more question, but before that I will state the pros and cons of using tornado aura and using an item ability:

Tornado Aura:
+ Has no icon (button), so no need to hide it.
- Doesn't display the 'effect' of the buff (on the unit), only the icon of the buff in the status bar
- The buff needs to be removed when you remove the ability, because it stays for few more seconds otherwise

Item abilities:
+ The buff disapears as soon as you remove the item ability.
+ The effect (art) of the buff is displayed.
- The icon (button) of the ability needs to be hidden.

So in my opinion - the item ability way is the winner, since hiding the button is really easy, and requires no triggers.

Now back to my question:
Is there any way to dispell a buff, applied THIS way (with a dispell skill in the game, not a trigger, that removes the buff source ability)?
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
Now back to my question:
Is there any way to dispell a buff, applied THIS way (with a dispell skill in the game, not a trigger, that removes the buff source ability)?
No.

Not a buff that is set by a passive ability (such as abilities based on auras), only mostly cast abilities. Dispelling aura based buffs must be removed by triggers in addition afaik. So ultimates, heals and auras cannot be dispelled in general.

http://classic.battle.net/war3/basics/spellbasics.shtml
 
Level 12
Joined
May 22, 2015
Messages
1,051
I have 1 more question, but before that I will state the pros and cons of using tornado aura and using an item ability:

Tornado Aura:
+ Has no icon (button), so no need to hide it.
- Doesn't display the 'effect' of the buff (on the unit), only the icon of the buff in the status bar
- The buff needs to be removed when you remove the ability, because it stays for few more seconds otherwise

Item abilities:
+ The buff disapears as soon as you remove the item ability.
+ The effect (art) of the buff is displayed.
- The icon (button) of the ability needs to be hidden.

So in my opinion - the item ability way is the winner, since hiding the button is really easy, and requires no triggers.

Now back to my question:
Is there any way to dispell a buff, applied THIS way (with a dispell skill in the game, not a trigger, that removes the buff source ability)?

You can attach the animation onto the tornado aura ability. It will display like normal if you add it there. It seems to be 50-50.

You'd need to specifically remove the ability via trigger when the dispel effect happens. I was thinking of making a trigger where I can add "remove buff" functions to (by adding them as conditions) and running that when I want to dispel buffs. There'd probably be two separate ones - one for negative buffs and one for positive buffs. I'd just add the function for a particular buff to the appropriate one.
 
Level 7
Joined
Oct 19, 2015
Messages
286
Using X = 0 and Y = -11 crashes for Mac users, but using X = 0 and Y = -24xxxxxxx is safe.

I'm not sure what you mean by "xxxxxxx", but if it just means any seven digits then I've just tried that and it crashed the game for me on Windows XP. Using "-11" instead worked fine though and really hid the icon, I didn't know this could be done.

SAUS said:
You'd need to specifically remove the ability via trigger when the dispel effect happens. I was thinking of making a trigger where I can add "remove buff" functions to (by adding them as conditions) and running that when I want to dispel buffs. There'd probably be two separate ones - one for negative buffs and one for positive buffs. I'd just add the function for a particular buff to the appropriate one.
You should really just use an existing buff system, instead of writing a poor substitute from scratch.

SAUS said:
I don't think there is an item ability that shows a buff.
It was mentioned earlier in the thread: Item Immolation. It's not a "real" item ability though, since it shows an icon.
 
Level 12
Joined
Jan 2, 2016
Messages
973
I'm not sure what you mean by "xxxxxxx", but if it just means any seven digits then I've just tried that and it crashed the game for me on Windows XP. Using "-11" instead worked fine though and really hid the icon, I didn't know this could be done.
nope, I don't mean "any seven digits", I meant "I don't remember what were the other diggets".


You should really just use an existing buff system, instead of writing a poor substitute from scratch.
and why not, if it's needed? adding buffs trought a dummy, casting an ability with a buff is REALLY REALLY REALLY inefficient.
1) You need to create a dummy, add a skill ot it and make it cast the skill, while when you do it with item ability - you just add an ability to a unit.
2) If you want to add several types of buffs - you need to make different dummy skills, based on different base abilities, cuz even if you put different buffs on different abilities with the same skill as base - they wouldn't stack
 
Level 7
Joined
Oct 19, 2015
Messages
286
You misunderstood me. I am not against using a passive skill or an aura to display a triggered buff. In fact, I think that's a better approach than using default WC3 buff spells. It stacks better, is easier to create in the object editor, doesn't rely on dummy casters... the only downside is that you have to trigger all dispel effects (which I don't think is a big downside at all). The point I wanted to make was that buff systems have this dispel functionality built in already so you don't have to code it from scratch like SAUS was suggesting. Buff systems can also handle other common buff functionality like expiration timers and stuff so you don't have to write the same code over and over again for each buff spell you make.
 
Level 9
Joined
Sep 20, 2015
Messages
385
Using X = 0 and Y = -11 crashes for Mac users, but using X = 0 and Y = -24xxxxxxx is safe.

Oh good to know that. :)
But how you set the Y = -2147483648 in object editor? I tried with shift+enter but the value is 1000000000 and it crash the game. If i use -11 it works fine but i have Windows, and i want Mac users to be able to play :).
So there is a JASS command that can set the abilitiy's button position to Y = -2147483648? Or i have to take the ability ID and add a line in the CommandFunc.txt file?


Maybe this is an offtopic question?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Oh good to know that. :)
Not sure it still applies as the update has completely changed the mac build. People have not reported what is still broken with it.

So there is a JASS command that can set the abilitiy's button position to Y = -2147483648?
No such native.

Or i have to take the ability ID and add a line in the CommandFunc.txt file?
No idea what you mean by that.

People need to error check the new mac build. There is a chance all incompatibility errors have been fixed depending how it was ported. If it was ported straight from the Windows build then all errors will have been fixed. If it was ported from their old PowerPC build and not all errors fixed then the errors will still remain.
 
Level 9
Joined
Sep 20, 2015
Messages
385
Not sure it still applies as the update has completely changed the mac build. People have not reported what is still broken with it.

Oh right we will se then

No such native.

:'( damn that would have been awsome

No idea what you mean by that.

http://www.hiveworkshop.com/forums/lab-715/removing-standart-command-buttons-commandfunc-txt-261559/

Follow this thread i tought you maybe can add a line in that txt using the ability ID and change the position to custom X Y




People need to error check the new mac build. There is a chance all incompatibility errors have been fixed depending how it was ported. If it was ported straight from the Windows build then all errors will have been fixed. If it was ported from their old PowerPC build and not all errors fixed then the errors will still remain.

So Better use the Mac Y = 2xxxxxx ? so that will be fine with both OS
 
Status
Not open for further replies.
Top