knockback not working

Nyph

Occasional News Reader
Reaction score
87
I've just started using jass over GUI and i have made a knockback function and i can't seem to get to work does anyone know why?

here it is
JASS:
function knockback takes nothing returns nothing
local timer t = GetExpiredTimer()
local real angle = GetHandleReal(t,"angle")
local unit targ = GetHandleUnit(t,"targ")
local real dist = GetHandleReal(t,"dist")
local real x = GetUnitX(targ)
local real y = GetUnitY(targ)
call SetUnitPosition(targ,PolarProjectionX(x,dist,angle),PolarProjectionY(x,dist,angle))
set t = null
set targ = null
endfunction

function KnockbackUnit takes unit targ, real dist, real angle, real time returns nothing
local timer t
call SetHandleHandle (t,"targ",targ)
call SetHandleReal (t,"dist",dist)
call SetHandleReal (t,"angle",angle)
call TimerStart(t,0.035,true,function knockback)
call PolledWait(time)
call FlushHandleLocals(t)
call DestroyTimer(t)
set t = null
endfunction
 

waaaks!

Zinctified
Reaction score
255
where did u get this function?
JASS:
PolarProjectionX(x,dist,angle)


in my opinion

JASS:
local timer t
//must be
local timer t = CreateTimer()


JASS:
PolarProjectionX(x,dist,angle)//the correct one
PolarProjectionY(x,dist,angle)//the wron one

PolarProjectionY, it is obvious that you move the unit in the Y axis...but why move it in x?
Code:
PolarProjection[B][COLOR="Red"]Y[/COLOR][/B]([B][COLOR="Red"]x[/COLOR][/B],dist,angle)

this is just my opinion though
 

Nyph

Occasional News Reader
Reaction score
87
thanks waaaks i got it working(sort of) i think it was the timer +rep

edit: one more question, why does it only have two different angles when i call it? I mean when i do:
call KnockbackUnit(target,dist,angle,time) for the angle it is either at around 60 degrees or around 225 degrees... Do you know how to fix this?
 
Reaction score
456
What kind of code do you have now? Did you change everything waaaks! said?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top