1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Health Api

Discussion in 'Tutorials & Resources' started by frazboyz, Aug 4, 2014.

  1. frazboyz

    Joined:
    Nov 15, 2013
    Messages:
    339
    Likes Received:
    56
    Use n abuse.

    Code (Text):
    1. public static int getHealth() {
    2.         final InterfaceComponent ic = Interfaces.getAt(1430, 4, 7);
    3.         if (ic != null && ic.getText() != null) {
    4.             return Integer.parseInt(ic.getText().trim().split("/")[0]);
    5.         }
    6.         return -1;
    7.     }
    8.  
    9.     public static int getTotalHealth() {
    10.         final InterfaceComponent ic = Interfaces.getAt(1430, 4, 7);
    11.         if (ic != null && ic.getText() != null) {
    12.             return Integer.parseInt(ic.getText().trim().split("/")[1]);
    13.         }
    14.         return -1;
    15.     }
    16.  
    17.     public static int getHealthPercent() {
    18.         return (getHealth() / getTotalHealth()) * 100;
    19.     }
     
  2. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    Probably easier to make use of the skill class methods such getCurrentLevel() and getBaseLevel().
    Great share none the less :)
     
    Exile likes this.
  3. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    Code (Text):
    1.  
    2. int healthPercent = Players.getLocal().getHealthGauge().getPercent();
    3.  
     
  4. frazboyz

    Joined:
    Nov 15, 2013
    Messages:
    339
    Likes Received:
    56
    From what i belive it only works in combat unless its currently broken.
    I guess... but im pretty sure gear alters your health in rs3 so using your level isnt accurate.
     
  5. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    I don't see a reason to get the current HP level if not in combat :D

    Not anymore since the Legacy update, it removed health-boosting armour.
     
  6. frazboyz

    Joined:
    Nov 15, 2013
    Messages:
    339
    Likes Received:
    56
    Im suprised about no health boosting items xD also, for things like recharging your health at the bank etc.
     
  7. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    Goes automatically, when you enter any bank in RuneScape your health is restored to 100% without doing anything :p
    (Don't ask me why, test it out & you'll see)
     
  8. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    ActionBar.getHealth(), getMaxHealth(), etc...
     
  9. generalsensei

    Joined:
    Apr 21, 2019
    Messages:
    43
    Likes Received:
    9
    Skill.CONSTITUTION.getCurrentLevel or Skill.CONSTITUTION.getMaxLevel()
     

Share This Page

Loading...