You could just add in a few lines for slotted items:
int nPercentDrop = d100();
object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
if (nPercentDrop >90)
CreateObject(OBJECT_TYPE_ITEM, GetResRef(oItem), GetLocation(OBJECT_SELF));
object oItem1 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
if (nPercentDrop > 88)
CreateObject(OBJECT_TYPE_ITEM, GetResRef(oItem1), GetLocation(OBJECT_SELF));
object oItem2 = GetItemInSlot(INVENTORY_SLOT_CHEST);
if (nPercentDrop >85)
CreateObject(OBJECT_TYPE_ITEM, GetResRef(oItem2), GetLocation(OBJECT_SELF));
Just make sure the items are not marked as droppable, or you may get two drops. Another thing I do is do a loop on some spawns where it marks an item as droppable from the inventory of the npc.
// ***** ADD ANY SPECIAL ON-SPAWN CODE HERE ***** //
object oItem = GetFirstItemInInventory(OBJECT_SELF);
while (GetIsObjectValid(oItem)&& GetDroppableFlag(oItem)== FALSE)
{
if (d100()>85)
{
SetDroppableFlag(oItem, TRUE);
}
oItem = GetNextItemInInventory(OBJECT_SELF);
}
So sometimes you hit the jackpot though I only put this on npc's with a few items.
Modifié par ffbj, 19 novembre 2011 - 04:01 .