Jump to content

Better eating method?


Recommended Posts

Posted

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));
}
Posted
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?

Posted

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

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