Simple time-delay chest re-spawner

Simple time-delay chest re-spawner
I have found that in a large module or semi-persistent world that is not DM managed, you need re-spawning everything. This goes for bosses, and plot items, keys, etc. After getting all of this in place, I found that some of the visitors seemed to want to take advantage of re-spawning chests...hmmm...and get a lot of loot for little work.

I had a heck of a time getting DelayAction to work, and after a few hours of trying several different methods (like ActionWait, etc) I found a nearly working script in the archive for delaying the creation of an object.

I hacked it a bit and added some comments, and it works as billed.

The Script
///////////////////////////////////////////////////////////// // Delayed CreateItemOnObject (chest respawner) Script // Created by Phoenix // 09/ 10/ 2002 ///////////////////////////////////////////////////////////// // You cannot delay anything on an object, therefore you must // create a function that performs the same createItem duties // as an action ///////////////////////////////////////////////////////////// //Create a new action function (action) void aCreateItemOnObject(string sItemTemplate, object oTarget=OBJECT_SELF, int nStackSize=1) { //Original CreateitemOnObject script (object, not an action) CreateItemOnObject(sItemTemplate, oTarget=OBJECT_SELF, nStackSize=1); } //Run the Delay script with new function void main { object oObject = GetObjectByTag("object"); DelayCommand(60.0, aCreateItemOnObject("blueprint", oObject, 1)); DelayCommand(60.0, aCreateItemOnObject("blueprint", oObject, 1)); } //////////////////////////////////////////////////////////// // In this case I was re-populating a chest with a key and // some gold without allowing the pc to get rich by // re-opening the chest over and over. This script was // placed in the on-close script slot. My insurance was the // "spawn Monster" trap I had on-open. ////////////////////////////////////////////////////////////