Doomhammer
Bob Kotick - Gamers' corporate spoilsport No. 1
- Reaction score
- 67
some weeks ago, we had this discussion about my lousy way of destroying effects after a certain amount of time in situations where you actually can't have TriggerSleepAction(), such as functions directly processing picked units in a group. (ref.: http://www.thehelper.net/forums/showthread.php?t=61263)
so now, I've had another go, making use of CSC and CSSafety. It still looks somewhat...maybe not ideal yet. I mean, timers are a great thing, but it's more effort to make things "clean" again as opposed to a simple wait. Either way, I'd be delighted to have some opinions and suggestions for improvement.
example:
so now, I've had another go, making use of CSC and CSSafety. It still looks somewhat...maybe not ideal yet. I mean, timers are a great thing, but it's more effort to make things "clean" again as opposed to a simple wait. Either way, I'd be delighted to have some opinions and suggestions for improvement.
JASS:
function KillEffect takes nothing returns nothing
local timer t=GetExpiredTimer()
call DestroyEffect(GetAttachedEffect(t,"timed_effect"))
call AttachObject(t,"timed_effect",null)
call ReleaseTimer(t)
endfunction
function DestroyEffectTimed takes effect fx, real s returns nothing
local timer t=NewTimer()
call AttachObject(t, "timed_effect", fx)
call TimerStart(t, s, false, function KillEffect)
endfunction
example:
JASS:
call DestroyEffectTimed(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIhe\\AIheTarget.mdl",u,"origin"),1.3)