Jump to content

How to open doors when NPC can't be reached?


Recommended Posts

Posted

I'm writing an AIO fighter and I want my script to open doors if the closest attackable NPC is behind one (eg: Al-Kharid Warriors, some cunt closes a door in my face). Is there a better method for this than webwalking to the NPC's position?

target = npcs.closest(n -> n.getName().equals(targetName) && n.exists()
					&& n.getHealthPercent() > 0 && !myPlayer().isInteracting(n)
					&& !n.isUnderAttack() && n != null);
if (!map.canReach(target)) getWalking().webWalk(target.getPosition());
else {
	// do combat stuff
}

^^ that's sort of what I'm using but webWalk is heavy on resources and I feel this is a really sloppy use of it.

Is there a better way that is universal?

Posted (edited)
2 minutes ago, Dot said:

I'm writing an AIO fighter and I want my script to open doors if the closest attackable NPC is behind one (eg: Al-Kharid Warriors, some cunt closes a door in my face). Is there a better method for this than webwalking to the NPC's position?


target = npcs.closest(n -> n.getName().equals(targetName) && n.exists()
					&& n.getHealthPercent() > 0 && !myPlayer().isInteracting(n)
					&& !n.isUnderAttack() && n != null);
if (!map.canReach(target)) getWalking().webWalk(target.getPosition());
else {
	// do combat stuff
}

^^ that's sort of what I'm using but webWalk is heavy on resources and I feel this is a really sloppy use of it.

Is there a better way that is universal?

getDoorHandler().handleNextObstacle(target)

Edited by jca
  • Like 1
Posted
3 minutes ago, Juggles said:

simple way would be to

 


if (!map.canReach(npc) {
walking.webWalk(INSIDE_AREA); 
} else {
//kill shit
}

 

That's basically what I was using already but I want it to work when the area isn't necessarily known (hence using getPosition() as the area).  Also webWalk makes the client lag super hard.

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