- Thread Author
- #1
Currently using this to delay until the npc is dead:
It works fine, except it's too slow. Between the time that it dies and the time that it becomes invalid, there's a lag (about 1-3 seconds).
I tried doing this instead:
and it improves things a bit, but after some time nearestNpc.getHealthGauge().getPercent() throws a null pointer exception. This happens even if I null check it!
So I was wondering if anyone knows of the fastest way to check when an NPC is dead?
Code:
if (nearestNpc.interact("Attack")) {
Execution.delayUntil(() -> !nearestNpc.isValid(), () -> false, 10, 60000, 70000);
}
It works fine, except it's too slow. Between the time that it dies and the time that it becomes invalid, there's a lag (about 1-3 seconds).
I tried doing this instead:
Code:
if (nearestNpc.interact("Attack")) {
Execution.delayUntil(() -> nearestNpc.getHealthGauge().getPercent() == 0, () -> false, 10, 60000, 70000);
}
and it improves things a bit, but after some time nearestNpc.getHealthGauge().getPercent() throws a null pointer exception. This happens even if I null check it!
So I was wondering if anyone knows of the fastest way to check when an NPC is dead?