Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved Web Walking with custom web won't use lodestones.

Joined
Nov 26, 2014
Messages
616
My custom web walks to every destination, and never uses lodestones. It will walk from Yanille to Varrock instead of using a lodestone.

Code for adding vertices:
Code:
public static void addLodestoneVertices() {
    for (Lodestone lodestone: Lodestone.values()) {
        LodestoneVertex vertex = new LodestoneVertex(lodestone);
        Coordinate c = lodestone.getPosition().derive(0, -1);
        WebVertex v = web.getVertexNearestTo(c);
        if (v != null) {
            double dist = Distance.between(c, v.getPosition());
            if (dist < 3) {
                vertex.addDirectedEdge(v, 25);
                web.addVertices(vertex);
                System.out.println("Added: " + lodestone);
                System.out.println(v.distanceTo(vertex));
            }
        }
    }
}

System out:
Code:
(08:28:17) Added: Al Kharid
1.0
(08:28:17) Added: Ardougne
1.0
(08:28:17) Added: Burthorpe
1.0
(08:28:17) Added: Catherby
1.0
(08:28:17) Added: Draynor Village
1.0
(08:28:17) Added: Edgeville
1.0
(08:28:17) Added: Falador
1.0
(08:28:17) Added: Lumbridge
1.0
(08:28:17) Added: Port Sarim
1.0
(08:28:17) Added: Seers Village
1.0
(08:28:17) Added: Taverley
1.0
(08:28:17) Added: Varrock
1.0
(08:28:17) Added: Yanille
1.0
(08:28:17) Added: Fremennik Province
1.0
(08:28:17) Added: Ooglog
1.0

Walk code:
Code:
public static boolean webWalk(Locatable destination) {
    if (destination != null) {
        WebVertex player = web.getVertexNearestTo(Players.getLocal());
        WebVertex vertex = web.getVertexNearestTo(destination);
        Path path = web.getPathBuilder().useTeleports(true).build(player, vertex);
        return path != null && path.step();
    }
    return false;
}

@Cloud
 
Top