Huz Posted March 15, 2016 Share Posted March 15, 2016 Is a fishing spot considered an NPC? Also how would I get the closest fishing spot that isn't on tile (x,y,z)? Quote Link to comment Share on other sites More sharing options...
Deceiver Posted March 15, 2016 Share Posted March 15, 2016 it is a npc getnpcs().getclosest(fishspot) Quote Link to comment Share on other sites More sharing options...
Huz Posted March 15, 2016 Author Share Posted March 15, 2016 it is a npc getnpcs().getclosest(fishspot) how can I filter out Position (x,y,z) with this? I'm so noob someone save me Quote Link to comment Share on other sites More sharing options...
Chris Posted March 15, 2016 Share Posted March 15, 2016 how can I filter out Position (x,y,z) with this? I'm so noob someone save me //try NPC fish = getNpcs().closest(o -> o.getName().equals("Fishing spot") && o.getPosition().equals(Position position)); Quote Link to comment Share on other sites More sharing options...
Huz Posted March 15, 2016 Author Share Posted March 15, 2016 //try NPC fish = getNpcs().closest(o -> o.getName().equals("Fishing spot") && o.getPosition().equals(Position position)); srry I meant to say how do I get the closest "Fishing spot" which position is not (x,y,z) Quote Link to comment Share on other sites More sharing options...
Deceiver Posted March 15, 2016 Share Posted March 15, 2016 srry I meant to say how do I get the closest "Fishing spot" which position is not (x,y,z) NPC fish = getNpcs().closest(o -> o.getName().equals("Fishing spot") ??? Quote Link to comment Share on other sites More sharing options...
Huz Posted March 15, 2016 Author Share Posted March 15, 2016 (edited) NPC fish = getNpcs().closest(o -> o.getName().equals("Fishing spot") ??? There is a tile in lumbridge by the fishing tutor where the fishing spot moves to sometimes. It is not possible to fish there because the tutor is in the way of it. I'm trying to .closest("Fishing spot") != Position(x,y,x) but there are errors because of different types. Still trying to figure out how to say it in correct code. Edited March 15, 2016 by Huz Quote Link to comment Share on other sites More sharing options...
Vilius Posted March 15, 2016 Share Posted March 15, 2016 (edited) NPC spot = getNpcs().closest("Fishing spot"); Position pos = new Position(x,y,z); if(!spot.getPosition().equals(pos)){ //do stuff } Edited March 15, 2016 by Vilius 1 Quote Link to comment Share on other sites More sharing options...
Huz Posted March 15, 2016 Author Share Posted March 15, 2016 NPC spot = getNpcs().closest("Fishing spot"); Position pos = new Position(x,y,z); if(!spot.getPosition().equals(pos)){ //do stuff } This works thanks! However, now if the closest spot is the one which position we checked against, it stands still. Any idea on how to make it "ignore" pos as a possible spot when assigning spot=npcs.closest? Quote Link to comment Share on other sites More sharing options...
Vilius Posted March 15, 2016 Share Posted March 15, 2016 This works thanks! However, now if the closest spot is the one which position we checked against, it stands still. Any idea on how to make it "ignore" pos as a possible spot when assigning spot=npcs.closest? Just do this //position object Position pos = new Position(x,y,z); //Will check if name is right and will check if the position isnt the ignored one NPC fish = getNpcs().closest(o -> o.getName().equals("Fishing spot") && !o.getPosition().equals(pos)); //Interact with fish fish.interact("action"); 1 Quote Link to comment Share on other sites More sharing options...