Jump to content

NPC is being splashed?

Recommended Posts

I've only just started developing a script, my first one.. It's a chicken killer in a tight nit area to avoid running around 'like a headless chicken'.. So to speak.


However, my method for determining whether the target is attackable is as follows.

private boolean isAttackableTarget(final NPC target) {
        return target != null && target.exists() && target.getHealthPercent() > 0 && !target.isUnderAttack() && isInArea(target.getPosition());

So I determine if the target is null, if it's alive, if it's being attacked and it's within the confines of my area. However, if the target is being splashed it will attempt to attack. I need to figure out a way to see if the target "Is Attacking".


From doing a bit of digging I can determine the chicken's animations loop through 3587 & 3588 for the initial splash and retaliation. However, there's nothing conclusive from the hover information I can gather to determine if it's attacking or not as this animation cycle briefly returns back to give a false indication of not animating. Clearly, is under attack does not cover this outcome also.

I've tried searching a solution and not found anything as of yet. Any help appreciated.

Edited by smokehut
Link to comment
Share on other sites

6 minutes ago, HeyImJamie said:

Doesn't isAttackable rely on the health bar? If there's no health bar, it'll return as attackable even if it's being splashed.

Yes, isAttackable makes use of getHealthPercent and isUnderAttack, both of which I believe make use of the health bar.

If the health bar is not visible, isUnderAttack will return false.

Edited by Explv
Link to comment
Share on other sites

On 30/12/2017 at 10:25 PM, Lemons said:

Should just have to check if any players are interacting with the NPC:

public boolean isSplashed(NPC npc) {
	return !getPlayers().filter(p -> p.isInteracting(npc)).isEmpty();

Will return true if someone is interacting/splashing the NPC.


This looks like what I require, the dude splashing has unfortunately left. However, I'll update once I can confirm this works.


EDIT, yes I can confirm this works.

Edited by smokehut
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.

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