; FindSafeSpot: ; Checks around Me.Location in a 360 degree radius ; in 5 degree increments for a location which is ; "safe" (has no mobs within ${AgroRange} member point3f:FindSafeSpot() { variable guidlist TargetList ;holds targetlist search variable int MaxScanRange=100 ;scan range for search variable int AgroRange=30 ;agro range (abitrary, need good value) variable int Idx ;counter variable int Distance=0 ;counter variable int Angle=0 ;counter variable bool GoodLoc=TRUE ;success state variable point3f TestLoc ;return value ;Get all the targets that are within MaxScanrange TargetList:Search[-units,-nearest,-nopets,-alive,-nonfriendly,-range ${MaxScanRange}] ;search progressively farther from current location do { ;setup/reset variables for this pass Angle:Set[0] ;search through the 360 degree arc around current location do { ;setup/reset variables for this pass TestLoc.X:Set[${Me.X} + (${Distance}*${Math.Cos[${Angle}]})] TestLoc.Y:Set[${Me.Y} + (${Distance}*${Math.Sin[${Angle}]})] GoodLoc:Set[TRUE] Idx:Set[0] ;check each target within range ;and determine if they are in aggro range ;of the loc we're checking do { if ${Math.Distance[${TestLoc.X},${TestLoc.Y},${Unit[${TargetList.GUID[${Idx}]}].X},${Unit[${TargetList.GUID[${Idx}]}].Y}]}<${AgroRange} GoodLoc:Set[FALSE] } while ${Idx:Inc}<=${TargetList.Count} && ${GoodLoc} if ${GoodLoc} return ${TestLoc} } while ${Angle:Inc[5]}<360 } while ${Distance:Inc[5]}<=${MaxScanRange}-${AgroRange} TestLoc:Set[NULL] return ${TestLoc} }