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.

getArea of npc?

Featured Replies

I don't know if I'm supposed to use a AreaFilter or a NPC Filter for finding which area a npc is contained.

 

the current filter I'm using for selecting npc's.

NPC warrior = getNpcs().closest(new Filter<NPC>() { //Find an NPC matching our filter!
	            public boolean match(NPC npc) {

	                return npc.exists() && npc.getName().equals("Al-Kharid warrior") && npc.getHealthPercent() > 0 && npc.isAttackable(); 
	            }
	        });

Also if AreaFilters are the goto, someone might need to spoon feed the concept to me.

 

I'm dividing the npc's spawns into 3 areas and want to see if NPC's are in the same area as me.

 

All help is greatly appreciated :)

return npc.exists() && npc.getName().equals("Al-Kharid warrior") && npc.getHealthPercent() > 0 && npc.isAttackable();

 

add in && area.contains(npc) to this boolean statement

 

 

edit: just realized i might have misinterpreted your question. are you looking for an npc contained within a specific area, or the area that contains a specific npc?

Edited by Imateamcape

Not really sure what you're asking

 

 

 

This will check if an area contains an NPC

NPC npc = getNpcs().closest("NPC");

if (npc !=null && Area.contains(npc) {
//dosomething 
}

Edited by Juggles

I don't know if I'm supposed to use a AreaFilter or a NPC Filter for finding which area a npc is contained.

 

the current filter I'm using for selecting npc's.

NPC warrior = getNpcs().closest(new Filter<NPC>() { //Find an NPC matching our filter!
	            public boolean match(NPC npc) {

	                return npc.exists() && npc.getName().equals("Al-Kharid warrior") && npc.getHealthPercent() > 0 && npc.isAttackable(); 
	            }
	        });

Also if AreaFilters are the goto, someone might need to spoon feed the concept to me.

 

I'm dividing the npc's spawns into 3 areas and want to see if NPC's are in the same area as me.

 

All help is greatly appreciated smile.png

 

 

You can use an AreaFilter:

NPC warrior = getNpcs().closest(new NameFilter<>("Al-Kharid warrior"), new AreaFilter<>(area), Character::isAttackable);

Edited by Explv

  • Author
return npc.exists() && npc.getName().equals("Al-Kharid warrior") && npc.getHealthPercent() > 0 && npc.isAttackable() && EastPalaceRm.contains(npc) && EastPalaceRm.contains(myPlayer());

I have 3 areas I wan't to be able to count players, npcs, and WebWalk to new area's when one is too full.

 

I'm wondering if I can filter my 3 area's into a single statement?  if not I could copy pasta a bunch and have npc1 npc2 npc3?

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.