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.

Sign in to follow this  
Followers 0
Tsuyoshi

Running away

7 posts in this topic

How would I make the player run away until it's not being attacked? Right now I'm using traverse(20), so it walks 20 tiles away, then checks if it's in combat. Obviously this isn't very efficient, and it also tries to go through doors which it can't like the champions guild. I tried to use DPathNavigator with stopping conditions but it wouldn't work for me. Any help is appreciated. Thanks!

Share this post


Link to post
Share on other sites

DPathNavigator won't work for your script or won't work but it should?
 

Share this post


Link to post
Share on other sites
Just now, Beg said:

DPathNavigator won't work for your script or won't work but it should?
 

Oh it should, I'm just too stupid to get it working :D

Share this post


Link to post
Share on other sites
7 minutes ago, Tsuyoshi said:

Oh it should, I'm just too stupid to get it working :D

What have you tried? You need to create a DPathNavigator object and then use it.
 

Share this post


Link to post
Share on other sites
5 minutes ago, Beg said:

What have you tried? You need to create a DPathNavigator object and then use it.
 

Yeah I did, but I'm still learning Java so I'm not great at it lol, I don't really understand how to use the get/setstoppingcondition.

Share this post


Link to post
Share on other sites

private static final int TILE_DIST = 10;
private final DPathNavigator nav = new DPathNavigator();

or if you use a constructor

private static final int TILE_DIST = 10;
private final DPathNavigator nav;
public "ClassConstructor"(...) {
    ...
    nav = new DPathNavigator();
    ...
}

To set a condition simply do:
nav.setStoppingCondition(new Condition() {
    [email protected]
      public boolean active() {
           return !Combat.isInCombat();
      }
}

To set how often it is checked (eg 100ms):
nav.setStoppingConditionCheckDelay(100);

Now all you need to do is traverse the length you want (eg 10 tiles):
nav.traverse(TILE_DIST); 

 

 

Edited by Beg

Share this post


Link to post
Share on other sites

Simply just specify a tile you know is safe and travel to it until the player isn't under attack.

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.