- Joined
- Aug 21, 2008
- Messages
- 533
I m creating a knockback system, but somehow jasshelper finds 2 Syntax errors where i write everything right:
JASS:
globals
group KBgroup
endglobals
function knockback takes real distance,real direction,real time,unit u returns nothing
local real cos = Cos(direction)
local real sin = Sin(direction)
set distance=distance/time*33
call SaveReal( udg_HashTable, GetHandleId(u), StringHash("Cos"), cos)
call SaveReal( udg_HashTable, GetHandleId(u), StringHash("Sin"), sin)
call SaveReal( udg_HashTable, GetHandleId(u), StringHash("Time"), time)
call SaveReal( udg_HashTable, GetHandleId(u), StringHash("Dist"), distance)
call GroupAddUnit(KBgroup,u)
call PauseUnit(u,true)
endfunction
function knockbackex takes nothing returns nothing
local unit u = GetEnumUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real cos =LoadReal(udg_HashTable, GetHandleId(u),StringHash("Cos"))
local real sin =LoadReal(udg_HashTable, GetHandleId(u),StringHash("Sin"))
local real time =LoadReal(udg_HashTable, GetHandleId(u),StringHash("Time"))
local real dist =LoadReal(udg_HashTable, GetHandleId(u),StringHash("Dist"))
call SaveReal( udg_HashTable, GetHandleId(u), StringHash("Time"), time-0.03)
set x=x+dist*sin
set y=y+dist*sin
SetUnitX(u,x) //<- Syntax error?
SetUnitY(u,y)
if time<0.03 then
call GroupRemoveUnit(KBgroup,u)
call FlushChildHashtable( udg_HashTable,GetHandleId(u) )
call PauseUnit(u,false)
endif
endfunction
function knockbackpick takes nothing returns nothing
ForGroup(KBgroup,function knockbackex)//<- Syntax error?
endfunction
function InitTrig_knockback takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( trig, 0.03 )
call TriggerAddAction( trig, function knockbackpick )
endfunction