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.

How to detect how you are being attacked.

Featured Replies

I was wondering if there is a way to find out how i am being attacked.

For example, when being attacked by say a dragon, i want to be ranging it and praying mage.

How can i see whether my player is fighting it in melee range or ranging range, i looked at the API on Combat and couldn't see anything.

Currently, my only thought was to make a big array of 'safe' tiles and just force the bot to move to one of them.

However, if the player didn't need to move and it moved anyway, i feel that would look bot-like.

Anyway your feedback is appreciated.

as long as one is hitting you back the other dragon near you cant attack you. just make sure youre out of its melee range. once you kill it move away from the other dragon and attack it

  • Author
12 minutes ago, FrostBug said:

But the one next to you is not attacking you?
Then it's fine innit

ah makes sense cheers

34 minutes ago, scriptersteve said:

How can i see whether my player is fighting it in melee range or ranging range

u can get combat styles by configs, or just get the current weapon == blowpipe/crossbow, attackstyle = ranged

 

 

2 minutes ago, Deceiver said:

u can get combat styles by configs, or just get the current weapon == blowpipe/crossbow, attackstyle = ranged

He's always using a ranged weapon though. What he asked is what the dragon is using :boge:

Edited by FrostBug

final Player me = myPlayer();
		
		// Get all green dragons that are 'locked' on me
		List<NPC> greenDragonsFocusingOnMe = npcs.getAll().stream()
				.filter(npc -> me.equals(npc.getInteracting()))
				.filter(npc -> npc.getName().equals("Green dragon"))
				.collect(Collectors.toList());
		
		// Get the green dragon I'm locked on
		NPC greenDragonsImFocusedOn = greenDragonsFocusingOnMe.stream()
				.filter(npc -> npc.equals(me.getInteracting()))
				.findFirst()
				.orElse(null);
		
		if (greenDragonsFocusingOnMe != null && !greenDragonsFocusingOnMe.isEmpty()) {
			if (greenDragonsImFocusedOn != null) {
				// wait for dragon to die
				// heal if low on health
			} else {
				// pick one of those dragons that are focused on you
				greenDragonsImFocusedOn = greenDragonsFocusingOnMe.get(0);
				if (greenDragonsImFocusedOn.interact("Attack")) {
					// ... do stuff
				}
			}
		}

One thing I haven't included is the sorting of the green dragons by distance to you. I won't spoon feed you everything. :)

6 minutes ago, liverare said:

One thing I haven't included is the sorting of the green dragons by distance to you. I won't spoon feed you everything. :)

 

List<NPC> greenDragonsFocusingOnMe = npcs.getAll().stream()
                .filter(npc -> myPlayer().equals(npc.getInteracting()))
                .filter(npc -> npc.getName().equals("Green dragon"))
                .sorted(Comparator.comparingInt(npc -> getMap().realDistance(npc)))
                .collect(Collectors.toList());

:doge:

  • Author

lol thanks guys :D, this is going to be next weekends project after my uni deadline on Friday :)

I do like how you always use the fancy methods, mine are about 5x longer but atleast they do also work :')

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.