• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] little question

Status
Not open for further replies.
Level 5
Joined
Nov 25, 2004
Messages
65
one more question, is the "setunitposition" function dont have any of those advamtages?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
if SetUnitPosition was a BJ ( non-native ) it would look like this. Please note that it still runs faster that SetUnitPositionLoc.

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