Team Cape Posted June 30, 2016 Share Posted June 30, 2016 I'm scouring the API, yet I can't find how to obtain the current HP remaining of a player. How can this be done? Quote Link to comment Share on other sites More sharing options...
Token Posted June 30, 2016 Share Posted June 30, 2016 (edited) getCurrentHealth() This is only updated while in combat and will return 0 if they have never been detected in combat, the associated getCombatTime() will return -1000 if the Player instance has never been detected in combat. Edited June 30, 2016 by Token 2 Quote Link to comment Share on other sites More sharing options...
Team Cape Posted June 30, 2016 Author Share Posted June 30, 2016 (edited) getCurrentHealth() This is only updated while in combat and will return 0 if they have never been detected in combat, the associated getCombatTime() will return -1000 if the Player instance has never been detected in combat. Thanks so much for the help! Would you please show me an example of how it's used? Do I need to write 'character.getCurrentHealth()'? What object should I attach the method to? Edited June 30, 2016 by Imateamcape Quote Link to comment Share on other sites More sharing options...
Token Posted June 30, 2016 Share Posted June 30, 2016 Thanks so much for the help! Would you please show me an example of how it's used? Do I need to write 'character.getCurrentHealth()'? What object should I attach the method to? Player x = players.closest("Johnny"); if (x.getCombatTime() == -1000) { log("Johnny has never been in combat; we can't know his hp"); } else { log("Johnny's hp is: " + x.getCurrentHealth()); } 1 Quote Link to comment Share on other sites More sharing options...
Acerd Posted June 30, 2016 Share Posted June 30, 2016 getSkills().getDynamic(Skill.HITPOINTS); also gives you the current hitpoints , if you want the percentage use this: double hpPercentage = getSkills().getDynamic(Skill.HITPOINTS) * 100 / getSkills().getStatic(Skill.HITPOINTS); 3 Quote Link to comment Share on other sites More sharing options...