krypt1c 3 Share Posted January 30, 2021 public void bonesObject() { GameObject bones = GameObjects.closest(gameObject -> gameObject != null && gameObject.getName().equals("Bones")); if(chickenLocation.contains(getLocalPlayer())) { if(bones.interact("Take")) { sleepUntil(() -> Inventory.contains("Bones"), 2000); if(Inventory.contains("Bones")) { Inventory.interact("Bones", "Bury"); sleepUntil(() -> !Inventory.contains("Bones"), 5000); } } } else if(!chickenLocation.contains(getLocalPlayer())) { if(new Walking().walk(chickenLocation.getCenter())) { sleep(Calculations.random(1000, 3000)); } } } Either I'm an idiot, or I don't understand something. The method above should interact with the closest bones by picking them up and burying them if they are in the player's inventory. I honestly have no idea why its giving me an error in dreambot's console. If anyone could help me out, I would really appreciate it thanks! Link to comment Share on other sites More sharing options...
TheCloakdOne 389 Share Posted January 31, 2021 if there are no bones in the area bones will == null, you cant interact on null so it throws NPE Link to comment Share on other sites More sharing options...
krypt1c 3 Author Share Posted January 31, 2021 7 hours ago, TheCloakdOne said: if there are no bones in the area bones will == null, you cant interact on null so it throws NPE But it throws an error even though that there are bones in the area Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.