Jump to content

Path Walking


Recommended Posts

Posted (edited)

I'm writing a woodchopping script that banks, and I need to get my character from the woodchopping area (position 1) to the bank (position 2). How would I go about having my character walk between the two points; what command would let me input an end position and have my character walk there?

 

http://osbot.org/forum/topic/100862-bank-closest-to-entity/

 

^ This is a very useful snippet from @LoudPacks that allows you to get the bank closest to your player. I just input the enum privately inside of a class called 'Banker' and made the methods of the enum into methods of the class.

 

Seems like you're new, so here's a great resource that @Explv made that has been incredibly useful to me since I found it. http://explv.github.io/ <-- Gets you the positions for Areas, Positions, etc. Very useful.

private Area myBank;
private Position initialPos; //have them start the script in the right location. 
//Or you could just input an Area if your script is already centered in a specific location
private final Area wcArea = new Area(8, 9, 10, 11);

@[member='OverRideCwalk']
public void onStart() {
    myBank = new Banker().closestTo(myPlayer());
    initialPos = myPlayer().getPosition();
}


@[member='OverRideCwalk']
public void onLoop() throws InterruptedException {
    getWalking().walk(myBank.getRandomPosition(); //walk to closest bank
    //~~~~~~~~~ banking code to implement ~~~~~~~~~~
    getWalking().walk(initialPos); 
    //or if you want to walk back to an area:
    getWalking().walk(wCArea.getRandomPosition());
}
Edited by Imateamcape
Posted (edited)
//Make 2 areas


private final Area WoodCut = new Area(0,1,2,3);

private final Area Bank = new Area(4,5,6,7);


if (getInventory.isFull) {
   if (!Bank.contains(myPlayer) {

       getWalking.webWalk(Bank); 
    } else {

        //BankCode
}



if (!getInventory.isFull) {
if (!WoodCut.contains(myPlayer) {

getWalking.webWalk(Woodcut);
} else {

//Chop
}

 

Edited by lg_juggles

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