Initial upload
Initial upload.
This commit is contained in:
57
_module/nss/itemcleaner.nss
Normal file
57
_module/nss/itemcleaner.nss
Normal file
@@ -0,0 +1,57 @@
|
||||
//=============================================
|
||||
//=============================================
|
||||
//Automatic Item Decay
|
||||
//Written by Gary Blauvelt, Ithalyan of
|
||||
// Grim's Tavern
|
||||
//=============================================
|
||||
//=============================================
|
||||
void main()
|
||||
{
|
||||
//Cleans finds objects that are flagged for decay and counts down the timer
|
||||
//that should have been placed on them.
|
||||
int nDecay;
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
object oItem = GetFirstObjectInArea(oArea);
|
||||
|
||||
while(GetIsObjectValid(oItem))
|
||||
{
|
||||
if(GetObjectType(oItem)==OBJECT_TYPE_ITEM || (GetObjectType(oItem)==64 && GetTag(oItem) == "Body Bag"))
|
||||
{
|
||||
if(GetLocalInt(oItem,"DecayFlag")==0)
|
||||
{
|
||||
//Set Plot Flag Decay here
|
||||
//AssignCommand(oItem,ActionSpeakString("Decay Flag Set"));
|
||||
SetLocalInt(oItem,"DecayFlag",1); //Set the flags that aren't set
|
||||
SetLocalInt(oItem,"DecayTime",50);
|
||||
}
|
||||
else //Count Down
|
||||
{
|
||||
nDecay = GetLocalInt(oItem,"DecayTime");
|
||||
nDecay--;
|
||||
if(nDecay < 1) //DestroyObject the item
|
||||
{
|
||||
if (GetObjectType(oItem)==64)
|
||||
{
|
||||
object oInven = GetFirstItemInInventory(oItem);
|
||||
while(GetIsObjectValid(oInven))
|
||||
{
|
||||
DestroyObject(oInven,0.0);
|
||||
oInven = GetNextItemInInventory(oItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyObject(oItem,0.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//AssignCommand(oItem,ActionSpeakString("Decay Going"));
|
||||
SetLocalInt(oItem,"DecayTime",nDecay);
|
||||
}
|
||||
}
|
||||
}
|
||||
oItem = GetNextObjectInArea(oArea);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user