Ayylmao42000 6 Posted March 14, 2017 NPC newGargoyle = getNpcs().closest(n -> n != null && n.getName().equals("Gargoyle") && n.hasAction("Attack") && n.getHealthPercent() > 0 && n.canAttack()); Still attacks the npc even though the health is at 0 aka it's doing the dying animation.
Ayylmao42000 6 Author Posted March 14, 2017 You could try && n.getAnimation() != deathAnimationID Sure, that'd work but then again the api method would still stay broke and would have to manually get death animation ids for npcs.
Strawberry 3 Posted March 14, 2017 Sure, that'd work but then again the api method would still stay broke and would have to manually get death animation ids for npcs. I know, I'm not saying you shouldn't post about it. Just offering a possible solution until your issue is fixed. PS; if you try to log the health percentage, do you get a proper value?
Xephy 237 Posted March 14, 2017 getNpcs().closest(npc -> npc != null && npc.getName().equals("Gargoyle") && !npc.isInCombat()).interact("Attack"); This works if you're just trying to find and attack a new gargoyle.
Im A Baller 348 Posted March 14, 2017 NPC newGargoyle = getNpcs().closest(n -> n != null && n.getName().equals("Gargoyle") && !n.isHealthBarVisible() && n.canAttack()); use this. getNpcs().closest(npc -> npc != null && npc.getName().equals("Gargoyle") && !npc.isInCombat()).interact("Attack"); This works if you're just trying to find and attack a new gargoyle. no. you'll get a null pointer exception too often for this to be worth it. also, this just doesnt fix his problem.
Xephy 237 Posted March 14, 2017 NPC newGargoyle = getNpcs().closest(n -> n != null && n.getName().equals("Gargoyle") && !n.isHealthBarVisible() && n.canAttack()); use this. no. you'll get a null pointer exception too often for this to be worth it. also, this just doesnt fix his problem. I use this exact line to attack gargoyles in my gargoyle slayer and it's never thrown an exception trying to find and attack a gargoyle. Use what you want, there's obviously more than one way to filter out other gargoyles in combat already.
Im A Baller 348 Posted March 14, 2017 I use this exact line to attack gargoyles in my gargoyle slayer and it's never thrown an exception trying to find and attack a gargoyle. Use what you want, there's obviously more than one way to filter out other gargoyles in combat already. right.. if there's no attackable gargoyle, thats going to throw a null pointer. thats just undeniable logic.
Xephy 237 Posted March 14, 2017 right.. if there's no attackable gargoyle, thats going to throw a null pointer. thats just undeniable logic. I'm just telling you that out of the 20+ hours of me testing my gargoyle script, it's never thrown that error. I'm not arguing with the logic, I'm just saying that an exception wasn't thrown "too often" in my case.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.