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.

NPC pathfinding algorithm

Featured Replies

Hi all,

I'm going to implement a method in my script to determine the closest position that would act as a safespot from a monster I am attacking. I don't want to simply define a few that would always work as there may be a closer, more optimal spot.

Now before I spend hours attacking monsters from different angles, does anyone know/have the NPC pathfinding algorithm when it is trying to interact with a player? 

Thanks!

You could test out different approaches with two accounts by having one stand still and following it from different positions with the other. Things get way more complicated when both you and the NPC are moving at the same time though.

I'm not sure what you mean by a more optimal spot, a safespot is a safespot at the end of the day. It's better to just predefine the spot which is most consistent and secure. Otherwise you'll constantly be moving around and it will just be less efficient overall. 

Enemy NPCs don't "pathfind" per se. When in combat, they simply translate directly towards the target position. I assume that you only deal with melee enemies

I find that the easiest way to do a reliable check, is to perform a simulation on what would happen if you attacked the enemy from the tested position. For such a simulation, each step would perform following checks:
- Is the currently simulated position equal to the target (in this case the player's) position; if so, this is not a safespot
- Is the player able to attack the currently simulated position? (Requires: Player range distance, region clipping graph & projectile masks); if so, this is a possible safespot
- Is the next position towards the target blocked in both directions? (Requires: Region clipping graph, Checking positions of other NPCs)

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.