RangerX
I am justice!
- Reaction score
- 69
i need to make this function run faster is there any way ?
i used this custom script to run the function
but it's run very slow :|
it's just sliding the unit to a point :| ...
JASS:
function SlideUnit takes unit u , location startloc , location endloc , real speed returns nothing
local real dx = GetLocationX(endloc) - GetLocationX(startloc)
local real dy = GetLocationY(endloc) - GetLocationY(startloc)
local real x
local real y
local real distreal
local real anglereal
local location a = startloc
local location b = endloc
local location c = GetUnitLoc(u)
set distreal = SquareRoot(dx * dx + dy * dy)
set anglereal = AngleBetweenPoints(a,b)
loop
exitwhen distreal <= 50
set x = GetLocationX(c) + 25 * Cos(anglereal * bj_DEGTORAD)
set y = GetLocationY(c) + 25 * Sin(anglereal * bj_DEGTORAD)
call SetUnitX(u,x)
call SetUnitY(u,y)
call SetUnitFacing(u,anglereal)
set c = GetUnitLoc(u)
set dx = GetLocationX(b)- GetLocationX(c)
set dy = GetLocationY(b)- GetLocationY(c)
set distreal = SquareRoot(dx * dx + dy * dy)
set anglereal = AngleBetweenPoints(c,b)
call TriggerSleepAction(speed)
endloop
endfunction
i used this custom script to run the function
Trigger:
- Custom script: call SlideUnit(bj_lastCreatedUnit,udg_Temp_Loc,udg_Temp_Loc2,0.01)
but it's run very slow :|
it's just sliding the unit to a point :| ...