int prevKills = 0;
int currentKills = 0;
int killsToLoot = 0; //You need to set this at script startup

public boolean checkWarriorDead() {
if (getMyPlayer().getInteracting().getAnimation() == warriorDead && getMyPlayer().isInCombat()) {
currentKills++;
if( (currentKills - prevKills) >= killsToLoot )
{
//do something
prevKills = currentKills;
}
wait(random(200,300));
return true;
}
else {
return false;
}
}