March 15, 20169 yr Is a fishing spot considered an NPC? Also how would I get the closest fishing spot that isn't on tile (x,y,z)?
March 15, 20169 yr Author 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
March 15, 20169 yr 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));
March 15, 20169 yr Author //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)
March 15, 20169 yr 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") ???
March 15, 20169 yr Author 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, 20169 yr by Huz
March 15, 20169 yr NPC spot = getNpcs().closest("Fishing spot"); Position pos = new Position(x,y,z); if(!spot.getPosition().equals(pos)){ //do stuff } Edited March 15, 20169 yr by Vilius
March 15, 20169 yr Author 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?
March 15, 20169 yr 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");
Create an account or sign in to comment