Jump to content

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


Dot

Recommended Posts

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?

Link to comment
Share on other sites

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

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.

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