Axolotl 31 Posted September 4, 2021 Hey Everyone, I am working on the pking component of my bot, and I am struggling to get the Enemy Players Max Health through DreamBot methods. I am able to get their health via a highscore lookup, but only if they have atleast 1 highscore on there. I can easily determine their current HP by: (currentTarget.getHealthPercent() * 0.01) * maxHP I just need a way to get their max hp (for low cb levels as I intend for it's first versions to start off in F2P) I have tried the following: HealthBar hp = new HealthBar(currentTarget.getReference()); HealthBarData hpD = new HealthBarData(currentTarget.getReference()); HealthBarComposite hpC = new HealthBarComposite(currentTarget); log("PK - Target health bar current hp: " + hp.getHealthBarData().getCurrentHealth()); log("PK - Target health bar current hp: " + hpD.getCurrentHealth()); log("PK - Target health bar current hp: " + hpC.getMaxHealth()); I not sure if it's just cause I'm not sending the right info to the HealthBar constructor, I have tried with: Player, Object (getReference()) and PlayerComposite Any help or suggestions would be greatly appreciated! Thank you
brave 29 Posted September 4, 2021 You can use https://secure.runescape.com/m=hiscore_oldschool/index_lite.ws?player=X to grab someones hitpoints level. You will always get it in this format, where 93 is the hitpoints level. To parse this you can just split by "," Jahex needs json lol Quote 1178819,1169,45695752 631432,80,2136855 433269,86,3796198 775440,85,3449016 534517,93,7246119 367057,96,10116906 572785,71,814741 118498,99,14364722 -1,5,490 1528736,58,243847 -1,26,9165 -1,14,2156 772263,69,729024 -1,22,5828 1381930,48,85656 -1,32,17793 229596,80,2080812 1748946,39,35832 790820,55,174959 1000353,60,295132 885135,48,90501 -1,1,0 -1,1,0 -1,1,0 -1,-1 253288,2 190409,2 204456,127 -1,-1 730599,2 73445,123 631887,2 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 209657,147 -1,-1 15523,217 -1,-1 17452,706 -1,-1 -1,-1 7926,296 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 53642,401 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 20368,131 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1
Axolotl 31 Author Posted September 4, 2021 1 minute ago, braveheart said: You can use https://secure.runescape.com/m=hiscore_oldschool/index_lite.ws?player=X to grab someones hitpoints level. You will always get it in this format, where 93 is the hitpoints level. To parse this you can just split by "," Jahex needs json lol @braveheart I appreciate it, but I am already using this, since you gave me this awesome advice a few days ago My issue is for low cb level players that don't appear on the highscores with any stats and it fails to retrieve their hp level. I've created a temporary solution that uses the following logic to get maxHP of the low cb no highscore players but it's not ideal: - Get their currentHealthPercent before attacking begins - Once atleast 1 damage has occured, re grab their currentHealthPercent - maxHp = 100 / ((initialHealthPercent - currentHealthPercent) / damageDealt) - currentHp = (currentTarget.getHealthPercent() * 0.01) * maxHp Its not ideal but gets the job done, but would be nice if there was a way to get the maxHp without having to deal damage xD
brave 29 Posted September 4, 2021 23 minutes ago, Axolotl said: @braveheart I appreciate it, but I am already using this, since you gave me this awesome advice a few days ago My issue is for low cb level players that don't appear on the highscores with any stats and it fails to retrieve their hp level. I've created a temporary solution that uses the following logic to get maxHP of the low cb no highscore players but it's not ideal: - Get their currentHealthPercent before attacking begins - Once atleast 1 damage has occured, re grab their currentHealthPercent - maxHp = 100 / ((initialHealthPercent - currentHealthPercent) / damageDealt) - currentHp = (currentTarget.getHealthPercent() * 0.01) * maxHp Its not ideal but gets the job done, but would be nice if there was a way to get the maxHp without having to deal damage xD afaik the only possible way to get exact opponent hp level would be to use stat spy on the lunar spellbook
Axolotl 31 Author Posted September 4, 2021 2 minutes ago, braveheart said: afaik the only possible way to get exact opponent hp level would be to use stat spy on the lunar spellbook Ah dang eh, thats too bad. I just figured there must be a way, possibly a DreamBot client method will need to be created? If they are able to get the players current health percent, they would need the maxHp anyways? Not too sure why it was depreciated. RuneLite somehow is able to get that data and before any damage is done, unlike the non ideal way I thought of lol
brave 29 Posted September 4, 2021 1 minute ago, Axolotl said: Ah dang eh, thats too bad. I just figured there must be a way, possibly a DreamBot client method will need to be created? If they are able to get the players current health percent, they would need the maxHp anyways? Not too sure why it was depreciated. RuneLite somehow is able to get that data and before any damage is done, unlike the non ideal way I thought of lol Pretty sure it is impossible to get exact health % even on runelite (even if npcs due to healing), I think they just work from wiki data and % in healthbar to calc approximate health
Recommended Posts
Archived
This topic is now archived and is closed to further replies.