- Joined
- Feb 19, 2008
- Messages
- 61
What is JASS, and AI.
globals
integer array StunArray
integer StunTotal=0
endglobals
struct stundata
unit u=null
real d=0
boolean destroyplease=false
endstruct
function StunUnit_KeepStunned takes nothing returns nothing
local integer i = 0
local stundata dat
loop
exitwhen i==Stun_Total
set dat=StunArray[i]
if dat.destroyplease then
set Stun_Total=Stun_Total-1
set StunArray[i]=StunArray[Stun_Total]
call dat.destroy()
set i=i-1
else
set dat.d=dat.d-0.01
call SetUnitPosition(dat.u,GetUnitX(dat.u),GetUnitY(dat.u))
set dat.destroyplease=(dat.d<=0)
endif
set i=i+1
endloop
if Stun_Total==0 then
call ReleaseTimer(GetExpiredTimer())
endif
endfunction
function StunUnit takes unit u,real d returns nothing
local stundata dat=stundata.create()
set dat.d=d
set dat.u=u
if (Stun_Total==0) then
call TimerStart(NewTimer(),.01,true,function StunUnit_KeepStunned)
endif
set Stun_Total=Stun_Total+1
set StunArray[Stun_Total-1]=dat
endfunction