Jump to content

Path Walking


Popymon24

Recommended Posts

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
Link to comment
Share on other sites

//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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...