HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Event for Spell Activation

11-12-2006, 07:25 AM#1
xombie
On the spell Immolation (I believe it is the only one) what is the event for detecting when it is activated/deactivated?

In one of my spells I try to kill a timer when the unit "deactivates" the spell by checking
Collapse JASS:
 GetUnitAbilityLevel( <unit>, <buff> ) > 0 
but that doesn't seem to work properly, it doesn't return anything.

Collapse JASS:
function <name> takes <stuff> returns <stuff>

    if ( GetUnitAbilityLevel( <unit>, <buff> ) > 0 ) then
        call BJDebugMsg( <message> )
    else
        call BJDebugMsg( <alternate message> )
    endif

endfunction

It didn't do ANYTHING, so not only does he not have the buff, he also has it. I do not understand...

:: edit ::

Completely ignore the above, it is a stupid bug that is caused by something ELSE that I cannot explain.. here it is:

Inside of a loop I give these statements:
Collapse JASS:
loop
exitwhen ( <variable 'b'> == null )
exitwhen ( <variable 'a'> != null )
...
endloop

Is there something wrong with putting "!=" in an "exitwhen" comparison? Please fill me on the wonders that is the world editor.
11-12-2006, 07:57 AM#2
BertTheJasser
Generlly detecting a spellactivation is to detect EVENT_UNIT_SPELL_EFFECT. Deactivation is EVENT_UNIT_SPELL_ENDCAST/FNINISH (not shure which one if it is the last, you addition ally need EVENT_UNIT_DEATH )

Note: Defend does not work that way. For this exception you must detect it's orders.
11-12-2006, 08:27 AM#3
xombie
Hmm okay; I'm having such large bugs with as well with some other equations I'm doing... I'm never very lucky when it comes to my code working, I usually always hit the nail (in this case warcraft engine exception) right on the head, and I'm extremely unlucky that way.