@4BOLTMAIN
EDIT: I just looked at your script again, and it looks like you are trying to place any items carried by a creature directly onto a PC that kills it. Is that what you actually want?
If it is this, then that is a bit more complicated and reminds me of the issues I had when I designed my own creature OnDeath routines. I ended up having to jump through some loops to get what I was after, but eventually achieved it. I think some of the design I used may help you here too. It involved firing another script that handled the copying of the items involved, and may well require more work than first realised, especially when trying to do it to the OC scripts.
I would look at placing SetLootable FALSE on creatures prior any death. I.e. on their OnSpawn script.
It’s been a while since I have had to work much with the OnDeath, but I recall there being some other things you have to consider regarding the way creatures drop their “treasure”.
Also, your script implies you are being more specific about what is dropped than stopping it completely, perhaps?
Basically, however, (as others have alluded to also) I believe you need to address this at time of spawn, unless these creatures acquire other gear after spawning. If so, then you should be able to do something like you do for their OnDeath … but do not delay this function in any way or it will have “dropped” before being destroyed.
I quickly copied and pasted an edited version of my own function from my own monster on death … Sorry if it looks a bit messy. (I tidied it a bit.) This function QuickFix is called without any delay. NB: It addresses creature items that somehow turned droppable and items I had already assigned as non-drop.
If you wanted to destroy everything, then just remove the condition check.
////////////////////////////////////////////////////////////////////////////////////////////
// FIX CREATURE ITEMS TURNING DROPPABLE WHEN PLACED IN AREA - CANNOT BELIEVE IT!
// NEEDED HERE TO IN CASE CREATURE POLYMORPHED BEFORE IT DIED!
////////////////////////////////////////////////////////////////////////////////////////////
void QuickFix();
void QuickFix()
{
object oItem = GetFirstItemInInventory(OBJECT_SELF);
while(oItem != OBJECT_INVALID)
{
int iDESTROY = GetBaseItemType(oItem);
// THIS MAY BE SUPERFLUOUS NOW AS I SORTED THE ONSPAWN BETTER NOW
if((iDESTROY > 68 && iDESTROY < 74) || GetDroppableFlag(oItem) == FALSE)
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.01, FALSE);
}
oItem = GetNextItemInInventory(OBJECT_SELF);
}
}