random drop script updated

This commit is contained in:
EpicValor
2023-08-31 00:53:09 -05:00
parent f7ed314414
commit e4b8a47120
6 changed files with 31 additions and 28 deletions

View File

@@ -4,16 +4,19 @@ void main()
object oItem = GetFirstItemInInventory(oNPC);
while (GetIsObjectValid(oItem))
{
// if item set to droppable it will 100% drop
if (GetDroppableFlag(oItem)== TRUE)
{
SetDroppableFlag(oItem, TRUE);
if (GetDroppableFlag(oItem) == TRUE)
{
//items already set as droppable should stay that way
SetLocalInt (oItem, "droppable", 1);
GetNextItemInInventory(oNPC);
}
if (GetLocalInt(oItem, "droppable") == FALSE)
{
//20% chance to drop item inventory not already set as droppable
int bDroppable=d100()>80;
SetDroppableFlag(oItem, bDroppable);
oItem = GetNextItemInInventory(oNPC);
}
//10% chance of item in inventory being droppable if not marked droppable
int bDroppable=d100()>90;
SetDroppableFlag(oItem, bDroppable);
oItem = GetNextItemInInventory(oNPC);
}
}