Jump to content

Need help with NPC facing/Interacting with another player


Strange_Fk

Recommended Posts

So I'm not a complete noob to scripting (not saying I'm crazy good either), but I am very new to the whole combat portion of the api and am in the process of making my first basic combat script.

 

To cut to the point I am unsure what filter/boolean to use for an npc that another playing is splash mage training on. Everything works great, except when a player is splashing the npc/entity I have chosen to train on. It will only click it once (occasionally) and right after get filtered out of the npc requirements and choose to attack a different npc nearby.

 

I was wondering what methods/boolean would prevent this from occuring as I see this as a potential red flag to get detected botting if done frequent enough.

 

Here is my script (feel free to use it, but ask for consent before sharing yourself which I doubt will be an issue) it is kinda sloppy and could definitely be cleaned up, but its my first combat script and have been to lazy to go back and clean and cut down/simplify the script at the momement. 

 

Thank you all in advance.....


Entity name is seagull, because I was using it for seagulls originally and have been lazy to change it to a universal name hahahahah

 

EDIT: oh and the names/int with names like shark and what not are because I never changed/deleted them from the standard template that I use when i write new scripts


Oh and if anyone is interested in non combat scripts I wrote feel free to ask me, I might have what you're looking for that have worked well for me.

Edited by Strange_Fk
Link to comment
Share on other sites

 

 

To cut to the point I am unsure what filter/boolean to use for an npc that another playing is splash mage training on. 

 

NPC seagull = npcs.Closest(n -> n.getName().equals("Seagull") && !n.isUnderAttack() && n.getInteracting() == null);

something along those lines. it will search for an seagul, that is called Seagull , is not underattack, and isnt interacting with anyone.

Edited by The Hero of Time
  • Like 1
Link to comment
Share on other sites

 

 

 

 

NPC seagull = npcs.Closest(n -> n.getName().equals("Seagull") && !n.isUnderAttack() && n.getInteracting() == null);

something along those lines. it will search for an seagul, that is called Seagull , is not underattack, and isnt interacting with anyone.

 

Ahh dope ill try that man. I had that but instead of getInteracting() I had !npc.getInteracting(myPlayer). Thanks mate should work man

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.
Note: Your post will require moderator approval before it will be visible.

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...