                            /*
 *  Script generated by LS Script Generator, v.TK.0
 *
 *  For download info, please visit:
 *  http://nwvault.ign.com/View.php?view=Other.Detail&id=1502
 */
// Put this script OnUsed.


// Clears all actions and jumps the caller to the provided object.
// (Useful when this needs to be delayed.)
void ClearAndJumpToObject(object oDestination);
void ClearAndJumpToObject(object oDestination)
{
    ClearAllActions();
    JumpToObject(oDestination);
}


void main()
{

    object oTarget;

    // Get the creature who triggered this event.
    object oPC = GetLastUsedBy();

    // Only fire once per PC.


    // If the local int is less than 2.
    if ( GetLocalInt(oPC, "twistedtrig") < 2 )
    {
        // Have text appear over the PC's head.
        SpeakString("The main gate to the tower is locked.");
    }
    else
    {
        // Find the location to which to teleport.
        oTarget = GetWaypointByTag("WP_TwistedInner");

        // Teleport the PC.

        FadeToBlack(oPC);
        DelayCommand(1.0, AssignCommand(oPC, ClearAndJumpToObject(oTarget)));
        DelayCommand(1.1, AssignCommand(oPC, FadeFromBlack(oPC)));
}
}
