// Treasure Chest #include "X0_I0_TREASURE" 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); GenerateLowTreasure(oLastOpener, OBJECT_SELF); {int nRandom = d4(1); if (nRandom == 1){ CreateItemOnObject("NW_IT_TORCH001", OBJECT_SELF, 1);} else if (nRandom == 2){ CreateItemOnObject("NW_IT_TORCH001", OBJECT_SELF, 1);}} {int nRandom = d8(1); if (nRandom == 1){ CreateItemOnObject("NW_IT_MPOTION001", OBJECT_SELF, 1);} else if (nRandom == 2){ CreateItemOnObject("NW_IT_MPOTION001", OBJECT_SELF, 1);} else if (nRandom == 3){ CreateItemOnObject("NW_IT_MPOTION001", OBJECT_SELF, 1);} else if (nRandom == 4){ CreateItemOnObject("NW_IT_MPOTION001", OBJECT_SELF, 1);} else if (nRandom == 5){ CreateItemOnObject("NW_IT_MPOTION020", OBJECT_SELF, 1);}} {int nRandom = d6(1); if (nRandom == 1){ CreateItemOnObject("NW_CLOTH023", OBJECT_SELF, 1);} else if (nRandom == 2){ CreateItemOnObject("NW_CLOTH023", OBJECT_SELF, 1);} else if (nRandom == 3){ CreateItemOnObject("NW_CLOTH023", OBJECT_SELF, 1);} else if (nRandom == 4){ CreateItemOnObject("NW_CLOTH023", OBJECT_SELF, 1);} else if (nRandom == 5){ CreateItemOnObject("xanalan_robe2", OBJECT_SELF, 1);} else if (nRandom == 6){ CreateItemOnObject("NW_CLOTH023", OBJECT_SELF, 1);}} {int nRandom = d20(1); if (nRandom == 1){ CreateItemOnObject("NW_IT_SPARSCR112", OBJECT_SELF, 1);} else if (nRandom == 2){ CreateItemOnObject("NW_IT_SPARSCR107", OBJECT_SELF, 1);} else if (nRandom == 3){ CreateItemOnObject("NW_IT_SPARSCR110", OBJECT_SELF, 1);} else if (nRandom == 4){ CreateItemOnObject("NW_IT_SPARSCR103", OBJECT_SELF, 1);} else if (nRandom == 5){ CreateItemOnObject("NW_IT_SPARSCR106", OBJECT_SELF, 1);} else if (nRandom == 6){ CreateItemOnObject("NW_IT_SPARSCR104", OBJECT_SELF, 1);} else if (nRandom == 7){ CreateItemOnObject("NW_IT_SPARSCR109", OBJECT_SELF, 1);} else if (nRandom == 8){ CreateItemOnObject("nw_it_sparscr113", OBJECT_SELF, 1);} else if (nRandom == 9){ CreateItemOnObject("NW_IT_SPARSCR102", OBJECT_SELF, 1);} else if (nRandom == 10){ CreateItemOnObject("NW_IT_SPARSCR111", OBJECT_SELF, 1);} else if (nRandom == 11){ CreateItemOnObject("NW_IT_SPARSCR210", OBJECT_SELF, 1);} else if (nRandom == 12){ CreateItemOnObject("NW_IT_SPARSCR108", OBJECT_SELF, 1);} else if (nRandom == 13){ CreateItemOnObject("NW_IT_SPARSCR105", OBJECT_SELF, 1);}} 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) ) ); }