Warcraft III resources & community, 2003–2006 · archived

little question

6 posts
#1

little question

what does this thing do "native SetUnitX and native SetUnitY" ??
#2
exactly what they sound like

SetUnitX sets a unit's X coord and SetUnitY sets a unit's Y coord.

the advantage of these is that

- they dont check for pathing
- they sont reset orders
- they run faster
- you can choose to use only one of these, to change a single value.
#3
thx for the reply! :D
#4
one more question, is the "setunitposition" function dont have any of those advamtages?
#5
if SetUnitPosition was a BJ ( non-native ) it would look like this. Please note that it still runs faster that SetUnitPositionLoc.

function SetUnitPosition takes unit u, real x, real y returns nothing
    if x < GetRectMaxX( bj_mapInitialPlayableArea ) and x > GetRectMinX( bj_mapInitialPlayableArea ) and y < GetRectMaxY( bj_mapInitialPlayableArea ) and y > GetRectMinY( bj_mapInitialPlayableArea ) then
        call SetUnitX( u, x )
        call SetUnitY( u, y )
    endif
    call PauseUnit( u, true )
    call PauseUnit( u, false )
endfunction


meaning that it runs faster, yet still resets orders and animations.

PS. to avoid Game Crashes, always use that condition ( the if/then ) there with SetUnitX/Y, as they can move the unit outside the map bounds.
#6
k thx man!!