Tutorial [Series] Expanding The Navigation Web - Basic Item Teleports

Discussion in 'Tutorials & Resources' started by Cloud, Oct 2, 2014.

  1. This tutorial is slightly outdated. You may not longer expand the default web, however you may build local webs from scratch. If building a web from scratch, the following concepts are still valid.

    Cache the default web
    Code (Java):
    1. final Web web = Traversal.getDefaultWeb();
    Declare the destination of the teleport
    Code (Java):
    1. final Coordinate teleportDestination = new Coordinate(3162, 3462, 0);
    Find the best vertex currently in the web to connect to the destination (for simplicity let's use the nearest)
    Code (Java):
    1. final WebVertex nearest = web.getVertexNearestTo(teleportDestination);
    Declare the new teleport vertex with the items information
    Code (Java):
    1. final BasicItemTeleportVertex tele = new BasicItemTeleportVertex(teleportDestination, SpriteItem.Origin.INVENTORY, "Varrock teleport", "Break");
    Tell the web that the teleport destination has a clear path to the vertex called nearest so that it can generate a full path.
    We'll mark it directed so it doesn't try to generate a path to the destination vertex. It should only be one way.
    Code (Java):
    1. tele.addDirectedEdge(nearest);
    Add the teleport to the web
    Code (Java):
    1. Traversal.getDefaultWeb().addVertices(tele);
    And congrats, you're done :D

    Some advice:
    • Try not to just use the vertex nearest to the teleport destination, check the existing web and find a good vertex to connect to.
    • If you start doing this in bulk I recommend creating a system to more easily manage it
    • Post any of your significant web additions onto the forums so others can use them (and so they could potentially get included in the default web!)
    #1 Cloud, Oct 2, 2014
    Last edited: Jul 27, 2015
  2. What would be the process for adding an object teleport to the web? I tried to substitute in a BasicObjectVertex for a BasicItemTeleportVertex, it is detected as being connected but it won't interact with the object.
  3. You would override ObjectVertex, add a custom step() method, and link it to a PseudoVertex. You only need to override step() if it requires custom interaction beyond selecting a menu action.
    Furor likes this.
  4. I have absolutely no idea how to do any of that, I guess I'll just stick to the way I was doing it before I learned objects could be connected to a web.
  5. A PsuedoVertex is just a different type of vertex (similar to a CoordinateVertex) that is ignored during graph navigation but is used for special cases like certain "jumps". You can override ObjectVertex (or just use a BasicObjectVertex if applicable) the same way you would override any other class. The step() method that you would implement would just be your standard object interaction.

Share This Page