- Joined
- Sep 30, 2015
- Messages
- 86
- Thread Author
- #1
More custom web issues. I used Clouds Tutorial.
This is what i'm using to add the vertices:
Here's the Caves enum:
Here's what i'm using to walk:
Here's the path debug:
[DEBUG] WebPath[CoordinateVertex(3020, 3451, 0) -> CoordinateVertex(3020, 3450, 0) -> BasicObjectVertex(3019, 3450, 0) -> BasicObjectVertex(3019, 9850, 0) -> CoordinateVertex(3020, 9850, 0) -> CoordinateVertex(3020, 9848, 0) -> CoordinateVertex(3020, 9846, 0) -> CoordinateVertex(3021, 9846, 0)]
It keeps trying to walk to the same coordinate over and over again, even if the player is on the coordinate. The Ice Dungeon worked fine if I offset the coordinate by -1, but the Ice Mountain refuses to work and just gets stuck and generates the same path over and over from the Ladder on the surface.
@Aidden @Arbiter
This is what i'm using to add the vertices:
Code:
public void addCaveVertices() {
Caves[] caves = Caves.values();
for (Caves cave : caves) {
Coordinate s = cave.getSurfaceObject().getPosition().getPosition();
Coordinate u = cave.getUnderGroundObject().getPosition();
WebVertex sNearestVertex = web.getVertexNearestTo(s);
WebVertex uNearestVertex = web.getVertexNearestTo(u);
if (sNearestVertex != null && uNearestVertex != null) {
if (Distance.between(s, sNearestVertex.getPosition()) < 3 || Distance.between(s, uNearestVertex.getPosition()) < 3) {
sNearestVertex.addBidirectionalEdge(cave.getSurfaceObject());
uNearestVertex.addBidirectionalEdge(cave.getUnderGroundObject());
cave.getSurfaceObject().addBidirectionalEdge(cave.getUnderGroundObject());
web.addVertices(cave.getSurfaceObject(), cave.getUnderGroundObject());
script.debug("[tWeb] [Caves] Added: " + cave.name());
debug(sNearestVertex);
}
}
}
}
Here's the Caves enum:
Code:
package com.twinki.twinkiAPI.rs3.tWeb;
import com.runemate.game.api.hybrid.location.Coordinate;
import com.runemate.game.api.hybrid.location.navigation.web.vertex_types.objects.BasicObjectVertex;
/**
* @author Twinki
*/
public enum Caves {
Asgarnian_Ice_Dungeon(new BasicObjectVertex(new Coordinate(3008, 3150, 0), "Trapdoor", "Climb-down"), new BasicObjectVertex(new Coordinate(3008, 9550, 0), "Ladder", "Climb-up")),
Ice_Mountain_Dwarven_Mine(new BasicObjectVertex(new Coordinate(3019, 3450, 0), "Ladder", " Climb-down"), new BasicObjectVertex(new Coordinate(3019, 9850, 0), "Ladder", "Climb-up"));
private BasicObjectVertex surfaceObject;
private BasicObjectVertex underGroundObject;
Caves(BasicObjectVertex surfaceObject, BasicObjectVertex underGroundObject){
this.surfaceObject = surfaceObject;
this.underGroundObject = underGroundObject;
}
public BasicObjectVertex getSurfaceObject(){
return this.surfaceObject;
}
public BasicObjectVertex getUnderGroundObject(){
return this.underGroundObject;
}
}
Here's what i'm using to walk:
Code:
public boolean walkToArea(Area area) {
WebPath pathFail = null;
if (web != null) {
pathFail = web.getPathBuilder().buildTo(area.getCenter().getArea().getRandomCoordinate());
if (pathFail != null)
pathFail.step();
}
debug(pathFail);
return area.contains(Players.getLocal());
}
Here's the path debug:
[DEBUG] WebPath[CoordinateVertex(3020, 3451, 0) -> CoordinateVertex(3020, 3450, 0) -> BasicObjectVertex(3019, 3450, 0) -> BasicObjectVertex(3019, 9850, 0) -> CoordinateVertex(3020, 9850, 0) -> CoordinateVertex(3020, 9848, 0) -> CoordinateVertex(3020, 9846, 0) -> CoordinateVertex(3021, 9846, 0)]
It keeps trying to walk to the same coordinate over and over again, even if the player is on the coordinate. The Ice Dungeon worked fine if I offset the coordinate by -1, but the Ice Mountain refuses to work and just gets stuck and generates the same path over and over from the Ladder on the surface.
@Aidden @Arbiter