Gas Trap between 2 doors

Gas Trap between 2 doors
Generic Trigger on enter script

What it does: PC or Creature stepping onto trigger is checked for a key.

If No key, closes both doors, locks em, and starts filling area between them with Poison Gas (Also informs PCs of whats going on)

If got Key, Trap is delayed by 30 seconds, PC informed that key Glows and Hums, then informed when trap goes off. // Gas Trap in Hall or Small Room between 2 Doors // // Place on a generic trigger "On Enter" script // // Other Items Required: // 2 Doors Tag "GasTrap1" and "GasTrap2" // 2 Waypoints Tag "waypt1" and "waypt2" // 1 Placeable Invisible object Tag "DoorLocker" in vicinity of 2 doors // 1 or more Keys that the players can find Tag "GasTrapKey" // // By Mordrake of COR // 17 Sept 02 // Lots of help from: // Wolfe13, IceBerg , Tcoz , tjm // // Note: if you want this trap to spawn gas that can harm Monsters as well, edit factions to have a // "Placeable" faction, which is hostile towards them. Then set the trigger for this trap to // faction "Placeable". // void RunTrap(float fDelay = 0.0); void main {   object oPC          = GetEnteringObject; object oDoorLocker = GetObjectByTag("DoorLocker"); object oKeyCheck; string sMessage1   = "The Skull Key you have glows bright green and humms softly"; float fDelay       = 30.0; // Ammount in seconds to wait before setting off // trap for PC or Monster with key // This will keep the trap from being set off again while it is set off and while // the PC or Monster has the key if ((GetLocalInt(oDoorLocker, "Triggered") != 1) || // This is an "OR" this || that       GetLocalInt(oDoorLocker, "HasKey") != 1)        // If either side is true it will {                                                  // run the "if" line oKeyCheck = GetItemPossessedBy(oPC, "GasTrapKey"); if (oKeyCheck != OBJECT_INVALID) // PC or Monster has key {           SetLocalInt(oDoorLocker, "HasKey", 1); SetLocalInt(oDoorLocker, "NoDelay", 0); RunTrap(fDelay); // run delay (fDelay) // Inform PC key has prevented trap from triggering AssignCommand(oPC, SpeakString(sMessage1, TALKVOLUME_TALK)); }       else  // Entering object doesn't have key - run trap no delay {           SetLocalInt(oDoorLocker, "NoDelay", 1); RunTrap; }   }    else // One of the ints has been set. Either the trap is already triggered, // or the object with the key is in the house :lol: {       SetLocalInt(oDoorLocker, "NoDelay", 1); RunTrap; } } void RunTrap(float fDelay) {   //// Trap varables //// // Gas effect can be changed with "NW_T1_GasDeadC1", "NW_T1_GasAvgC1" or   // "NW_T1_GasMinoC1" effect eTrap       = EffectAreaOfEffect (AOE_PER_FOGACID, "NW_T1_GasStrC1"); // Gas stays for 6 seconds times this number int nCastDuration  = 20; // Float for delaying of the int float fCastDur     = IntToFloat(nCastDuration); // Re-define entering object and set up string to inform of trap going off object oPC         = GetEnteringObject; string sMessage2   = "Green Gas starts to billow from two vents on the floor!"; // Gas eminates from these 2 waypoints........... location lTrap1    = GetLocation (GetWaypointByTag ("waypt1")); location lTrap2    = GetLocation (GetWaypointByTag ("waypt2")); // The 2 doors that lock you in this area object oDoor1      = GetObjectByTag ("GasTrap1"); object oDoor2      = GetObjectByTag ("GasTrap2"); // Defines invisible object tagged "DoorLocker" to code for use to   // close the doors object oDoorLocker = GetObjectByTag("DoorLocker"); // This sets off gas at the 2 waypoints DelayCommand(fDelay, ApplyEffectAtLocation ( DURATION_TYPE_TEMPORARY, eTrap, lTrap1, RoundsToSeconds ( nCastDuration))); DelayCommand(fDelay, ApplyEffectAtLocation ( DURATION_TYPE_TEMPORARY, eTrap, lTrap2, RoundsToSeconds( nCastDuration))); SetLocalInt(oDoorLocker, "Triggered", 1); // Tells the invisible object to close doors DelayCommand(fDelay, AssignCommand(oDoorLocker, ActionCloseDoor(oDoor1))); DelayCommand(fDelay, AssignCommand(oDoorLocker, ActionCloseDoor(oDoor2))); // Has invisible object tell PCs about the gas vents opening DelayCommand(fDelay, AssignCommand(oPC, SpeakString(sMessage2, TALKVOLUME_TALK))); // Locks both the now Closed doors trapping the hapless PC's in with the Gas MUHAHAHA DelayCommand(fDelay, SetLocked(oDoor1, TRUE)); DelayCommand(fDelay, SetLocked(oDoor2, TRUE)); // If there was a casting delay then use the delay comm with both delays if (GetLocalInt(oDoorLocker, "NoDelay") != 1) {  // Ok this will delay 150secs long enough for casting delay and fdelay // Then the int will be set to 0 and the trap will reset. DelayCommand((fDelay + fCastDur), SetLocalInt(oDoorLocker, "Triggered", 0)); }   // If there was not a delay just use the length of the gas as the delay else {       DelayCommand(fCastDur, SetLocalInt(oDoorLocker, "Triggered", 0)); } }

How I used it
I placed a section of hallway just inside a large cave complex.. the first door in the hall starts of unlocked and is extreamly hard to Pick or Break Down.

Between that door and the next (Which starts off locked(not too hard) and trapped (not that difficult either), is the Trigger, 2 waypoints used for the Gas to come from, and the invisible object used to close the doors.

This set up almost makes the hallway a "One Way" into the caverns untill the Party finds a key.

You can make it a true "One Way" by making the first door "Plot" and unpickable.