Author: SirLestat
Author Website: n/a
Script Name: Secret Door
Description: Here is my secret door script, big thanks to everyone on this board that provided me a basic script to start with.  
Instructions on Use:
  1. First you need to make a custom trap door. Use the Placable Wizard to create a new placable. Edit it's proprieties, change Appearance Type to "Trap Door", check the "Usable" checkbox, change the Tag to "trapdoor" and set the "OnUsed" script event to "use_trap"
  2. Create a generic trigger where you want the trap to be detectable. Set it's tag to "TheName_XX". TheName can be anything you choose and XX must be remplace by the DC of the search check. Example: you want to make a trapdoor named Trap1 with a search check DC20 then set it's tag to "Trap1_20". (It must be 2 digits, so that same trap with DC5 would be Trap1_05) Set the "OnEnter" script event to "create_trap".
  3. Create a WP where you want the trap to appear. Set it's tag to "WP_S" + the name of the trigger without the last part. In our example it would be "WP_STrap1" (WP_S stands for Waypoint Source, it can be changed easily in the script)
  4. Create a WP where you want the player to be taken when it use the trap door and set it's tag to "WP_D" + the name of the trigger without the last part. Again in our example it would be "WP_DTrap1" (WP_D stands for Waypoint Destination, again it can be changed easily)

Script 1:

//CreateTrap Script

void main()
{
    object oPC = GetEnteringObject();
    if(!GetIsPC(oPC)) return; // Return if not PC
    string selfTag = GetTag(OBJECT_SELF);  
    int difficulty = StringToInt(GetStringRight(selfTag, 2)); // Get the last 2 digits from the Tag to be used as skill check
    string myName = GetStringLeft(selfTag, GetStringLength(selfTag) - 3); // The name of the trap (without _XX which is the difficulty)
    object oWP = GetObjectByTag("WP_S" + myName);
    if(!GetIsObjectValid(oWP)) return; // Return if we can't get that WP
    int skillcheck = d20();
      if(skillcheck != 20 &&  // Return if player fail the skill check (20 always success)
       GetSkillRank(SKILL_SEARCH, oPC) + skillcheck < difficulty) return;
    SendMessageToPC(oPC, "You've found something...");
       object oTrap = CreateObject(OBJECT_TYPE_PLACEABLE, "trapdoor", GetLocation(oWP), TRUE); // Create the trap at the source WP and set it's destination WP
    SetLocalString(oTrap, "DestinationWP", "WP_D" + myName);// Delete the trigger used to create the trap
        DestroyObject(OBJECT_SELF);
}

Script 2:

//UseTrap Script

void main()
{
    object oPC = GetLastUsedBy();
    if(!GetIsPC(oPC)) return; // Return if not PC
    // Get the Destination WP Tag
    string wpTag = GetLocalString(OBJECT_SELF, "DestinationWP");
    object oTarget = GetWaypointByTag(wpTag);
    if(!GetIsObjectValid(oTarget)) return; // Return if we can't get the WP
    // Send the PC to the destination WP
    AssignCommand(oPC, JumpToObject(oTarget));
}