iJodix Posted May 5, 2016 Posted May 5, 2016 (edited) So if i have current loaded region tiles loaded into a list, how am i supposed to generate a straight path(ignoring objects) to npc using those tiles ? Someone told me to use A* algorithm but i have no ideas where to start, welps ? Edited May 5, 2016 by iJodix
Diclonius Posted May 5, 2016 Posted May 5, 2016 Is generating the path yourself necessary? Couldn't you just the OSBot's walking/webwalking i.e. walking.webWalk(position) or walking.walk(position)
iJodix Posted May 5, 2016 Author Posted May 5, 2016 Is generating the path yourself necessary? Couldn't you just the OSBot's walking/webwalking i.e. walking.webWalk(position) or walking.walk(position) I would've not posted if it wasn't necessary.
FrostBug Posted May 5, 2016 Posted May 5, 2016 (edited) if you're ignoring obstacles, you could just do something like this Position source = myPosition(); Position dest = new Position(x, y, z); List<Position> path = new ArrayList<>(); Position tmp = source; while (!tmp.equals(dest)) { int xOff = Integer.compare(dest.getX(), tmp.getX()); int yOff = Integer.compare(dest.getY(), tmp.getY()); tmp = tmp.translate(xOff, yOff); path.add(tmp); } Written in hand, so watch for errors. Not sure why you want to use a region in the form of a list of positions Edited May 5, 2016 by FrostBug