Jump to content

NPC is being splashed?


Recommended Posts

Posted (edited)

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
Posted (edited)
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
Posted (edited)
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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