SetDistanceToUnit I think this is surprisingly useful. The "from" unit is the center of reference for setting the position of the "to" unit. The "dist" real is the distance to set between the units. So if you wanted a spell where a unit walks along pushing all units out of the way, you would, for each unit in "dist" range, call SetDistanceToUnit(pusher, pickedUnit, dist). JASS: function SetDistanceToUnit takes unit from, unit to, real dist returns nothing local real x=GetUnitX(to)-GetUnitX(from) local real y=GetUnitY(to)-GetUnitY(from) local real factor=dist/SquareRoot(x*x+y*y) call SetUnitX(to,GetUnitX(from)+x*factor) call SetUnitY(to,GetUnitY(from)+y*factor) endfunction Alternatively: JASS: function SetDistanceToXY takes real x, real y, unit to, real dist returns nothing local real tx=GetUnitX(to)-x local real ty=GetUnitY(to)-y local real factor=dist/SquareRoot(tx*tx+ty*ty) call SetUnitX(to,x+tx*factor) call SetUnitY(to,y+ty*factor) endfunction Hopefully this inspires some creativity.

> What angle? Who needs angles? Well, when it's setting a unit to be in some distance from another, what would be the "target"`s angle? Would it just get moved north or south or at 211 degrees or some other value around the "caster"?

In the correct direction. IE if it was at an angle of 70 degrees, it will remain at an angle of 70 degrees except further away. I did it with vectors, that's all. More efficient than angles.

Played around with it, made some spells that were fun to play with. Linked Soul and Magnet Shield. Linked Soul forced units to retain a certain distance or snap together being stunned. Magnet shield constantly pushes units too close and damages.

i've started to use it. but i had to add the following function: JASS: function getdis takes unit x, unit y returns real local real dx = GetUnitX(x) - GetUnitX(y) local real dy = GetUnitY(x) - GetUnitY(y) return SquareRoot(dx * dx + dy * dy) endfunction this was for the original function. i haven't written a complementary function for the XY function because i haven't used it yet. it would probably go something like this: JASS: function getdisr takes real x, real y, unit z returns real local real dx = x - GetUnitX(z) local real dy = y - GetUnitY(z) return SquareRoot(dx * dx + dy * dy) endfunction