Warcraft III resources & community, 2003–2006 · archived

AddSpecialEffectLocWithTimer

not rated
Submitted by AltSubmitterFunctions0 downloads
This lets you create a special effect that will automatically delete itself after a period of time. This way you don't have to worry about going back and deleting it. Although the AddSpecialEffectLocWithTimer_Child function is necessary for this to work, you should only call AddSpecialEffectLocWithTimer, which takes the same parameters as the normal special effect function except you also have to pass it duration. The reason a separate trigger is created is because without it, the wait would cause whichever trigger is calling the function to pause until the special effect was deleted.

Source

//Ignore this function except for making sure it comes first in the script
function AddSpecialEffectLocWithTimer_Child takes nothing returns nothing
    local effect tempeffect = bj_lastCreatedEffect
    local real duration     = bj_enumDestructableRadius
    call PolledWait( duration )
    call DestroyEffect( tempeffect )
endfunction

//This is the function you actually want to call
function AddSpecialEffectLocWithTimer takes location whichLocation, string whichEffect, real duration returns nothing
    local trigger dispatcher = CreateTrigger()
    local real temp = bj_enumDestructableRadius
    set bj_enumDestructableRadius = duration
    call AddSpecialEffectLocBJ( whichLocation, whichEffect )
    call TriggerAddAction( dispatcher, function AddSpecialEffectLocWithTimer_Child )
    call TriggerExecute( dispatcher )
    call DestroyTrigger( dispatcher )
    set bj_enumDestructableRadius = temp
endfunction

Comments

0

No comments.