It took me a while to figure out how to make this work, but now it works like a charm as far as I have tested. This will allow you to adjust decay timers per NPC. This is mainly useful in cases where an NPC would normally have no loot at all. I will be using it in my experience only zone as well as on any quest spawned adds that have no loot. It should reduce client lag as well as maybe help server load slightly.
Code:
#Adjustable Corpse Decay Timer Script
#Decay Timer Is in Milliseconds
#This will only work on Empty corpses
my $entity_id;
sub EVENT_SPAWN {
$entity_id=$npc->GetID();
}
sub EVENT_DEATH {
my $corpse_id = $entity_list->GetCorpseByID($entity_id);
if ($corpse_id->IsEmpty()) {
my $corpse_decay = $corpse_id->CastToCorpse();
$corpse_decay->SetDecayTimer(5000); }
}
This could possibly even be used in the global quest file, but I think it would be better if we can get something that does this added directly into the source. It would be awesome to have a rule to set globally for decay timers on empty corpses.
Please give feedback on this script if you try it and find that there are any issues with it.