Jump to content

Adding an eat feature to my Fighting Bot


Recommended Posts

if (!WARRIOR_AREA.contains(getAPIContext().localPlayer().getLocation())) {
    getAPIContext().webWalking().walkTo(WARRIOR_AREA.getRandomTile());
} else if (!isActioning()) {
    if (chickenNPC != null) {
        attack();
    }
    else if (getAPIContext().localPlayer().getHealthPercent()) {
        eat();
Link to comment
Share on other sites

  • 3 months later...

Don't know if you are still having issues but it could be this.


    else if (getAPIContext().localPlayer().getHealthPercent()) {
        eat();

In the ELSE IF at the bottom, this just gets the Health Percent, you will need to check it against a value like such. 
 

else if (getAPIContext().localPlayer().getHealthPercent() <= 50) {
        eat();

This will check if your health is less than 50 and then call the eat() function.

 

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...