Nic2555 Posted August 12, 2015 Share Posted August 12, 2015 (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 August 12, 2015 by Nic2555 Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 12, 2015 Share Posted August 12, 2015 (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 August 12, 2015 by Apaec Quote Link to comment Share on other sites More sharing options...
Alek Posted August 12, 2015 Share Posted August 12, 2015 You could try area.getRandomPosition() Quote Link to comment Share on other sites More sharing options...