HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem with vJass ability

07-27-2011, 09:27 PM#1
Linaze
Hello. I'm having problems with a spell of mine:

Expand JASS:

So my problems are:
  • It's not MUI.
  • The buff won't be applied.
  • The code probably sucks.
  • It runs forever, and I don't know how to make it stop.
So yeah, I'm pretty fucked over here. If someone could help me, it would be greatly appreciated.
07-27-2011, 11:50 PM#2
Anitarf
The only way to apply a buff on a unit is to use some sort of a buff applying ability, attempting to add it directly using UnitAddAbility doesn't work.

As far as abilities go, you can either use a buff spell or an aura. Buff spells based on the same base spell don't stack, so if you go this route you might run out of different buff spells for your buffs.

For this reason, we prefer to use auras which do stack as long as they use different buffs, even if they are based on the same base aura. This has some minor drawbacks (buff won't start fading when it's about to expire, units with autocast dispel abilities won't use them on the buffed unit) but in most maps those aren't critical problems.

As far as auras go, the tornado slow aura is preferred because it doesn't show an icon in the unit's command card. It's a negative aura so the tooltip of the buff it places will display the buff's name in red, but you can always fix this using colour codes in the buff's name.

You can also use the aura ability to place the special effect on the unit instead of having to create it using triggers. Make sure to use the aura to apply the effect, not the buff. For some reasons, aura buffs do not display their model when applied on the same unit that is the source of the aura.


For coding a spell like this, I would recommend the ABuff system. It provides you with a framework that already covers things like the spell expiring and a periodic event. You just need to define an aBuff and write the function that does the periodic healing and use it as the aBuff's periodic event response. Check the documentation and examples in the aBuff map for more details on the implementation.
07-28-2011, 07:04 AM#3
Fledermaus
You're initializing the hastable each time the spell is cast, I'm not sure if that will bug but it's not good! If you want to use a hashtable (although this is very bad as there is a 255 limit of hashtables so 1 hashtable per spell is yuck), initialize it in the Init function.

I too would recommend using a buff system. I haven't ever used ABuff but I assume it's good. Dusk's buff system is also pretty nice :)