WoR_PRC8/_module/nss/treasure_hjalmar.nss

58 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

2025-04-03 11:49:34 -04:00
// 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();
GenerateHighTreasure(oLastOpener, OBJECT_SELF);
GenerateMediumTreasure(oLastOpener, OBJECT_SELF);
GenerateHighTreasure(oLastOpener, OBJECT_SELF);
{
int nRandom = d4(1);
if (nRandom == 1){
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 310);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreateArcaneScroll(OBJECT_SELF, OBJECT_SELF);}
else if (nRandom == 2){
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 470);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreateArcaneScroll(OBJECT_SELF, OBJECT_SELF);
CreateArcaneScroll(OBJECT_SELF, OBJECT_SELF);}
else if (nRandom == 3){
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 521);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreateArcaneScroll(OBJECT_SELF, OBJECT_SELF);
CreateArcaneScroll(OBJECT_SELF, OBJECT_SELF);}
else if (nRandom == 4){
CreateItemOnObject("NW_IT_GOLD001", OBJECT_SELF, 631);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreatePotion(OBJECT_SELF, OBJECT_SELF);
CreateDivineScroll(OBJECT_SELF, OBJECT_SELF);
CreateDivineScroll(OBJECT_SELF, OBJECT_SELF);
CreateArcaneScroll(OBJECT_SELF, OBJECT_SELF);}}
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) ) );
}