June 19, 20169 yr This has never happened to me so I'm kind of confused why this is happening; basically it walks to an area and interacts with NPC and logs that npc isnt null, goes to bank and then goes back to the area , however this time it logs that the NPC is null.What am I doing wrong? code: NPC npc = getNpcs().closest("NPC"); // onloop if (!area.contains(myPlayer()) { getWalking().webWalk(area); } else { if (npc != null) { log("npc is not null"); npc.interact(); } else { log("npc is null"); } } Edited June 19, 20169 yr by Acerd
June 19, 20169 yr Author try elseif ive tried dat too if u mean: if (!area.contains(myPlayer()) { getWalking().webWalk(area); } else if (npc != null) { log("npc not null"); } Edited June 19, 20169 yr by Acerd
June 20, 20169 yr why not try NPC Goblin = npcs.closest("Goblin"); if (Goblin != null && !(Goblin.isUnderAttack())) //getMap().canReach(Goblin) { if (Goblin.isVisible()) { Goblin.interact(new String[]{"Attack"}); new ConditionalSleep(3000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating() || myPlayer().getInteracting() != null; } }.sleep(); } } else if (!Goblin.isVisible()) { this.camera.toEntity((Entity) Goblin); if (Goblin.exists() && !Goblin.isVisible()) { walking.walk(Goblin); while(myPlayer().isMoving()) { sleep(250); } }
June 20, 20169 yr some unreadable code In the future please use the code tags to format your code when posting/commenting in the scripting help section.
June 20, 20169 yr You can only detect NPC's when they are actualy visible on the minimap. thats about 16 tiles from your player.
Create an account or sign in to comment