Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can I get the current HP of a Player?

Featured Replies

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 by Token

  • Author

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 by Imateamcape

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());
}
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);

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.