Class NPCQuery


  • public class NPCQuery
    extends Query<KSNPC,​NPCQuery>
    A specialized query class for filtering and retrieving NPC entities in the game. Extends the generic Query class and integrates contextual game utilities for filtering by position, state, interactions, distance, and more.
    • Constructor Detail

      • NPCQuery

        public NPCQuery​(java.util.Collection<KSNPC> npcs)
        Constructs a new NPCQuery instance from a collection of KSNPC objects.
        Parameters:
        npcs - the collection of NPCs to query.
    • Method Detail

      • atLocation

        public NPCQuery atLocation​(net.runelite.api.coords.WorldPoint wp)
        Filters NPCs that are located at a specific world point.
      • withIndex

        public NPCQuery withIndex​(int index)
        Filters NPCs by their index value.
      • interactingWithLocal

        public NPCQuery interactingWithLocal()
        Filters NPCs that are interacting with the local player.
      • interactingWith

        public NPCQuery interactingWith​(net.runelite.api.Actor actor)
        Filters NPCs that are interacting with a specific actor (player or NPC).
      • interacting

        public NPCQuery interacting()
        Filters NPCs that are currently interacting with any actor.
      • notInteracting

        public NPCQuery notInteracting()
        Filters NPCs that are not interacting with any actor.
      • noOneInteractingWith

        public NPCQuery noOneInteractingWith()
        Filters NPCs that no players are currently interacting with.
      • hasHintArrow

        public NPCQuery hasHintArrow()
        Filters NPCs that currently have a hint arrow pointing to them.
      • meleeable

        public NPCQuery meleeable()
        Filters NPCs that are melee-reachable from adjacent tiles to the player.
      • alive

        public NPCQuery alive()
        Filters only alive (not dead) NPCs.
      • withLoS

        public NPCQuery withLoS()
        Filters NPCs that have line of sight to or from the player.
      • withinLevel

        public NPCQuery withinLevel​(int low,
                                    int high)
        Filters NPCs whose combat level is within the specified inclusive range.
      • withinDistance

        public NPCQuery withinDistance​(int distance)
        Filters NPCs that are within a certain tile distance of the local player.
      • aboveDistance

        public NPCQuery aboveDistance​(int distance)
        Filters NPCs that are farther than a certain distance from the player.
      • withoutGraphic

        public NPCQuery withoutGraphic​(int graphic)
        Filters out NPCs that are currently displaying a specific graphic.
      • withGraphic

        public NPCQuery withGraphic​(int graphic)
        Filters NPCs that are currently displaying a specific graphic.
      • withAnimation

        public NPCQuery withAnimation​(int id)
        Filters NPCs currently playing a specific animation.
      • withoutAnimation

        public NPCQuery withoutAnimation​(int id)
        Filters NPCs that are not playing a specific animation.
      • closest

        public KSNPC closest()
        Retrieves the closest NPC to the local player based on path distance.
      • furthest

        public KSNPC furthest()
        Retrieves the furthest NPC from the local player based on path distance.