Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Health Api

Joined
Nov 15, 2013
Messages
339
Use n abuse.

Code:
public static int getHealth() {
        final InterfaceComponent ic = Interfaces.getAt(1430, 4, 7);
        if (ic != null && ic.getText() != null) {
            return Integer.parseInt(ic.getText().trim().split("/")[0]);
        }
        return -1;
    }

    public static int getTotalHealth() {
        final InterfaceComponent ic = Interfaces.getAt(1430, 4, 7);
        if (ic != null && ic.getText() != null) {
            return Integer.parseInt(ic.getText().trim().split("/")[1]);
        }
        return -1;
    }

    public static int getHealthPercent() {
        return (getHealth() / getTotalHealth()) * 100;
    }
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
7,032
Probably easier to make use of the skill class methods such getCurrentLevel() and getBaseLevel().
Great share none the less :)
 
Joined
Jul 24, 2014
Messages
188
Use n abuse.

Code:
public static int getHealth() {
        final InterfaceComponent ic = Interfaces.getAt(1430, 4, 7);
        if (ic != null && ic.getText() != null) {
            return Integer.parseInt(ic.getText().trim().split("/")[0]);
        }
        return -1;
    }

    public static int getTotalHealth() {
        final InterfaceComponent ic = Interfaces.getAt(1430, 4, 7);
        if (ic != null && ic.getText() != null) {
            return Integer.parseInt(ic.getText().trim().split("/")[1]);
        }
        return -1;
    }

    public static int getHealthPercent() {
        return (getHealth() / getTotalHealth()) * 100;
    }

Code:
int healthPercent = Players.getLocal().getHealthGauge().getPercent();
 
Joined
Nov 15, 2013
Messages
339
Code:
int healthPercent = Players.getLocal().getHealthGauge().getPercent();

From what i belive it only works in combat unless its currently broken.
Probably easier to make use of the skill class methods such getCurrentLevel() and getBaseLevel().
Great share none the less :)

I guess... but im pretty sure gear alters your health in rs3 so using your level isnt accurate.
 
Joined
Nov 15, 2013
Messages
339
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.

Im suprised about no health boosting items xD also, for things like recharging your health at the bank etc.
 
Joined
Jul 24, 2014
Messages
188
Im suprised about no health boosting items xD also, for things like recharging your health at the bank etc.
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)
 
Top