Prolax Posted May 17, 2017 Posted May 17, 2017 Does anyone have a method to hover over next npc for a combat script? Or some advice on how to write my own method for this? Thanks!
progamerz Posted May 17, 2017 Posted May 17, 2017 (edited) 20 minutes ago, Prolax said: Does anyone have a method to hover over next npc for a combat script? Or some advice on how to write my own method for this? Thanks! U can filter closest NPC: Example(Not sure as I typed it her not in IDE so check it out): NPC npc = getNpcs().closest(f-> !f.isUnderAttack && f.gethitpoints > 0 && !f.isHitbarvisibile) EDIT: check fruity's post Edited May 17, 2017 by progamerz
Fruity Posted May 17, 2017 Posted May 17, 2017 (edited) Character<?> character = script.myPlayer().getInteracting(); if (character != null && character.getHealthPercentCache() < 30) { NPC next = script.getNpcs().closest(n -> n.getName().equals("NAME") && !n.isUnderAttack() && n != character && n.getHealthPercentCache() > 0); next.hover(); } Make sure to add n.getName().equals("NAME") Not tested but im sure it will be something similar Edited May 17, 2017 by Fruity 4
Prolax Posted May 17, 2017 Author Posted May 17, 2017 11 minutes ago, Fruity said: Character<?> character = script.myPlayer().getInteracting(); if (character != null && character.getHealthPercentCache() < 30) { NPC next = script.getNpcs().closest(n -> n.getName().equals("NAME") && !n.isUnderAttack() && n != character && n.getHealthPercentCache() > 0); next.hover(); } Make sure to add n.getName().equals("NAME") Not tested but im sure it will be something similar Thanks, it works! 1
Trees Posted May 18, 2017 Posted May 18, 2017 Make sure to add a delay between hovering and either choose to hover over the same NPC or it might just hover over what's closest (depending how you have it coded), which could change frequently.
Prolax Posted May 18, 2017 Author Posted May 18, 2017 2 hours ago, Trees said: Make sure to add a delay between hovering and either choose to hover over the same NPC or it might just hover over what's closest (depending how you have it coded), which could change frequently. Indeed, I noticed the same. Just a random delay or conditional sleep?
Trees Posted May 19, 2017 Posted May 19, 2017 18 hours ago, Prolax said: Indeed, I noticed the same. Just a random delay or conditional sleep? Use a delay, in case you need to eat, tele, etc. Also make sure when you calculate the random delay, you set it to a variable. Otherwise every loop it will recalculate and be more likely to be a shorter delay.