WoR_PRC8/_module/nss/treasure_gan.nss
Jaysyn904 b5e28e52f4 Initial commit
Initial commit [1.18]
2025-04-03 11:49:34 -04:00

64 lines
2.7 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 = 600.00;
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
{
return;
}
object oLastOpener = GetLastOpener();
GenerateLowTreasure(oLastOpener, OBJECT_SELF);
{int nRandom = d8(1);
int nTreasureType = 1;
if (nRandom == 1){
CreateItemOnObject("NW_WSWBS001", OBJECT_SELF, 1);
CreateItemOnObject("NW_AARCL004", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 60);}
else if (nRandom == 2){
CreateItemOnObject("NW_WSWBS001", OBJECT_SELF, 1);
CreateItemOnObject("NW_AARCL004", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 67);}
else if (nRandom == 3){
CreateItemOnObject("NW_WSWBS001", OBJECT_SELF, 1);
CreateItemOnObject("NW_AARCL004", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 70);}
else if (nRandom == 4){
CreateItemOnObject("NW_WSWBS001", OBJECT_SELF, 1);
CreateItemOnObject("NW_AARCL004", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 88);}
else if (nRandom == 5){
CreateItemOnObject("NW_WSWBS001", OBJECT_SELF, 1);
CreateItemOnObject("NW_AARCL004", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 92);}
else if (nRandom == 6){
CreateItemOnObject("NW_WSWBS001", OBJECT_SELF, 1);
CreateItemOnObject("NW_AARCL004", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 98);}
else if (nRandom == 7){
CreateItemOnObject("NW_WSWBS001", OBJECT_SELF, 1);
CreateItemOnObject("NW_AARCL004", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 106);}
else if (nRandom == 8){
CreateItemOnObject("wswbs002", OBJECT_SELF, 1);
CreateItemOnObject("aarcl005", OBJECT_SELF, 1);
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 118);}}
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
ShoutDisturbed();
//create Gan's Sword Sheath.
CreateItemOnObject("item063", OBJECT_SELF, 1);
// Command added to delay the <span class="highlight">respawn</span>
AssignCommand( OBJECT_SELF, DelayCommand (respawntime, SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0) ) );
}