A method I came up with to respawn traps, without having to script an entire system. The application was a unique area, so this suited our need. Posting here just in case anyone else finds it useful.
'>
/*
t_ent_trap_wrapr
A script to use as a wrapper for permanent traps, enabling them to be disabled
for a set period of time, then turned back on, so multiple entries by PC's
don't spam trap triggering. Implementation is create trap that is NOT Disarmable,
NOT detectable, and NOT single shot. Draw a generic trigger (with this script in
the on_enter handle) closely around the trap trigger. Make sure that the closest
(trap) trigger is the one you are trying to control (e.g. watch your spacing).
A default time of 10 minutes (600 seconds) is preprogrammed into the script.
To change the delay setting, set a LocalFloat named "Delay" to whatever value you wish.
The net effect is to have individually re-spawning traps.
*/
// Put this script OnEnter.
void main()
{
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
object oTrap = GetNearestObject(OBJECT_TYPE_TRIGGER);
// Only fire for (real) PCs.
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
return;
// If the wrapper has not been entered yet, set a varaible on the wrapper to
// keep subsequent entries from triggerig the trap
if (GetLocalInt(OBJECT_SELF, "TRAP_ACTIVE") == 0)//0 means yes, it is active
{
if (GetLocalFloat(OBJECT_SELF, "Delay") == 0.0)
{
SetLocalFloat(OBJECT_SELF, "Delay", 600.0);
}
SetLocalInt(OBJECT_SELF, "TRAP_ACTIVE", 1);
DelayCommand(GetLocalFloat(OBJECT_SELF, "Delay"), SetLocalInt(OBJECT_SELF, "TRAP_ACTIVE", 0));
}
else
{
// Set it to inactive
SetTrapActive (oTrap, FALSE);
DelayCommand (GetLocalFloat(OBJECT_SELF, "Delay"), SetTrapActive (oTrap, TRUE));
}
}