31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
|
// Treasure Chest
|
||
|
#include "NW_O2_CONINCLUDE"
|
||
|
void main()
|
||
|
{
|
||
|
object oItem = OBJECT_INVALID;
|
||
|
// Clear all contents of the <span class="highlight">chest</span>
|
||
|
oItem = GetFirstItemInInventory();
|
||
|
while ( oItem != OBJECT_INVALID )
|
||
|
{
|
||
|
//Make sure people don't stuff <span class="highlight">chest</span> with plot items and break it
|
||
|
SetPlotFlag(oItem, FALSE);
|
||
|
DestroyObject( oItem, 0.0 );
|
||
|
oItem = GetNextItemInInventory();
|
||
|
}
|
||
|
// Set respawntime float to the number of seconds.
|
||
|
float respawntime = 1800.00;
|
||
|
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
object oLastOpener = GetLastOpener();
|
||
|
CreateItemOnObject("bagofjewels", OBJECT_SELF, 1);
|
||
|
DestroyObject(GetItemPossessedBy(oLastOpener, "QWEST_37"));
|
||
|
DestroyObject(GetItemPossessedBy(oLastOpener, "QWEST_37"));
|
||
|
DestroyObject(GetItemPossessedBy(oLastOpener, "QWEST_37"));
|
||
|
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
|
||
|
ShoutDisturbed();
|
||
|
// Command added to delay the <span class="highlight">respawn</span>
|
||
|
AssignCommand( OBJECT_SELF, DelayCommand (respawntime, SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0) ) );
|
||
|
}
|