Warcraft III resources & community, 2003–2006 · archived

SwitchUnits

not rated
Submitted by AltSubmitterFunctions0 downloads
Very simple, cleanly switches the position of two units. Nuff said.

Source

function SwitchUnits takes unit whichUnit1, unit whichUnit2 returns nothing
    local location unitloc1 = GetUnitLoc(whichUnit1)

    call SetUnitPathing( whichUnit1, false )
    call SetUnitPathing( whichUnit2, false )

    call SetUnitPositionLoc( whichUnit1, GetUnitLoc(whichUnit2) )
    call SetUnitPositionLoc( whichUnit2, unitloc1 )

    call SetUnitPathing( whichUnit1, true )
    call SetUnitPathing( whichUnit2, true )

    call RemoveLocation(unitloc1)
endfunction

Comments

0

No comments.