Salty as fuck Posted March 9, 2016 Share Posted March 9, 2016 for instance... if player is closer to position1, make them walk there, else if it's position2, make them walk there Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted March 9, 2016 Share Posted March 9, 2016 position.distance(position) Quote Link to comment Share on other sites More sharing options...
Chris Posted March 9, 2016 Share Posted March 9, 2016 (edited) pos1.distance(pos2) || if myPosition#distance(pos1) <= x //do stuff else if myPosition#distance(pos2) <= x //do stuff Edited March 9, 2016 by Sinatra Quote Link to comment Share on other sites More sharing options...
Salty as fuck Posted March 9, 2016 Author Share Posted March 9, 2016 position.distance(position) pos1.distance(pos2) || if myPosition#distance(pos1) <= x //do stuff else if myPosition#distance(pos2) <= x //do stuff literally just checked the api lol thx fam Quote Link to comment Share on other sites More sharing options...
Token Posted March 9, 2016 Share Posted March 9, 2016 position.distance() will not work properly if you want accurate long distance checks because that's just an application of Pythagora's algorithm and does not take into account plane difference, links or obstacles at all. map.realDistance(Position position) should take into consideration all the above situations. You could also try walking.webWalk(Position... positions) as that walks to the closest of the given positions since you mentioned you only want to walk. 1 Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted March 9, 2016 Share Posted March 9, 2016 position.distance() will not work properly if you want accurate long distance checks because that's just an application of Pythagora's algorithm and does not take into account plane difference, links or obstacles at all. map.realDistance(Position position) should take into consideration all the above situations. You could also try walking.webWalk(Position... positions) as that walks to the closest of the given positions since you mentioned you only want to walk. However realdistance seems to be off a lot. I tried using it to find the real closest goblin (like one next to you but behind the fence would actually be further away to run to it) However it mostly doesn't seem to actually pick the closest one, it looked fairly random Quote Link to comment Share on other sites More sharing options...
Token Posted March 9, 2016 Share Posted March 9, 2016 However realdistance seems to be off a lot. I tried using it to find the real closest goblin (like one next to you but behind the fence would actually be further away to run to it) However it mostly doesn't seem to actually pick the closest one, it looked fairly random It seems to be working fine for me but I haven't tested it much. If you don't trust OSBot's realDistance() method you can try implementing A* with collision flags and getting the length of the path and you should get the same result. Quote Link to comment Share on other sites More sharing options...