Jump to content
Prolax

Method to hover over next npc

Recommended Posts

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 by progamerz
Link to comment
Share on other sites

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 by Fruity
  • Like 4
Link to comment
Share on other sites

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!

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...