Mr Asshole Posted August 1, 2013 Posted August 1, 2013 (edited) 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 August 16, 2013 by Exarticus 1
Cloudnine Posted August 1, 2013 Posted August 1, 2013 This sucks. (You told me to criticize it.. You didn't say constructively.) Jk. Looks good. This would work great for most scenarios.