HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Math Help

01-27-2008, 02:31 AM#1
Joker
I'm trying to check if a unit is # units away from another unit.
Collapse JASS:
SquareRoot( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ) < 10
This is what I tried to use.

Heres what I'm using to move a unit
Collapse JASS:
call SetUnitPosition( a, x1+5 *Cos(f * bj_DEGTORAD), y1+5 *Sin(f * bj_DEGTORAD) )

What are you supposed to do?

Are they both bad?

Alternatives?
01-27-2008, 02:45 AM#2
HINDYhat
You should use this native instead :
Collapse JASS:
constant native IsUnitInRange       takes unit whichUnit, unit otherUnit, real distance returns boolean
As far as moving goes, I prefer using SetUnitX() and SetUnitY(), who are both faster than SetUnitPosition and with those, units retain their orders. The only problem with SetUnitX/Y is that the map crashes if a unit is moved too far out of map bounds.
01-27-2008, 03:06 AM#3
Joker
Strange, I don't ever remember repping you, but it seems i have...Need to spread it more :(

Ty btw.