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

Level of Buff on Unit

Status
Not open for further replies.
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hi guys,

I have encountered something strange. My unit is affected by a custom Devotion Aura spell which is on level 3. I use GetUnitAbilityLevel(myUnit, 'B000') (B000 is the ID of the custom buff) and it returns 1 instead of 3. Is this meant to happen or am I doing something wrong?

Thanks,

Mr_Bean
 
Level 9
Joined
Jul 10, 2011
Messages
562
does it also returns 1 if you search the source of the buff (here the unit with the devotion aura) and try to get the level there? i ask that because (im not sure) buffs always are level 1 and just the ability is level X if im right.
 
Level 9
Joined
Jul 10, 2011
Messages
562
more work? Oo

you just have to loop through the units in range of the aura from the unit with the buff and check whether the unit has the ability...that not really more work Oo
 
Level 9
Joined
Jul 10, 2011
Messages
562
the prolem is that if the buff is from an aura and the aura isnt an ability of that unit the level is 1 all the time ;D you have to find the source of it xD
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
You can't get the level of a buff using GetUnitAbilityLevel. All you can do is check whether it has the ability or not. That's all. I know it's quite sucky, but you have to live with it.

You have to manually keep track of buff levels - that's what I'm doing too (you shall see it once I post my first hero contest wip)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
LOL I just tested it.
No matter which unit you're getting from (either Caster or AffectedUnit), the value still returns as '1'.

Therefore I think when the buff applies, you're gonna need a method to store value (level of ability) to the unit and loads it back when you want to use it.

Yeah, lots of work.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Nah, it can be done in less than 100 lines. Not more than five minutes :)
The thing is, he already started the spell in mid-way.
Changing the algorithm or the way it executes might force him to re-do the triggers all over again (or just partially).

Either way, he have to re-code it because he can't rely on the function, it always returns 1.
 
Status
Not open for further replies.
Top