- Joined
- Jul 26, 2008
- Messages
- 1,009
Alright so I've been racking my brain trying to figure out how to get this timer to expire properly. It's basically a track effect.
All units are pinged, then if the spell is a high enough level you will get shared vision of the units for a short duration. The problem (I assume) is that all the units are not being stored into a variable when the timer starts, so they're not being removed when the timer expires. I've tried putting in an array to count them all, then creating one timer for each unit, but I'm pretty sure I did that wrong too.
Could someone help me figure out the proper way to save all these units into a variable, and then remove vision upon the timer's expriation? Thanks
All units are pinged, then if the spell is a high enough level you will get shared vision of the units for a short duration. The problem (I assume) is that all the units are not being stored into a variable when the timer starts, so they're not being removed when the timer expires. I've tried putting in an array to count them all, then creating one timer for each unit, but I'm pretty sure I did that wrong too.
Could someone help me figure out the proper way to save all these units into a variable, and then remove vision upon the timer's expriation? Thanks
JASS:
//This is where the loop begins where we choose the units to track
loop
set t = FirstOfGroup(g)
exitwhen t == null
call PingMinimap(GetUnitX(t), GetUnitY(t), 1.5*GetUnitAbilityLevel(D.c, SpellID))
if GetUnitAbilityLevel(D.c, SpellID) == 3 then
set temp[D.i] = t
call UnitShareVision(temp[D.i], GetOwningPlayer(D.c), true)
call SetTimerData(tim, D)
call TimerStart(tim, 3.0, false, function Track_Timer)
endif
call GroupRemoveUnit(g, t)
set D.i = D.i + 1
endloop
JASS:
//The simple timer for the end of the duration
private function Track_Timer takes nothing returns nothing
local timer tim = GetExpiredTimer()
local Data D = Data(GetTimerData(tim))
call UnitShareVision(temp[D.i], GetOwningPlayer(D.c), false)
call ReleaseTimer(tim)
call D.destroy()
endfunction
Last edited: