Resolved CombatGauge not functioning correctly

Discussion in 'Client & Site Support' started by Liquid, Jul 14, 2014.

Thread Status:
Not open for further replies.
  1. Players.getLocal().getHealthGauge().getPercent() throws a NPE if the over-head adrenaline bar (example) is not visible. If it is visible, it'll return the player's adrenaline percent.

    Likely caused by the recent game-updates surrounding combat (legacy mode, graphical changes, etc.)
  2. Not a bug actually, if the health/adrenaline gauge isn't visible then the data related to it isn't available, so the gauge returns null.
  3. getHealthGauge()#getPercent() is returns the value of getAdrenalineGauge()#getPercent(), and getAdrenalineGauge()#getPercent() returns null even if it is visible.

    It is a bug.

    Also, I would much rather it was implemented from the gathering of data of the actionbar. Why one should only be able to return the player's health percent whilst they are in combat, I do not know.
  4. Oh I'm sorry originally I misunderstood you. I'll check into it.

    In response to your other question, if you'd like to get the data from the actionbar then you can. The rs3 package contains an ActionBar class that contains methods such as getHealth and getMaximumHealth. Those are more appropriate for when you're just looking for the local players health, but when it comes to other npcs the only way you can check their health is through the combat gauges
    Liquid likes this.
  5. I see it now, thanks (-:

    Ended up re-coding it myself, using the text from the action-bar

    Code (Text):
    2. private static final InterfaceComponent HEALTH_COMPONENT = Interfaces.getAt(1430, 4, 7);
    4. private static String healthTextAb() {
    5.   return HEALTH_COMPONENT.getText();
    6. }
    8. private static double getMaximumHealthAb() {
    9.   String h = healthTextAb();
    10.   return Double.parseDouble(h.substring(h.indexOf("/") + 1, h.length()));
    11. }
    13. private static double getHealthAb() {
    14.   String h = healthTextAb();
    15.   return Double.parseDouble(h.substring(0, h.indexOf("/")));
    16. }
    18. public static int getHealthPercentAb() {
    19.   return (int) Math.round(getHealthAb() / getMaximumHealthAb() * 100);
    20. }
  6. May I ask why you did that (Unless it was before you knew in which case I completely understand)?
  7. Already started before you posted the reply

    By the way, this pretty much sums up the problem


    As you see, health is reported to be at 100%.
  8. Yeah I found the problem in the code, I'm writing a better framework for the data structure the game uses so I don't have any similar problems in the future
    #8 Cloud, Jul 14, 2014
    Last edited: Jul 14, 2014
  9. Use settings/varps for getting actionbar you nub. You shouldn't be using widgets with almost all of the bars accessible through them.
  10. What? We're talking about the combat gauges that appear above players heads?
  11. Players.getLocal().getHealthGauge().getPercent()

    There are settings/varps for those, same for maximum health. No reason to check widgets.
  12. As a followup, I've gone ahead and written a nice wrapper around a LinkedList implementation in the game engine to help me better manage when things related to their linked lists. The hooks were also updated, and because of that until the next release both gauges will return the health gauges value (instead of the adrenaline gauges, but everything is fixed in the next release).
  13. Mate, that's only for the local player, you're forgetting that other Actors also have combat gauges lol. Using the CombatBar class to just get the local players data works fine and does use varps, but for other Actors you need to rely on their CombatGauges
  14. I assumed you used settings automatically for the localplayer for any methods that can easily be checked with settings. :(.
  15. Yeah no problem mate, but when somethings local player specific I tend to put it in separate classes to not cause any confusion.
Thread Status:
Not open for further replies.

Share This Page