Tom_Kazansky
--- wraith it ! ---
- Reaction score
- 157
I think of using a timer to track whether a unit is moving (run, walk) or not so I attach 2 real values (x, y coordinate) to it. These are updated frequently.
now I guess I have to update these whenever the unit is moved by [ljass]SetUnitX[/ljass], [ljass]SetUnitY[/ljass], [ljass]SetUnitPosition[/ljass] (well, I only use these)
function wraper:
hook:
err... so, which way is more efficient? or they're the same?
now I guess I have to update these whenever the unit is moved by [ljass]SetUnitX[/ljass], [ljass]SetUnitY[/ljass], [ljass]SetUnitPosition[/ljass] (well, I only use these)
function wraper:
JASS:
function SetUnitXEx takes unit u, real x returns nothing
call SetUnitX(u,x)
//update x coordinate for u
endfunction
function SetUnitYEx takes unit u, real y returns nothing
call SetUnitY(u,y)
//update y coordinate for u
endfunction
function SetUnitPositionEx takes unit u, real x, real y returns nothing
call SetUnitPosition(u,x,y)
//update x coordinate for u
//update y coordinate for u
endfunction
hook:
JASS:
hook SetUnitX hook_SetUnitX
hook SetUnitY hook_SetUnitY
hook SetUnitPosition hook_SetUnitPosition
function hook_SetUnitX takes unit u, real x returns nothing
//update x coordinate for u
endfunction
function hook_SetUnitY takes unit u, real y returns nothing
//update y coordinate for u
endfunction
function hook_SetUnitPosition takes unit u, real x, real y returns nothing
call SetUnitPosition(u,x,y)
//update x coordinate for u
//update y coordinate for u
endfunction
err... so, which way is more efficient? or they're the same?