Changed folder name.
Changed folder name.
This commit is contained in:
37
_module/nss/journalspawn3.nss
Normal file
37
_module/nss/journalspawn3.nss
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
// Replenish chect only once every 20 seconds
|
||||
// Check if we already have enough gold (will be FALSE the first time through)
|
||||
int bAlreadyHaveGold = GetLocalInt (OBJECT_SELF, "ALREADY_HAVE_GOLD");
|
||||
if (!bAlreadyHaveGold)
|
||||
{
|
||||
// Can replenish, so do it now
|
||||
// If there is any gold there already, don't create any more
|
||||
object oItem = GetFirstItemInInventory (OBJECT_SELF);
|
||||
int bFoundGold = FALSE;
|
||||
while (GetIsObjectValid (oItem))
|
||||
{
|
||||
if (GetBaseItemType (oItem) == BASE_ITEM_MISCMEDIUM)
|
||||
{
|
||||
// Found some gold in the chest !!
|
||||
bFoundGold = TRUE;
|
||||
break;
|
||||
}
|
||||
oItem = GetNextItemInInventory (OBJECT_SELF);
|
||||
}
|
||||
// Check if no gold found
|
||||
if (!bFoundGold)
|
||||
{
|
||||
// Put 20 gp into the chest's inventory
|
||||
object oItem = CreateItemOnObject ("roguesjournal", OBJECT_SELF, 1);
|
||||
// We have created the gold, so say we have enough
|
||||
SetLocalInt (OBJECT_SELF, "ALREADY_HAVE_GOLD", TRUE);
|
||||
// Only allow more gold in 20 secs
|
||||
float fSecsToDelay = 600.0;
|
||||
DelayCommand (fSecsToDelay, SetLocalInt (OBJECT_SELF, "ALREADY_HAVE_GOLD", FALSE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user