• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Problem with Knockback system

Status
Not open for further replies.
Level 9
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
 
Status
Not open for further replies.
Top