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
  • Walking through obstacles


    Moorky

    Recommended Posts

    Hey guys!

    I've been running into a problem creating my new script.

    To get to the area I want the player to go, it has to go through multiple portals, doors, ladders etc.

    What would be the best way to handle this?

    First I tried to handle all the obstacles with prioritising but this doesn't work smoothly.

    Now I'm thinking about creating multiple areas and check in which the player currently is so it knows what to do next. (which will be a lot of code)

    Maybe you guys have any idea on how to handle this better?

    Greetings, Moorky

    Link to comment
    Share on other sites

    You can add obstacles by doing something like this:

    getWalking().getAStarPathFinder().addObstacle(new PassableObstacle("Obstacle name", "Action", null, null, null));

    Put it in your onStart

    Link to comment
    Share on other sites

    2 hours ago, Pengu said:

    You can add obstacles by doing something like this:

    
    getWalking().getAStarPathFinder().addObstacle(new PassableObstacle("Obstacle name", "Action", null, null, null));

    Put it in your onStart

    Nicely said. +1

    Link to comment
    Share on other sites

    15 hours ago, Koschei said:

    Xephy always uses WebFinder :troll:

    It's such a troll. You know how much I rage when I waste hours wondering why it's not working

    Link to comment
    Share on other sites

    Based on the replies here, using an object such as Obstacle(String name, String action, Tile location (or int x, int y), int animationId) is a good way of presenting it that way. Also storing the animation ID would be nice, so you can check when you are done with that obstacle. And you can check for when it's complete such as:

     

    protected boolean isComplete() {
         return (getCurrentAnimationId() != this.animationId);
    }

     

    Of course you would have a delay and so on, and the above is psuedo-code. But you get the point.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.