View Single Post
Old 02-08-2007, 12:26 PM   #2
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 40
Posts: 5,459
Have you considered a DoOnce thing stored on the container? For example,
SetLocalInt(oPC, "openme", 1);
becomes
SetLocalInt(OBJECT_SELF, "openme", 1);
in which case each container only fires the spawnscript once no matter which PC opens it.

Alternatively, change it to something like
SetLocalInt(OBJECT_SELF, "openme"+GetName(oPC), 1);
which results in each container spawn-in firing only once for every PC (or log-in, or cd key, or race, or ...).

Another option is changing the script to work with a variable stored on the container instead of the resref (you'd use something as GetLocalString(oContainer,"SpawnCode") instead of GetResRef(oContainer)).

If the problem lies more in that a bashed container is replaced with a new one, thus providing infinite spawns, you might assign players logging into your module a unique number, use that instead of the PC name to identify who already opened the container, and change the OnDeath script to transfer all openme# variables up to the highest one the module has handed out to the new container which is yet to spawn. A bit more work, but so long as it is the death script spawning the new chests it will work to keep track of who opened what.
Legolas is offline   Reply With Quote