Jump to content

Fishing spot


Recommended Posts

Posted (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. huh.png

Edited by Huz
Posted
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?

Posted

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");
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...