Welcome!

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

Sign up now!

Bug .getHealthGauge not working

Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
RS3 CombatGauge:

As the title says, The .getHealthGauge method is not functioning properly. Not for Npc's nor for the player (the latter not being a problem because of Health.getCurrentPercent())

Below an example of the bot code and the debug log. The jump between 100 an -1 is NOT because target is dead but it turns -1 after it gets damaged.

Code:
Boolean hasTarget = Players.getLocal().getTarget() !=null;
        if(hasTarget) {
            bot.getLogger().info("Target acquired");
            CombatGauge hp = Players.getLocal().getTarget().getHealthGauge();
            if (hp != null) {
                bot.getLogger().info("Target hp: " + hp.getPercent());
                return hp.getPercent() >15;
            }
            bot.getLogger().info("Combat gauge not found");
        }
        return false;

Code:
00:00:11 INFO    Target hp: 100
00:00:12 INFO    ability is null
00:00:12 INFO    Target acquired
00:00:12 INFO    Target hp: 100
00:00:12 INFO    Target acquired
00:00:12 INFO    Target hp: -1
00:00:13 INFO    Target acquired
00:00:13 INFO    Target hp: -1
 
@Party
 
Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
It is! although sometimes i get results higher then 100%
 
Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
Code:
00:30:28 INFO    Target hp: 111
00:30:39 INFO    Target acquired
00:30:39 INFO    Target hp: 111
00:30:44 INFO    Target acquired
00:30:44 INFO    Target hp: 87
00:30:47 INFO    Target acquired
00:30:47 INFO    Target hp: 87
00:30:52 INFO    Target acquired
00:30:52 INFO    Target hp: 87

Code:
   target =  Players.getLocal().getTarget();
        if(target !=null) {
            bot.getLogger().info("Target acquired");
            CombatGauge hp = target.getHealthGauge();
            if (hp != null) {
                bot.getLogger().info("Target hp: " + hp.getPercent());
                return hp.getPercent() >10;
            }
            bot.getLogger().info("Combat gauge not found");
            return true;
        }
reproducing it just when fighting
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Code:
00:30:28 INFO    Target hp: 111
00:30:39 INFO    Target acquired
00:30:39 INFO    Target hp: 111
00:30:44 INFO    Target acquired
00:30:44 INFO    Target hp: 87
00:30:47 INFO    Target acquired
00:30:47 INFO    Target hp: 87
00:30:52 INFO    Target acquired
00:30:52 INFO    Target hp: 87

Code:
   target =  Players.getLocal().getTarget();
        if(target !=null) {
            bot.getLogger().info("Target acquired");
            CombatGauge hp = target.getHealthGauge();
            if (hp != null) {
                bot.getLogger().info("Target hp: " + hp.getPercent());
                return hp.getPercent() >10;
            }
            bot.getLogger().info("Combat gauge not found");
            return true;
        }
reproducing it just when fighting
When fighting what though... I need as much context as you can provide me with otherwise this bug won't be able to be fixed completely.
 
Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
Srry i forgot about answering this. It happens with every monster, no exceptions. I think it is wrongly calibrated so that 111 is max health. Never seen anything over. Lowest I saw was returning 3 (when scrolling through a log of about an hour), so i think lower limit is correct(0).
 
Top