Jump to content

path walking


Pug

Recommended Posts

Why is this so commonly asked for?

 

It's really simple:

public void walkPath(Position[] path) throws InterruptedException {
    for (Position p : path) {
        if (myPosition().distance(p) > 16 || myPosition().distance(p) < 3) continue;
        boolean success;
        do {
            success = walkTile(p);
        } while (!success);
    }
}

public boolean walkTile(Position p) throws InterruptedException {
    if (myPosition().distance(p) > 13) {
        Position pos = new Position(((p.getX() + myPosition().getX()) / 2) + random(-3, 3),
                ((p.getY() + myPosition().getY()) / 2) + random(-3, 3),
                myPosition().getZ());
        walkTile(pos);
    }
    mouse.click(new MiniMapTileDestination(bot, p), false);
    int fail = 0;
    while (myPosition().distance(p) > 2 && fail < 10) {
        sleep(500);
        if (!myPlayer().isMoving())
            fail++;
    }
    return fail != 10;
}
Edited by Pandemic
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...