// Treasure Chest #include "NW_O2_CONINCLUDE" void main() { object oItem = OBJECT_INVALID; // Clear all contents of the chest oItem = GetFirstItemInInventory(); while ( oItem != OBJECT_INVALID ) { //Make sure people don't stuff chest 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 = 600.00; if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0) { return; } object oLastOpener = GetLastOpener(); GenerateLowTreasure(oLastOpener, OBJECT_SELF); {int nRandom = d12(1); if (nRandom == 1){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 2);} else if (nRandom == 2){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 8);} else if (nRandom == 3){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 14);} else if (nRandom == 4){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 20);} else if (nRandom == 5){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 26);} else if (nRandom == 6){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 32);} else if (nRandom == 7){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 39);} else if (nRandom == 8){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 45);} else if (nRandom == 8){ CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 52);} else if (nRandom == 10){ GenerateMediumTreasure(oLastOpener, OBJECT_SELF); CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 64);} else if (nRandom == 11){ GenerateMediumTreasure(oLastOpener, OBJECT_SELF); CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 71);} else if (nRandom == 12){ GenerateMediumTreasure(oLastOpener, OBJECT_SELF); CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 78);}} SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1); ShoutDisturbed(); // Command added to delay the respawn AssignCommand( OBJECT_SELF, DelayCommand (respawntime, SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0) ) ); }