Chris Posted July 31, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...
Volta Posted July 31, 2015 Share Posted July 31, 2015 Try getSkills().getDynamic(Skill.HITPOINTS) <= 30 Quote Link to comment Share on other sites More sharing options...
Chris Posted July 31, 2015 Author Share Posted July 31, 2015 Try getSkills().getDynamic(Skill.HITPOINTS) <= 30 Okay thanks Quote Link to comment Share on other sites More sharing options...
Prozen Posted July 31, 2015 Share Posted July 31, 2015 Was this resolved? If so, great. Quote Link to comment Share on other sites More sharing options...
chad0ck Posted July 31, 2015 Share Posted July 31, 2015 Try getSkills().getDynamic(Skill.HITPOINTS) <= 30 could try this.. if (myPlayer().getHealth() < *HPHERE*){ Quote Link to comment Share on other sites More sharing options...
Volta Posted July 31, 2015 Share Posted July 31, 2015 could try this.. if (myPlayer().getHealth() < *HPHERE*){ wat? Quote Link to comment Share on other sites More sharing options...
chad0ck Posted July 31, 2015 Share Posted July 31, 2015 (edited) wat? was for him was quoting you because your method will also work. Edited July 31, 2015 by chad0ck Quote Link to comment Share on other sites More sharing options...
Volta Posted July 31, 2015 Share 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? Quote Link to comment Share on other sites More sharing options...
chad0ck Posted July 31, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...
Joseph Posted July 31, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...
chad0ck Posted July 31, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...
Joseph Posted July 31, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...
chad0ck Posted July 31, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...
Chris Posted July 31, 2015 Author Share Posted July 31, 2015 Im testing it now 1 Quote Link to comment Share on other sites More sharing options...
Soldtodie Posted July 31, 2015 Share 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 Quote Link to comment Share on other sites More sharing options...