Author Sticky: Post Working Scripts Here
sTuPiD fOoL Posted: Wednesday, 17 July 04:44AM
Script Name: Random Treasure Re-Spawn

What It Does: Basically, after one minute, resets a container's treasure so it can be looted again.

Notes: Bioware's treasure script, with a few lines added. The script, of course, will not re-spawn items placed in the container manually (see my above post for a script to take care of that). I'm sure there's a way to combine the two scripts. Also, it will re-calculate loot regardless of wether not the container's contents were actually looted (it just has to be opened). This, as well, can probably be fixed, but I'm just too lazy.

NWScript:
//General Treasure Re-Spawn Script

//Change the Low in "GenerateLowTreasure" with Medium or High for better quality treasure.

#include "NW_O2_CONINCLUDE"

void main()

{

    if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)

    {

       return;

    }

    object oLastOpener = GetLastOpener();

    GenerateLowTreasure(oLastOpener, OBJECT_SELF);

    ActionDoCommand(SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1));

    ActionWait(60.0);

    ActionDoCommand(SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0));

    ShoutDisturbed();

}