Jump to content

Fishing spot


Huz

Recommended Posts

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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