Jump to content

Better eating method?


scriptersteve

Recommended Posts

Currently using this as my eating method: but conscious that always eating when health < 50% is very botlike. What is a better way to go about this? Are there any snippet examples that could would be useful?

if(myPlayer().getHealthPercent() < 50){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
Link to comment
Share on other sites

if(myPlayer().getHealthPercent() < 65 && (Math.random() < 0.1)){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
if(myPlayer().getHealthPercent() < 50 && (Math.random() < 0.2)){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
if(myPlayer().getHealthPercent() < 40 && (Math.random() < 0.25)){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
if(myPlayer().getHealthPercent() < 25){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}

 

something like this?

Link to comment
Share on other sites

or like this: 

if(myPlayer().getHealthPercent() < (75*(Math.random())) || myPlayer().getHealthPercent() < 20){

    getInventory().interact("Eat", this.config.getFoodName());
    new ConditionalSleep(2000,1000){
        @ Override
        public boolean condition() throws InterruptedException
        {
            return myPlayer().getAnimation() == 829;
        }
    }.sleep();
    sleep(random(400, 650));
}
Link to comment
Share on other sites

18 minutes ago, scriptersteve said:

ok, thanks will it not always be over-written to 50 though: as the only place it seemed to work instanciating it was inside the onloop function?

never mind was being a retard was one curly brace out when i tried instanciating it above

int eatAt would be global, it'd then be set again after eating. 

Link to comment
Share on other sites

The way I handle this is to eat when food will be 100% effective or if the character is under or at a certain threshold (I set this to monsters max hit). So say you eating trout, it heals 7 hp. If we have 25 hp, we heal at 18 hp or less. This keeps us near full HP which is generally what is wanted with food but won't waste food with %s. But say we were fighting something with a max hit of 5, we'd have a minimum threshold of 5 HP, so in case the monster hits us for max damage we can still live.

  • Like 1
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...