PrimoFernando 7 Posted April 1, 2015 hey, I'm with some issues in my script when it reaches the bank it eats half of the inventory even if full health i want it to eat when it reaches 40% of the health. My EatNode: public class EatNode extends TaskNode { @Override public boolean accept() { return UserSettings.guiPrepared && getLocalPlayer().getHealthPercent() < 40 && getInventory().contains(UserSettings.foodName) && UserSettings.eatChecked; } @Override public int execute() { getInventory().interact(UserSettings.foodName, "Eat"); return (int) Calculations.gRandom(1000, 200); } } what i have wrong in here?
Zawy 990 Posted April 1, 2015 Just use this; if(getSkills().getBoostedLevels(Skill.HITPOINTS) < 50){ getInventory().interact(foodname,"Eat"); sleep(+Calculations.random(500,800)); }
PrimoFernando 7 Author Posted April 1, 2015 Just use this; if(getSkills().getBoostedLevels(Skill.HITPOINTS) < 50){ getInventory().interact(foodname,"Eat"); sleep(+Calculations.random(500,800)); } thanks man the method getLocalPlayer().getHealthPercent() must be broke right?
Notorious 342 Posted April 1, 2015 thanks man the method getLocalPlayer().getHealthPercent() must be broke right? Actually that call uses player.getHealth() hook, which is only active while in combat. Though we do have a call so you can use your skills for a health percentage rather than your current combat health, just call: getCombat().getHealthPercent(); //Click for the JavaDoc info
PrimoFernando 7 Author Posted April 1, 2015 Actually that call uses player.getHealth() hook, which is only active while in combat. Though we do have a call so you can use your skills for a health percentage rather than your current combat health, just call: getCombat().getHealthPercent(); //Click for the JavaDoc info thanks notorious, that 2 methods cause confusion it's better to add some notes to getLocalPlayer().getHealthPercent() in api.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.