- Joined
- Mar 23, 2007
- Messages
- 302
Hi
Here i have a problem.
this thing just dont work....
can some one help me
i want to get every 0.33 (in this example every 5) seconds the distanze.
Here i have a problem.
this thing just dont work....
can some one help me
i want to get every 0.33 (in this example every 5) seconds the distanze.
JASS:
function Trig_MovedWay_Actions takes nothing returns nothing
local group G = GetUnitsInRectMatching(GetPlayableMapRect(), null)
local unit g = FirstOfGroup(G)
local real x
local real y
local real xold
local real yold
local real xd
local real yd
local real Way
loop
set g = FirstOfGroup(G)
exitwhen g == null
set xold = GetHandleReal(g, "x")
set yold = GetHandleReal(g, "y")
set x = GetUnitX(g)
set y = GetUnitY(g)
set xd = x - xold
set yd = y - yold
set Way = SquareRoot(xd*xd+yd*yd)
call SetHandleReal(g, "x", x)
call SetHandleReal(g, "y", y)
call GroupRemoveUnit(G,g)
endloop
call DestroyGroup(G)
set G = null
set g = null
endfunction
//===========================================================================
function InitTrig_MovedWay takes nothing returns nothing
set gg_trg_MovedWay = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_MovedWay, 5 )
call TriggerAddAction( gg_trg_MovedWay, function Trig_MovedWay_Actions )
endfunction