Ateria Posted October 9, 2018 Share Posted October 9, 2018 (edited) Here's the current code I have for prayer flicking: private void handlePrayerFlicking() { if (getSkills().getStatic(Skill.PRAYER) >= 37 && !canFlickMage) canFlickMage = true; if (getSkills().getStatic(Skill.PRAYER) >= 40 && !canFlickRange) canFlickRange = true; if (getSkills().getStatic(Skill.PRAYER) >= 43 && !canFlickMelee) canFlickMelee = true; if (myPlayer().getInteracting() != null && myPlayer().getInteracting() instanceof NPC) { NPC npc = ((NPC) myPlayer().getInteracting()); if (npc.getHealthPercent() > 0 && npc.exists()) { if (!npc.isAnimating() && !getPrayer() .isActivated(currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC : currentNPCAttackStyle.equalsIgnoreCase("range") ? PrayerButton.PROTECT_FROM_MISSILES : PrayerButton.PROTECT_FROM_MELEE)) { if ((canFlickMage && currentNPCAttackStyle.equalsIgnoreCase("mage")) || (canFlickRange && currentNPCAttackStyle.equalsIgnoreCase("range")) || (canFlickMelee && currentNPCAttackStyle.equalsIgnoreCase("melee"))) { if (getPrayer() .set(currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC : currentNPCAttackStyle.equalsIgnoreCase("range") ? PrayerButton.PROTECT_FROM_MISSILES : PrayerButton.PROTECT_FROM_MELEE, true)) { } else { } } } else { if (getPrayer().isActivated( currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC : currentNPCAttackStyle.equalsIgnoreCase("range") ? PrayerButton.PROTECT_FROM_MISSILES : PrayerButton.PROTECT_FROM_MELEE)) { Sleep.waitCondition(() -> npc.isAnimating() || npc.getHealthPercent() == 0, 300, 1500); if (getPrayer() .set(currentNPCAttackStyle.equalsIgnoreCase("mage") ? PrayerButton.PROTECT_FROM_MAGIC : currentNPCAttackStyle.equalsIgnoreCase("range") ? PrayerButton.PROTECT_FROM_MISSILES : PrayerButton.PROTECT_FROM_MELEE, false)) { } else { } } } } } } This works fine with most npcs, other than those that have longer attack delays, like hill giants. Whenever the npc performs their defense animation, prayer will still flick as they're 'animating'. I only want the prayer to flick off if it's their attack animation. Is it possible to determine if the current animation an npc is performing is their defense animation or is there a better way to add prayer flicking? Edited October 9, 2018 by Ateria Quote Link to comment Share on other sites More sharing options...
Fruity Posted October 9, 2018 Share Posted October 9, 2018 @FrostBug is the osbot woox for flicking, surely he can help 1 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted October 9, 2018 Share Posted October 9, 2018 If you timestamp any one attack animation from the NPC, you can predict the timestamps of their next attacks based on their attackspeed 1 Quote Link to comment Share on other sites More sharing options...
Ateria Posted October 9, 2018 Author Share Posted October 9, 2018 2 minutes ago, FrostBug said: If you timestamp any one attack animation from the NPC, you can predict the timestamps of their next attacks based on their attackspeed I was going to do that, but it's for a slayer script and with the amount of tasks there are, i'd have to go through enum and add attack animations one by one after getting them in-game which'd take a long time. Is it not possible to do it another way? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted October 9, 2018 Share Posted October 9, 2018 3 minutes ago, Ateria said: I was going to do that, but it's for a slayer script and with the amount of tasks there are, i'd have to go through enum and add attack animations one by one after getting them in-game which'd take a long time. Is it not possible to do it another way? There's probably a fixed relation between the animations if I had to guess.. like the defence animation always being a higher or lower ID than the attack animation 1 Quote Link to comment Share on other sites More sharing options...
Ateria Posted October 9, 2018 Author Share Posted October 9, 2018 15 minutes ago, FrostBug said: There's probably a fixed relation between the animations if I had to guess.. like the defence animation always being a higher or lower ID than the attack animation That seems to work for the tasks so far, thanks Quote Link to comment Share on other sites More sharing options...