Class NPCs

java.lang.Object
net.storm.sdk.entities.NPCs

public class NPCs extends Object
Static utility class for querying and interacting with NPCs.

Provides convenient access to all NPCs in the loaded scene. NPCs include monsters, shopkeepers, bankers, and other non-player characters.

Example usage:

 
 // Find nearest banker
 INPC banker = NPCs.getNearest("Banker");
 if (banker != null) {
     banker.interact("Bank");
 }

 // Find all goblins
 List<INPC> goblins = NPCs.getAll("Goblin");

 // Query with filters
 INPC target = NPCs.query()
     .names("Goblin", "Imp")
     .alive()
     .nearest();
 
 

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static INPC
    get(int index)
    Gets an NPC by its index in the NPC array.
    static List<INPC>
    Gets all NPCs in the loaded scene.
    static List<INPC>
    getAll(int... ids)
    Gets all NPCs with any of the specified IDs.
    static List<INPC>
    getAll(String... names)
    Gets all NPCs with any of the specified names.
    static List<INPC>
    getAll(Predicate<? super INPC> filter)
    Gets all NPCs matching a filter.
    static INPC
    Gets the NPC with the hint arrow pointing to it.
    static INPC
    getNearest(int... ids)
    Gets the nearest NPC to the local player with any of the specified IDs.
    static INPC
    getNearest(String... names)
    Gets the nearest NPC to the local player with any of the specified names.
    static INPC
    getNearest(Predicate<? super INPC> filter)
    Gets the nearest NPC to the local player matching a filter.
    static INPC
    getNearest(net.runelite.api.coords.WorldPoint worldPoint, int... ids)
    Gets the nearest NPC to a point with any of the specified IDs.
    static INPC
    getNearest(net.runelite.api.coords.WorldPoint worldPoint, String... names)
    Gets the nearest NPC to a point with any of the specified names.
    static INPC
    getNearest(net.runelite.api.coords.WorldPoint worldPoint, Predicate<? super INPC> filter)
    Gets the nearest NPC to a point matching a filter.
    static NPCQuery
    Creates a new NPC query for fluent filtering.
    static NPCQuery
    query(Supplier<List<INPC>> supplier)
    Creates a new NPC query with a custom supplier.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NPCs

      public NPCs()
  • Method Details

    • query

      public static NPCQuery query()
      Creates a new NPC query for fluent filtering.
      Returns:
      a new NPC query
    • query

      public static NPCQuery query(Supplier<List<INPC>> supplier)
      Creates a new NPC query with a custom supplier.
      Parameters:
      supplier - the NPC supplier
      Returns:
      a new NPC query
    • get

      public static INPC get(int index)
      Gets an NPC by its index in the NPC array.
      Parameters:
      index - the NPC index
      Returns:
      the NPC, or null if not found
    • getAll

      public static List<INPC> getAll()
      Gets all NPCs in the loaded scene.
      Returns:
      list of all NPCs
    • getAll

      public static List<INPC> getAll(Predicate<? super INPC> filter)
      Gets all NPCs matching a filter.
      Parameters:
      filter - the predicate to match
      Returns:
      list of matching NPCs
    • getAll

      public static List<INPC> getAll(int... ids)
      Gets all NPCs with any of the specified IDs.
      Parameters:
      ids - the NPC IDs to match
      Returns:
      list of matching NPCs
    • getAll

      public static List<INPC> getAll(String... names)
      Gets all NPCs with any of the specified names.
      Parameters:
      names - the NPC names to match
      Returns:
      list of matching NPCs
    • getNearest

      public static INPC getNearest(net.runelite.api.coords.WorldPoint worldPoint, Predicate<? super INPC> filter)
      Gets the nearest NPC to a point matching a filter.
      Parameters:
      worldPoint - the reference point
      filter - the predicate to match
      Returns:
      the nearest matching NPC, or null if none found
    • getNearest

      public static INPC getNearest(net.runelite.api.coords.WorldPoint worldPoint, int... ids)
      Gets the nearest NPC to a point with any of the specified IDs.
      Parameters:
      worldPoint - the reference point
      ids - the NPC IDs to match
      Returns:
      the nearest matching NPC, or null if none found
    • getNearest

      public static INPC getNearest(net.runelite.api.coords.WorldPoint worldPoint, String... names)
      Gets the nearest NPC to a point with any of the specified names.
      Parameters:
      worldPoint - the reference point
      names - the NPC names to match
      Returns:
      the nearest matching NPC, or null if none found
    • getNearest

      public static INPC getNearest(Predicate<? super INPC> filter)
      Gets the nearest NPC to the local player matching a filter.
      Parameters:
      filter - the predicate to match
      Returns:
      the nearest matching NPC, or null if none found
    • getNearest

      public static INPC getNearest(String... names)
      Gets the nearest NPC to the local player with any of the specified names.
      Parameters:
      names - the NPC names to match
      Returns:
      the nearest matching NPC, or null if none found
    • getNearest

      public static INPC getNearest(int... ids)
      Gets the nearest NPC to the local player with any of the specified IDs.
      Parameters:
      ids - the NPC IDs to match
      Returns:
      the nearest matching NPC, or null if none found
    • getHintArrowed

      public static INPC getHintArrowed()
      Gets the NPC with the hint arrow pointing to it.
      Returns:
      the hint arrowed NPC, or null if none