November 21, 20169 yr 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
November 21, 20169 yr 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, 20169 yr by Imateamcape
November 21, 20169 yr 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, 20169 yr by Juggles
November 21, 20169 yr 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, 20169 yr by Explv
November 21, 20169 yr 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