Jump to content

Run away if in combat.


Recommended Posts

Posted (edited)

Here's some code i cooked up real quick to run a certain distance away from my current position and hopefully escape combat. Thought i'd post it in case someone eventually finds it useful.

case COMBAT:
				if(getStore().isOpen()) {
					status = "Closing store.";
					getStore().close();
					new ConditionalSleep(10000) {
						@[member='Override']

						public boolean condition() throws InterruptedException {
							return !getStore().isOpen();
						}
					}.sleep();
				}
				if(getBank().isOpen())
				{
					status = "Opening bank.";
					getBank().close();
					new ConditionalSleep(10000) {
						@[member='Override']

						public boolean condition() throws InterruptedException {
							return !bank.isOpen();
						}
					}.sleep();
				}
				int getX = myPosition().getX();
				int getY = myPosition().getY();
				int getZ = myPosition().getZ();
				Position newPos = new Position(getX + 30, getY + 30, getZ);
				getWalking().webWalk(newPos);
				break; 

Might have to do some funky stuff with the getZ value if you want it to run away up/down stairs, not sure.

 

EDIT: Will cause issues if script attempts to walk to a non walkable area.

 

Edited by PlagueDoctor
  • Like 3
Posted (edited)

I don't think using a position given like that is good, like you said it will fuck you over if its not walkable and not do anything.

 

Usually you want to deagro with changing the Z coord aka walking up a ladder smile.png

What if you are in a small area also?

ye, there are a lot of possible errors, its faaaaaaaaar from perfect. Still though, might be useful to someone. Changing z coord would probs work better in this situation for sure

Edited by PlagueDoctor

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