Health Api

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

  1. frazboyz

    Joined:
    Nov 15, 2013
    Messages:
    327
    Likes Received:
    54
    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 The better executive ;)

    Joined:
    Dec 3, 2013
    Messages:
    3,003
    Likes Received:
    590
    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:
    189
    Likes Received:
    23
    Code (Text):
    1.  
    2. int healthPercent = Players.getLocal().getHealthGauge().getPercent();
    3.  
     
  4. frazboyz

    Joined:
    Nov 15, 2013
    Messages:
    327
    Likes Received:
    54
    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:
    189
    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:
    327
    Likes Received:
    54
    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:
    189
    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 The Developer

    Joined:
    Jul 28, 2013
    Messages:
    2,300
    Likes Received:
    729
    ActionBar.getHealth(), getMaxHealth(), etc...
     

Share This Page

Loading...