Jump to content

walker can't walk


Nic2555

Recommended Posts

Hi, i've been facing this problem lately. i'm trying to make my player walk to a certain area, wich is called YEW_AREA, but it shows me a null pointer exception.

when i'm using the same code to walk to the BANK_AREA, it works great. 

here's the code :

@Override
	public int onLoop() throws InterruptedException 
	{
		if(!getInventory().isFull())
		{
			if(YEW_AREA.contains(myPlayer()))
			{
				antiBan();
				Entity yew = getObjects().closest("Yew");
				if(yew != null)
				{
					if(yew.isVisible())
					{
						if(!myPlayer().isAnimating() && !myPlayer().isMoving())
						{
							
							yew.interact("Chop Down");
							sleep(random(700, 800));
						}
					} else {
						getCamera().toEntity(yew);
					}
				} else {
					if(random(1, 100) == 1)
					{
						if(!myPlayer().isAnimating() && !myPlayer().isMoving())
						{
							this.getTabs().open(Tab.EMOTES);
							doEmote(random(1, 21));
							this.getTabs().open(Tab.INVENTORY);
						}
					}
				}
			} else {
				this.getLocalWalker().walk(YEW_AREA, true);
			}
		} else {
			if(BANK_AREA.contains(myPlayer()))
			{
				Entity banker = getObjects().closest("Bank booth");
				if(bank.isOpen())
				{
					bank.depositAll();
				} else {
					if(banker != null)
					{
						if(banker.isVisible())
						{
							banker.interact("Bank");
							bank.depositAll();
						} else {
							getCamera().toEntity(banker);
						}
					} 
				}
			} else {
				this.getLocalWalker().walk(BANK_AREA, true);
				
			}
		}
		return 150;
	} 

the problem is on the line 102, where the walker have to walk to the YEW_AREA. 

Thanks!

 

- Nic 

Edited by Nic2555
Link to comment
Share on other sites

perhaps the distance is too far.

 

 

Instead of relying on localwalker.walk to walk that distance, perhaps record a static path between the bank and the yew area, and walk the path using 


Position[] path = new Positoin{}[ new Position(0,0,0), new Position(0,0,0) ]; //etc. (Use the pathrecording tool available on the sdn written by josedpays)
 

localWalker.walkPath(Position[] p); 

apa

Edited by Apaec
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...