Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Check for an obstacle with Pathfinder?


    falador1
     Share

    Recommended Posts

    I was wondering if there was a quick way to find if a path has an obstacle between start and destination.

    For example

    Tile start = getLocalPlayer().getTile() // Start
    
    Tile end = new Tile( 10, 10) //Destination
    
    Walking.getAStarPathFinder().hasObstacle(start, end) //Returns true if there is an uncompleted obstacle between start and end

    Is there anything like that?

    Edited by falador1
    Link to comment
    Share on other sites

    Not sure if this is what you mean but the Walking class has a method canWalk that returns a boolean value.

     

    Quote
    Tile end = new Tile( 10, 10, 0); //Destination
    
    Walking.canWalk(end);

     

    This will return either true or false.

    Link to comment
    Share on other sites

    • 2 weeks later...

    I am also wondering what OP is.

    1. Walking.canWalk(destinationTile) returns false for me, after constructing the Tile with X,Y coords, somehow returned "false if not local or unable to find a path to tile" even though it had a clear path to nearby tile.

    2. destinationTile.getFlags() returns integers for various obstacles of a destination tile, but they're not the same as TileFlags Enum https://dreambot.org/javadocs/constant-values.html#org.dreambot.api.methods.walking.pathfinding.data.TileFlags.NULL

    3. TileMap and CollisionMap can somehow be constructed from a Reference (??) of Objects, Entities, but not TileReferences (???) and those maps give you a method isWalkable:

    boolean isWalkable(int x1,
                       int y1,
                       int x2,
                       int y2)
    Check if the given location is walkable, i.values. no blocked movement.
    Parameters:
    x1 - The x coordinate of the start tile to check
    y1 - The y coordinate of the start tile to check
    x2 - The x coordinate of the destination tile to check
    y2 - The y coordinate of the destination tile to check
    Returns:
    true, if the destination is walkable.
     
    So if anyone could halp plz
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.