40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
#include "NW_O2_CONINCLUDE"
|
|
void main()
|
|
{
|
|
// Set respawntime float to the number of seconds.
|
|
float respawntime = 1200.00;
|
|
|
|
// checks to see if it's already been opened
|
|
// ends the script if it has
|
|
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
object oLastOpener = GetLastOpener();
|
|
int nOpenerLevel = GetHitDice(oLastOpener);
|
|
|
|
// this checks the opener's level
|
|
// a crappy book is spawned if over level 10
|
|
if (nOpenerLevel > 10) {
|
|
CreateItemOnObject("thestoryofxertlt");
|
|
} else {
|
|
// the quality of treasure.
|
|
// I use HighTreasure for large chests, MediumTreasure
|
|
// for small chests, and LowTreasure for barrels
|
|
GenerateHighTreasure(oLastOpener, OBJECT_SELF);
|
|
}
|
|
|
|
// a local variable is set to 1 to let the script know
|
|
// it's been opened
|
|
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
|
|
|
|
// I think this lets all monsters of its faction know
|
|
// it's been opened. I don't use it
|
|
ShoutDisturbed();
|
|
|
|
// Command added to delay the <span class="highlight">respawn</span>
|
|
AssignCommand( OBJECT_SELF, DelayCommand (respawntime, SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0) ) );
|
|
}
|
|
|