| 05-14-2007, 04:33 AM | #1 |
I'm creating an ability that will add a buff that adds +1 armor every time the hero is attacked and will stack to a certain point. Currently thing all works fine, except for the stacking part. I am unable to detect the current rank of the buff that the unit has, so that I can have a spell with a rank of (current rank) +1. All that I need to make this work is a method of detecting the current rank of the buff that is on the unit. I generally work in GUI, but I understand Jass well enough to implement code as well. |
| 05-14-2007, 04:56 AM | #2 |
i dont think buffs has rank |
| 05-14-2007, 04:59 AM | #3 |
You can't get the level of a buff, even though it says "Level X" in game on the buff tooltip. The best you can do is create different buffs for each level and add them to an array where the index corresponds with the level of the buff. Then, loop through that array until you find a match and know what buff the unit has. |
| 05-14-2007, 05:04 AM | #4 |
I did an ability which stacks the same way you want it to; What I did was use an integer variable, and Set the level of the casted ability to increase armor to the integer, then increase the integer by 1. |
| 05-14-2007, 05:20 AM | #5 | |
Quote:
|
| 05-14-2007, 05:32 AM | #6 |
You could easily make it MUI by using a unit array and integer array, and then doing a loop and checking if Attack unit equal to Unit[Integer A] and if it is, do actions. |
| 05-15-2007, 01:52 AM | #7 |
What if I used a set of buffs, where each rank has a buff named the integer that it corresponds to. This way, I should be able to use the "conversion sting to integer" to find the pseudo-rank of the buff and then use that to configure what the next buff to be applied should be. Would this work? I would test it myself now, but I am unable to get to a computer running Wc3 at the moment. |
| 05-15-2007, 06:00 AM | #8 |
Yeah, Fatalitan, that would work. You'd probably have to use a substring so that you could have "YourBuff X", where X being the level. |
| 05-23-2007, 07:48 PM | #9 |
You can get the lvl of a buff using Jass: JASS:native function GetUnitAbilityLevel takes unit witchunit, integer abilcode returns integer JASS:function UnitHasBuffBJ takes unit witchUnit, integer buffcode returns boolean JASS:return GetUnitAbilityLevel(witchUnit, buffcode) > 0 |
| 05-23-2007, 07:56 PM | #10 |
As i did the same thing hereby some things you can do: 1. Link the buff level to a techlevel. 2. then check the (opponents)players.researchtechlevel |
| 05-23-2007, 11:31 PM | #11 | ||
Quote:
Quote:
And I'm pretty sure Fatalian got his quesion answered long ago... |
