SwitchUnits
not ratedVery simple, cleanly switches the position of two units. Nuff said.
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)
endfunctionNo comments.