Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

m1zfortune

How to calculate path distance for ABCUtil walking preferences

4 posts in this topic

How are you guys calculating path distance for the ABCUtil#generateWalkingPreference(int length)

Currently I'm using Math.hypot(Player_Tile, Destination_Tile)

 

Is this sufficient or are you guys calculating path distance a different way?

Share this post


Link to post
Share on other sites
27 minutes ago, m1zfortune said:

How are you guys calculating path distance for the ABCUtil#generateWalkingPreference(int length)

Currently I'm using Math.hypot(Player_Tile, Destination_Tile)

 

Is this sufficient or are you guys calculating path distance a different way?

If you want the actual pathing distance (not the straight line distance which has been posted above) you'll need to do something like this:

DPathNavigator navigator = new DPathNavigator;
RSTile destination = new RSTile(5555, 5555, 0);
RSTile[] path = navigator.findPath(destination);
int pathingDistance = path.length;

pathingDistance will be the amount of tiles your character needs to walk through in order to arrive at the destination. findPath() shouldn't be called many times in a row otherwise it'll generate some lag.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.