410 lines
11 KiB
Plaintext
410 lines
11 KiB
Plaintext
|
//::///////////////////////////////////////////////
|
||
|
//:: FileName: bs_07_inc_rksys
|
||
|
//:: Copyright (c) 2001 Bioware Corp.
|
||
|
//:://////////////////////////////////////////////
|
||
|
/*
|
||
|
This is the include for the functions that randomly drop
|
||
|
items form a creature's inventory
|
||
|
*/
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Created By: ruelk
|
||
|
//:: Created On: 04/15/04
|
||
|
//:: Modified By: Stealth
|
||
|
//:: Modified On: 07/11/04
|
||
|
//:: Modification: Changed priority to first check for PlotFlag followed by
|
||
|
//:: "_ND". Also added else if so that the nDropRate function would not fire
|
||
|
//:: independent of the PlotFlag. Also fixed object item references in code: oItem to item
|
||
|
//:: and several other coding errors (like the formula to set nDropRate)
|
||
|
//:: Modified By: rdjparadis
|
||
|
//:: Modified On: 01/01/05
|
||
|
//:: Modification: Added SetItemCursedFlag(item,false) for when an item is dropped from an NPC
|
||
|
//:://////////////////////////////////////////////
|
||
|
|
||
|
/////////////////////////////////////////////////
|
||
|
/*This is the function used in a creatures ondeath handler it goes through
|
||
|
the creatures worn items and randomly decides if the item should be dropped.
|
||
|
If the item is marked plot it will always drop (100% chance). If the item is marked as
|
||
|
no-drop in the tag ("_ND") it will never drop. If the item is marked as droppable,
|
||
|
it will be dropped 10% of the time. Items not marked as droppable will never drop.*/
|
||
|
/////////////////////////////////////////////////
|
||
|
|
||
|
void DropTreasure()
|
||
|
{
|
||
|
object item;
|
||
|
// int nDropVar=GetLocalInt(item,"No_Drop");
|
||
|
int nDropRate=GetLocalInt(GetArea(OBJECT_SELF),"Drop_Chance");
|
||
|
if (nDropRate<1)
|
||
|
{nDropRate=10;}
|
||
|
|
||
|
// location lLoc = GetLocation(OBJECT_SELF);
|
||
|
// string sCol = "Creature_Drop";
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_ARMS);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// This next line was the former if statement, I just changed it before I sent it to you -- Chokra
|
||
|
// The if immediately below is the one currently running on the PW
|
||
|
// There are several others like this throughout this script I've updated just before sending this to you, Rdj
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
SetItemCursedFlag(item,FALSE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_ARROWS);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_BELT);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_BOLTS);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_BOOTS);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_BULLETS);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_CHEST);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_CLOAK);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_HEAD);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_LEFTHAND);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_LEFTRING);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_NECK);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if (Random(100)<=nDropRate)
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetItemInSlot(INVENTORY_SLOT_RIGHTRING);
|
||
|
if (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
ActionUnequipItem(item);
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item = GetFirstItemInInventory();
|
||
|
while (item != OBJECT_INVALID)
|
||
|
{
|
||
|
// if ((GetPlotFlag(item)==TRUE))
|
||
|
if ((GetPlotFlag(item)==TRUE)&&(GetDroppableFlag(item)==TRUE))
|
||
|
{
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
item=GetNextItemInInventory();
|
||
|
}
|
||
|
|
||
|
else if ((GetStringRight(GetTag(item),3)=="_ND") || (GetDroppableFlag(item)!=TRUE))
|
||
|
{item = GetNextItemInInventory();}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
SetDroppableFlag(item,FALSE);
|
||
|
if ((Random(100)<=nDropRate))
|
||
|
{
|
||
|
SetDroppableFlag(item,TRUE);
|
||
|
item=GetNextItemInInventory();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// void main()
|
||
|
// {
|
||
|
// }
|