27 lines
894 B
Plaintext
27 lines
894 B
Plaintext
// pile of gold
|
|
void main()
|
|
{
|
|
object oItem=GetFirstItemInInventory(OBJECT_SELF);
|
|
int nCount;
|
|
object oPC;
|
|
if (oItem==OBJECT_INVALID) { DelayCommand(1.0,DestroyObject(OBJECT_SELF)); return; }
|
|
if (GetLocalInt(OBJECT_SELF,"bDecay")==TRUE)
|
|
{ // Decaying turned on
|
|
oPC=GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC,OBJECT_SELF,1,CREATURE_TYPE_IS_ALIVE,TRUE);
|
|
if (!GetIsObjectValid(oPC))
|
|
{ // no PCs nearby
|
|
nCount=GetLocalInt(OBJECT_SELF,"nCount");
|
|
nCount++;
|
|
if (nCount>9)
|
|
{ // one minute passed
|
|
oPC=GetFirstItemInInventory(OBJECT_SELF);
|
|
if (GetIsObjectValid(oPC)) DestroyObject(oPC);
|
|
DelayCommand(1.0,DestroyObject(OBJECT_SELF));
|
|
return;
|
|
} // one minute passed
|
|
else
|
|
{ SetLocalInt(OBJECT_SELF,"nCount",nCount); }
|
|
} // no PCs nearby
|
|
} // Decaying turned on
|
|
}
|