Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hit splats API?

Featured Replies

Is there any way to retrieve hit splats (damage digits shown at your head)?

I remember there were Player.getHitSplats() but it was removed long time ago.

 

Thanks,

darkxor.

Is there any way to retrieve hit splats (damage digits shown at your head)?

I remember there were Player.getHitSplats() but it was removed long time ago.

 

Thanks,

darkxor.

 

I'm not sure if there are hitsplats in the API anymore, but to work out the damage to your player you could just do:

private int previousHealth;

@ Override
public final void onStart() {
    previousHealth = getHealth();
}

@ Override
public final int onLoop() throws InterruptedException {
    final int currentHealth = getHealth();
    if (currentHealth < previousHealth) {
        final int damage = previousHealth - currentHealth; // Calculate the damage
        previousHealth = currentHealth;
    }
    return random(100, 150);
}

private int getHealth() {
    return getSkills().getDynamic(Skill.HITPOINTS);
}

Or if you just want to know the % of hp remaining, for example to know when to eat, you can do:

public final int getHealthPercent() {
    return (getSkills().getDynamic(Skill.HITPOINTS) * 100) / getSkills().getStatic(Skill.HITPOINTS);
}

Edited by Explv

  • Author

Its not same thing as hit splats. I want be able get not amounts of damage taken by myself but amount of damage dealt to other players/npcs.

getHealth() returns percent for other entities, and also it cant retrieve hits (if two hits received in one tick - it will sum them)

Its not same thing as hit splats. I want be able get not amounts of damage taken by myself but amount of damage dealt to other players/npcs.

getHealth() returns percent for other entities, and also it cant retrieve hits (if two hits received in one tick - it will sum them)

 

You could try:

NPC npc = npcs.closest("Cow"); // Can be a Player instead

int[] splatDamage = npc.accessor.getSplatDamage();
int[] splatTimes = npc.accessor.getSplatTime();

Edited by Explv

Cant u split the gained exp into hits? 5xp would be hitsplat 1. Would work with melee and ranged. 

  • Author

 

You could try:

NPC npc = npcs.closest("Cow"); // Can be a Player instead

int[] splatDamage = npc.accessor.getSplatDamage();
int[] splatTimes = npc.accessor.getSplatTime();

Ok thanks.

Seems hooks are mismatched and time is in getSplatSecondaryType().

But still can use.

Ok thanks.

Seems hooks are mismatched and time is in getSplatSecondaryType().

But still can use.

 

There was an issue with the HitSplatListener (I think that was the name). We used to use it in legacy code a while back, then found a more efficient way. After some time the listener broke, nobody used it, and I believe I either deprecated it or deleted it.

  • Author

There was an issue with the HitSplatListener (I think that was the name). We used to use it in legacy code a while back, then found a more efficient way. After some time the listener broke, nobody used it, and I believe I either deprecated it or deleted it.

If you're interested - hit splat times now in XPlayer.getSplatSecondaryType(). I successfully implemented hit splats tracking using it + XPlayer.getSplatDamage(). Was using HitSplat functionality before (not HitSplatListener tho) but needed to comment when you removed support. Now using again.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.