Jump to content

Best way to implement deathwalking?


regnivon

Recommended Posts

I have a script that tends to die, and have tried to implement a deathwalking feature where when the bot dies, it teleports using the ring of dueling in its inventory to castle wars. I currently have an if statement at the top of my onloop like so, but when the bot dies/ is started in lumbridge, it just stands there. Any suggestions?

if (deadArea.contains(player)) {
    		getInventory().interactWithNameThatContains("Castle Wars", "Ring of dueling");
    		new ConditionalSleep(2000, 4000) { 
                @Override 
                public boolean condition() throws InterruptedException {
                    return player.isAnimating(); 
                }
            }.sleep();
    		return 500;
    	} 
Link to comment
Share on other sites

 

I have a script that tends to die, and have tried to implement a deathwalking feature where when the bot dies, it teleports using the ring of dueling in its inventory to castle wars. I currently have an if statement at the top of my onloop like so, but when the bot dies/ is started in lumbridge, it just stands there. Any suggestions?

if (deadArea.contains(player)) {
    		getInventory().interactWithNameThatContains("Castle Wars", "Ring of dueling");
    		new ConditionalSleep(2000, 4000) { 
                @Override 
                public boolean condition() throws InterruptedException {
                    return player.isAnimating(); 
                }
            }.sleep();
    		return 500;
    	} 

 

 

check for a message in chatbox which says something like "Oh dear, your dead" or something check it out ur self and if it contains that set a boolean to true and then do the code.

Link to comment
Share on other sites

 

I have a script that tends to die, and have tried to implement a deathwalking feature where when the bot dies, it teleports using the ring of dueling in its inventory to castle wars. I currently have an if statement at the top of my onloop like so, but when the bot dies/ is started in lumbridge, it just stands there. Any suggestions?

if (deadArea.contains(player)) {
    		getInventory().interactWithNameThatContains("Castle Wars", "Ring of dueling");
    		new ConditionalSleep(2000, 4000) { 
                @Override 
                public boolean condition() throws InterruptedException {
                    return player.isAnimating(); 
                }
            }.sleep();
    		return 500;
    	} 

 

my guess is that when you die, there's a task that gets cut off but lacks a break condition. i've had that happen to me a few times with path walking. the effect of that is that it keeps trying to run the same code and never stops, effectively meaning the script wont utilize anything else. just a shot in the dark, but a possibility nevertheless

 

edit: if i were you, i would test this with logger messages and make the code something like:

 

if (deadArea.contains(player)) {

        log("confirmed got to this point");

        getInventory().interactWithNameThatContains("Castle Wars", "Ring of dueling");

        .

        .

        .

 

 

to make sure that its actually trying to execute that code

Edited by Imateamcape
Link to comment
Share on other sites

I figured it out, forgot that the ring of dueling doesn't have a castle wars option when its in your inventory >.> thank you for the debug suggestion though imateamcape that helped me find out the problem!

 

 

check for a message in chatbox which says something like "Oh dear, your dead" or something check it out ur self and if it contains that set a boolean to true and then do the code.

^^ use this for better Deathwalk implement a better condition to be used with the dead area.

Edited by progamerz
Link to comment
Share on other sites

It works, or you can check if your player has the death animation (which might be different now because of the grim reaper)

 

Checking if your HP is zero, or if your character has played the death animation works, but you shouldn't do it because it will only work if a conditional check is executed while those conditions are true. If your script is executing instructions in a loop when you die, then the animation will play and your health will be full when your conditional statement runs.

 

Checking to see if you are in the death area is safer, so you shouldn't do either one of those things.

  • Like 2
Link to comment
Share on other sites

Checking if your HP is zero, or if your character has played the death animation works, but you shouldn't do it because it will only work if a conditional check is executed while those conditions are true. If your script is executing instructions in a loop when you die, then the animation will play and your health will be full when your conditional statement runs.

 

Checking to see if you are in the death area is safer, so you shouldn't do either one of those things.

why u guys ignoring the message :feels: but yeh its his wish.

Link to comment
Share on other sites

why u guys ignoring the message feels.png but yeh its his wish.

boolean death_flag = false;

    @[member='Override']
    public void onMessage(Message message) {
        if (message.getMessage().contains("dead") && message.getType().equals(Message.MessageType.GAME)) {
            log("progamerz raped my butthole :feels:");
            death_flag = true;
        }
    }


my butthole m8

 

feels.png feels.png feels.png

Edited by Solzhenitsyn
  • Like 1
Link to comment
Share on other sites

 

I have a script that tends to die, and have tried to implement a deathwalking feature where when the bot dies, it teleports using the ring of dueling in its inventory to castle wars. I currently have an if statement at the top of my onloop like so, but when the bot dies/ is started in lumbridge, it just stands there. Any suggestions?

if (deadArea.contains(player)) {
    		getInventory().interactWithNameThatContains("Castle Wars", "Ring of dueling");
    		new ConditionalSleep(2000, 4000) { 
                @Override 
                public boolean condition() throws InterruptedException {
                    return player.isAnimating(); 
                }
            }.sleep();
    		return 500;
    	} 

 

 

Personally for the sleep I would do something like:

new ConditionalSleep(10_000) { 
    @ Override 
    public boolean condition() throws InterruptedException {
        return !deadArea.contains(myPosition());
    }
}.sleep();
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...