[vJASS] Refactoring from GTrigger to RegisterPlayerUnitEvent

Status
Not open for further replies.
Level 9
Joined
Jun 13, 2008
Messages
362
I have an old spell which uses very old and obsolete libraries. I wanted to upgrade them with their better and up-to-date counterparts.

Converting this part;


Code:
         private static method onInit takes nothing returns nothing
             call GT_AddStartsEffectAction(function thistype.Action,RAWCODE)
             call GT_AddBeginsCastingAction(function thistype.Action2,RAWCODE)

           set thistype.cf = Condition(function thistype.DoDamage)
        endmethod

to this part;

Code:
         private static method onInit takes nothing returns nothing
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_EFFECT, function thistype.Action)
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_CAST, function thistype.Action2)
           
            set thistype.cf = Condition(function thistype.DoDamage)
        endmethod


This causes weird event firing behaviors and the worst is all spells now trigger this custom spell as well.

I'm just started learning this stuff, helps are appreciated.
 
Status
Not open for further replies.
Back
Top