Jump to content

Trying to exclude one fishing spot


Recommended Posts

Posted

I have a fishing script but one spot cant be accessed there is a npc sitting there. I want to be able to remove that one tile or spot so the bot doesn't find it and click on it forever. there are 4 spots in the area i want to use the other 3 only. How would i do this? im retarded when it comes to programming so please bare with me.

Posted (edited)

It'd help if you could tell us where the fishing spot is but you could try using a filter to exclude it with getMap().canReach(). So when you're getting the fishing spots do:

NPC fishingSpot = getNpcs().closest(x -> x.getId() == fishingSpotID && getMap().canReach(x))

Edited by d0zza
Posted (edited)
On 11/08/2017 at 4:26 AM, d0zza said:

It'd help if you could tell us where the fishing spot is but you could try using a filter to exclude it with getMap().canReach(). So when you're getting the fishing spots do:

NPC fishingSpot = getNpcs().closest(x -> x.getId() == fishingSpotID && getMap().canReach(x))

  • Filtering by IDs is bad unless you dynamically retrieve those IDs and store them on each run. Because otherwise, a RuneScape update will change those IDs breaking your script.
  • Running #canReach each is bad practice. If there's only one position you need to filter for, store that position as a constant and check against it. Running path-finding algorithm to exclude one fishing spot would be unnecessarily process intensive. Alternatively, you could write up a small tile-flag checker around the north, east, south, and west tiles of the fishing spot to determine whether it's a tile that can your player can stand on. That wouldn't be as bad and would be more applicable. However, be sure to store the results so you, so you don't keep asking the same questions you already know the answer to.
Edited by liverare

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...