Divine Posted July 11, 2013 Share Posted July 11, 2013 (edited) public boolean WalkAlongPath(int[][] path, boolean AscendThroughPath, int distanceFromEnd) { if (distanceToPoint(AscendThroughPath ? path[path.length - 1][0] : path[0][0], AscendThroughPath ? path[path.length - 1][1] : path[0][1]) <= distanceFromEnd) return true; else { WalkAlongPath(path, AscendThroughPath); return false; } } public void WalkAlongPath(int[][] path, boolean AscendThroughPath) { int destination = 0; for (int i = 0; i < path.length; i++) if (distanceToPoint(path[i][0], path[i][1]) < distanceToPoint(path[destination][0], path[destination][1])) destination = i; if (script.client.getMyPlayer().isMoving() && distanceToPoint(path[destination][0], path[destination][1]) > (script.isRunning() ? 3 : 2)) return; if (AscendThroughPath && destination != path.length - 1 || !AscendThroughPath && destination != 0) destination += (AscendThroughPath ? 1 : -1); try { log("Walking to node:" + destination); script.walk(new Position(path[destination][0], path[destination][1], 0)); Thread.sleep(700 + MethodProvider.random(600)); } catch (InterruptedException e) { e.printStackTrace(); } } private int distanceToPoint(int pointX, int pointY) { return (int) Math.sqrt(Math.pow(script.client.getMyPlayer().getX() - pointX, 2) + Math.pow(script.client.getMyPlayer().getY() - pointY, 2)); } This allows you to have your character walk along a path, starting at any point along the path. It will walk like a human, not like a bot. This is how you'd use it: private int[][] path1 = new int[][] { { 3206, 3209 }, { 3215, 3211 }, { 3217, 3218 }, { 3225, 3218 }, { 3235, 3220 }, { 3242, 3226 }, { 3252, 3226 }, { 3251, 3235 }, }; public void walkToGoblins() { WalkAlongPath(path1, true); } public void walkToBankFromGoblins() { WalkAlongPath(path1, false); } public void walkToGoblinsThenAttack() { if(WalkAlongPath(path1, true, 1)) //The 1 is the distance away from destination state = State.AttackGoblins; } Enjoy. Edited July 11, 2013 by Divine 9 Link to comment Share on other sites More sharing options...
Skype Posted July 11, 2013 Share Posted July 11, 2013 Well done, thanks! Link to comment Share on other sites More sharing options...
Rick Posted July 11, 2013 Share Posted July 11, 2013 i read somewhere people that wanna become a scripter need to do something ''out of the box'' kati. we have a new scripter Link to comment Share on other sites More sharing options...
Led Zeppelin Posted July 11, 2013 Share Posted July 11, 2013 (edited) Finally. Now osbot can have scripts with a little more complexity. Thanks. Edited July 11, 2013 by LedZeppelin Link to comment Share on other sites More sharing options...
Rick Posted July 11, 2013 Share Posted July 11, 2013 i got my first feedback Link to comment Share on other sites More sharing options...
ProjectPact Posted July 11, 2013 Share Posted July 11, 2013 Looks pretty good! Might throw it in a script and see how it is! :p Link to comment Share on other sites More sharing options...
NxJr Posted July 11, 2013 Share Posted July 11, 2013 Why Do I get errors on the distanceToPoint? Link to comment Share on other sites More sharing options...
Divine Posted July 11, 2013 Author Share Posted July 11, 2013 Why Do I get errors on the distanceToPoint? My mistake, forgot to include it in the code! Link to comment Share on other sites More sharing options...
oTroll Posted July 11, 2013 Share Posted July 11, 2013 Nice, would this work on different planes? Link to comment Share on other sites More sharing options...
NxJr Posted July 11, 2013 Share Posted July 11, 2013 (edited) for some reason its trying to run many nodes at once Edited July 11, 2013 by nxjr Link to comment Share on other sites More sharing options...
H0ppy Posted July 12, 2013 Share Posted July 12, 2013 (edited) Looks pretty decent! Will test this in 1 of my scripts! Thanks!! grtzH0ppy Edited July 12, 2013 by H0ppy Link to comment Share on other sites More sharing options...
TheAnswer Posted July 13, 2013 Share Posted July 13, 2013 great thanks man Link to comment Share on other sites More sharing options...
Joseph Posted July 13, 2013 Share Posted July 13, 2013 how do i use this in my script? Link to comment Share on other sites More sharing options...
03storic Posted July 14, 2013 Share Posted July 14, 2013 (edited) 5th edit: Is there a debug to draw the path onscreen? Edited July 14, 2013 by 03storic Link to comment Share on other sites More sharing options...
riet Posted July 15, 2013 Share Posted July 15, 2013 Doesn't work for me Link to comment Share on other sites More sharing options...