Jump to content

Run away if in combat.


PlagueDoctor

Recommended Posts

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

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