Chris Posted July 31, 2015 Posted July 31, 2015 if (!myPlayer().isAnimating() && !myPlayer().isMoving()) { if (!myPlayer().isUnderAttack() && Guard.isVisible()) { Guard.interact("Attack"); sleep(random(500, 1000)); } else { camera.toEntity(Guard); } } } if (myPlayer().getHealth() <=30 && getInventory().contains("Lobster")) { inventory.getItem("Lobster").interact("Eat"); sleep(random(600, 1200)); } I get this issue when running http://gyazo.com/32407f7a8337725e1ea21a0d621e325d It would return to attack then eat a lobster when it is already full health
Chris Posted July 31, 2015 Author Posted July 31, 2015 Try getSkills().getDynamic(Skill.HITPOINTS) <= 30 Okay thanks
chad0ck Posted July 31, 2015 Posted July 31, 2015 Try getSkills().getDynamic(Skill.HITPOINTS) <= 30 could try this.. if (myPlayer().getHealth() < *HPHERE*){
Volta Posted July 31, 2015 Posted July 31, 2015 could try this.. if (myPlayer().getHealth() < *HPHERE*){ wat?
chad0ck Posted July 31, 2015 Posted July 31, 2015 (edited) wat? was for him was quoting you because your method will also work. Edited July 31, 2015 by chad0ck
Volta Posted July 31, 2015 Posted July 31, 2015 if (myPlayer().getHealth() <=30) { if (myPlayer().getHealth() < *HPHERE*){ Erm, can you explain the difference between what he already has implemented and your suggestion?
chad0ck Posted July 31, 2015 Posted July 31, 2015 Erm, can you explain the difference between what he already has implemented and your suggestion? Oops, just now noticed that's what he had. Besides the less than or equal to, my apologies. 1
Joseph Posted July 31, 2015 Posted July 31, 2015 getHealth() returns a int when hp bar above character is visible. so use the current hp to track when to eat 1
chad0ck Posted July 31, 2015 Posted July 31, 2015 getHealth() returns a int when hp bar above character is visible. so use the current hp to track when to eat getHealth works just fine with no hp bar, I tested this myself
Joseph Posted July 31, 2015 Posted July 31, 2015 getHealth works just fine with no hp bar, I tested this myself it will return the wrong value. fight someone, wait until the bar disable and eat some food. youll see it wont update without the bar
chad0ck Posted July 31, 2015 Posted July 31, 2015 it will return the wrong value. fight someone, wait until the bar disable and eat some food. youll see it wont update without the bar I will look at this when I get home, i'm sure you are correct. Thank you for correcting me. :P
Soldtodie Posted July 31, 2015 Posted July 31, 2015 getSkills().getDynamic(Skill.HITPOINTS) // Works myPlayer().getHealth() // Percentage, doesn't work if you logged in with not 100% life getWidgets().get(160, 4).getMessage() // Works, only if the orbs are activated