@Mokrocaan You can do what Nbacon did if you don't care about picking up other peoples loot they left. But if you want to only pick up your loot, then store the tile the npc health percent == 0 is and then check that tile is != null and if it contains items you want to loot, loot. Else make the tile == null so it can attack another monster. Can look something like this. Also if you haven't look into conditional sleeps.
if (lootTile != null) {
if (items I want exist at tile) {
loot the tile
} else {
lootTile == null;
}
} else {
find and attack the next monster
}