Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cant reach enemy

Featured Replies

Hi All,

So im working on a combat script, the script is finding the intended enemy no problem however...

 

image.png.6a6949c4187c9722d5c392cb097def95.png

 

In this case the enemy is unreachable due to the closed gate (red arrow). My bot will stand here clicking "attack" over and over. Any suggestions?

 

getMap().canReach(Entity entity);


NPC chik = getNpcs().closest("Chikun");
if chik != null && getmap.canreach(chik)
	chik.interact("Attack");

 

As the others have said, canReach is how you'd detect if you can reach the given Entity/Position. Using this to find the closest reachable goblin would look like:

getNpcs().closest(n -> "Goblin".equals(n.getName()) && getMap().canReach(n));

  • Author
9 minutes ago, Chris said:

getMap().canReach(Entity entity);


NPC chik = getNpcs().closest("Chikun");
if chik != null && getmap.canreach(chik)
	chik.interact("Attack");

 

I thought it may be as simple as this! was looking for a method on the NPC object rather than the map.

 

THANKS!

4 hours ago, Lemons said:

As the others have said, canReach is how you'd detect if you can reach the given Entity/Position. Using this to find the closest reachable goblin would look like:

 


getNpcs().closest(n -> "Goblin".equals(n.getName()) && getMap().canReach(n));

 

This is the one your going to want to use, 

because if the “closest” npcs doesn’t match your if(statement requirements) it will sit there and do nothing , even when there ARE other npcs you CAN attack.

alternitively , you can bandaid it by saying

if(!getMap().canReach(yourNpc)){walking.webWalk(npc.getArea(0)}

(webwalking should automatically handle doors/gates/ladders/etc.)

or if you know what it is that’s blocking your way (gate?)

If(objects.getObjects.hasAction(“Open”){interact(open)}

or you can do something like 

if(message.contains(you can’t reach that){blahblah}

Edited by sonda

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.