Jump to content

walker can't walk


Recommended Posts

Posted (edited)

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
Posted (edited)

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

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...