// includes coninclude so functions can be called
#include "NW_O2_CONINCLUDE"
void main()
{
// Check to see if the chest has already been opened
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
{
return;
}
// Get the PC who opened the chest
object oLastOpener = GetLastOpener();
// Generate treasure in the chest based on the PC who opened it
GenerateMediumTreasure(oLastOpener, OBJECT_SELF);
// Set a variable that teh chest has been opened
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
// Let guards know the chest has been opened
ShoutDisturbed();
}