Cmontryme Posted November 21, 2016 Posted November 21, 2016 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
Team Cape Posted November 21, 2016 Posted November 21, 2016 (edited) 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 November 21, 2016 by Imateamcape
Juggles Posted November 21, 2016 Posted November 21, 2016 (edited) 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 November 21, 2016 by Juggles 2
Explv Posted November 21, 2016 Posted November 21, 2016 (edited) 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 You can use an AreaFilter: NPC warrior = getNpcs().closest(new NameFilter<>("Al-Kharid warrior"), new AreaFilter<>(area), Character::isAttackable); Edited November 21, 2016 by Explv
Cmontryme Posted November 21, 2016 Author Posted November 21, 2016 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?