Jump to content

Which NPC instance attacked me?


yfoo

Recommended Posts

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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