Jump to content

isRandomAttacking


Mr Asshole

Recommended Posts

Little snippet that determines if you're being attacked by a random. Make sure to have the npc names as the npc you're fighting.

private boolean isRandomAttacking(String... npcNames) {
		List<NPC> enemies = client.getLocalNPCs();

		if (enemies != null) {
			for (NPC npc : enemies) {
				for (String s : npcNames) {
					if (!npc.isFacing(client.getMyPlayer()) && !npc.isVisible()) {
						continue;
					}
					if (!npc.getName().equals(s)) {
						return true;
					}
					
				}
			}
		}

		return false;
	}
Edited by Exarticus
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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