Warcraft III resources & community, 2003–2006 · archived

Add Timed Effects

not rated
Submitted by Nantuko_HuskFunctions0 downloads
Adds timed effects,work like normal effects but jsut are timed and will be destroyed after a given period of time.
I thought it was useless for the functions to return an effect,since the only thing you can do with them is destroy them and they are destroyed by themselves into these functions,so no need.
I have included all the types of effects that warcraft III contains

NOTE: Requires the local handle variables.

Source

function AddTimedEffectDestroy takes nothing returns nothing
    call DestroyEffect(GetHandleEffect(GetExpiredTimer(),"e"))
    call FlushHandleLocals(GetExpiredTimer())
    call DestroyTimer(GetExpiredTimer())
endfunction


function AddTimedEffectLoc takes string modelname,location where,real duration returns nothing
    local timer t = CreateTimer()
    local effect e
    set e =AddSpecialEffectLoc(modelname,where)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

function AddTimedEffectTarget takes string modelname,widget targetwidget,string attachpointname,real duration returns nothing
    local timer t = CreateTimer()
    local effect e
    set e =AddSpecialEffectTarget(modelname,targetwidget,attachpointname)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

function AddTimedSpellEffect takes string abilitystring,effecttype z,real x,real y,real duration returns nothing
    local timer t = CreateTimer()
    local effect e
    set e =AddSpellEffect(abilitystring,z,x,y)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

function AddTimedSpellEffectById takes integer abilityid,effecttype z,real x,real y,real duration returns nothing
    local timer t = CreateTimer()
    local effect e
    set e =AddSpellEffectById(abilityid,z,x,y)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

function AddTimedSpellEffectByIdLoc takes integer abilityid,effecttype z,location l,real duration returns nothing
    local timer t = CreateTimer()
    local effect e
    set e =AddSpellEffectByIdLoc(abilityid,z,l)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

function AddTimedSpellEffectLoc takes string abilitystring,effecttype z,location l,real duration returns nothing
    local timer t = CreateTimer()
    local effect e
    set e =AddSpellEffectLoc(abilitystring,z,l)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

function AddTimedSpellEffectTarget takes string modelname,effecttype z,widget targetwidget,string attachpoint,real duration returns nothing

    local timer t = CreateTimer()
    local effect e
    set e =AddSpellEffectTarget(modelname,z,targetwidget,attachpoint)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

function AddTimedSpellEffectTargetById takes integer abilityid,effecttype z,widget targetwidget,string attachpoint,real duration returns nothing
    local timer t = CreateTimer()
    local effect e
    set e =AddSpellEffectTargetById(abilityid,z,targetwidget,attachpoint)
    call SetHandleHandle(t,"e",e)
    call TimerStart(t,duration,false,function AddTimedEffectDestroy)
    set e = null
endfunction

Comments

1
This can indeed be useful! I think I will use it. Excellent work! :D