May 17, 20178 yr 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!
May 17, 20178 yr 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, 20178 yr by progamerz
May 17, 20178 yr 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, 20178 yr by Fruity
May 17, 20178 yr Author 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!
May 18, 20178 yr 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.
May 18, 20178 yr Author 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?
May 19, 20178 yr 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.
Create an account or sign in to comment