Warcraft III resources & community, 2003–2006 · archived

Add Special Effect Timed

not rated
Submitted by IzualizmFunctions0 downloads
Adds special effect to units or points, automatically destroys it after a set amount of time. Just do a call in your functions and leave everything else to it. Uses Handle Variables and H2I(both in jass section too) so it doesn't need any other variables, just make sure you have them ready before put this script in.

Source

//Name: Add Special Effect Timed
//Note: Uses H2I and Handle Variables functions, available at
//http://www.wc3sear.ch/index.php?p=JASS
//Add to a unit:
//call AddSFXTimer(modelName, targetWidget, attachPointName, null, destroyafter)
//or to a point:
//call AddSFXTimer(modelName, null, null, where, destroyafter)

function H2SFX takes handle h returns effect
  return h
endfunction

function AddSFXDestroy takes nothing returns nothing
call DestroyEffect(H2SFX(GetHandleHandle(GetExpiredTimer(),"sfx"))) 
endfunction

function AddSFXTimer takes string modelName, widget targetWidget, string attachPointName, location where, real destroyafter returns effect
local timer t = CreateTimer()
local trigger trig = CreateTrigger()

if targetWidget == null then
    call SetHandleHandle(t,"sfx",AddSpecialEffectLoc(modelName, where))
else
    call SetHandleHandle(t,"sfx",AddSpecialEffectTarget(modelName, targetWidget, attachPointName))
endif
call TimerStart( t, destroyafter, false, null )
call TriggerRegisterTimerExpireEvent(trig, t)
call TriggerAddAction(trig,function AddSFXDestroy)
set trig = null
return H2SFX(GetHandleHandle(t,"sfx"))
endfunction

Comments

2
Oh didn't notice that one, I'm using Vexorian's functions in my map :)

Thanks though, will definitely check it out
Quite good, but why do you use H2SFX when you could use GetHandleEffect?

Here is a link to the nevest version of the handle vars: http://www.wc3jass.com/viewtopic.php?p=2327 Oh and check this wonderful Jass community :D ...