Jump to content

Which NPC instance attacked me?


Recommended Posts

Posted (edited)

In a single combat area where NPCs are aggressive to the player. How do I determine which NPC attacked me without attacking back. 

public static List<NPC> getNpcsAggroed(Bot bot) {
  MethodProvider methods = bot.getMethods();
  return methods.npcs.filter(npc -> npc.getInteracting() != null && npc.getInteracting().equals(methods.myPlayer()));
}
  

^ Above narrows it down to which NPCs instances would attack me. NPCs also don't deaggro just because one attacked me. 

public static List<NPC> getNPCImInteractingWith(Bot bot) {
  MethodProvider methods = bot.getMethods();
  return methods.npcs.filter(npc -> methods.myPlayer().isInteracting(npc));
}

^ Only gets the npc after player starts attacking it. 

Edited by yfoo

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...