Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!
RuneMate will permanently shut down on August 7, 2026
due to events outside our control. You can continue using RuneMate until this date after which it will no longer be available. Thank you to everyone that contributed to RuneMate's success and to the community for the opportunity to serve you all these years.

  • Learn about RuneMate Vault and how its zero knowledge local encryption already protects your sensitive information.
  • Edit or delete your RuneMate account from your Account Settings.
  • All account upgrade subscriptions have been cancelled. No action required.

Question How to properly filter an NPC who's attacking me

Joined
Jan 23, 2017
Messages
9
I'm having trouble getting the actual NPC who's in combat with my player. My combat handler begins to choose a new target before I've killed the current target. Any help?
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,211
Your target:

Player.getTarget

Npc: ....targeting(player)
I'm having trouble getting the actual NPC who's in combat with my player. My combat handler begins to choose a new target before I've killed the current target. Any help?
 
Joined
May 24, 2016
Messages
1,113
I'm having trouble getting the actual NPC who's in combat with my player. My combat handler begins to choose a new target before I've killed the current target. Any help?

RS3? If yes, there are certain abilities that cause the 'target to break'. One of the is Snipe.
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,416
Code:
Npcs.newQuery().targeting(Players.getLocal()).results();
should return all that are targeting the player, and yeah like Qos said you can search local players target in case you have multiple wanting to attack you while you're in 1v1 situations.
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
Code:
Npcs.newQuery().targeting(Players.getLocal()).results();
should return all that are targeting the player, and yeah like Qos said you can search local players target in case you have multiple wanting to attack you while you're in 1v1 situations.
Nullcheck player, and probably add an action filter for attackable npcs to ignore pets etc.
 
Top