void main()
{
    object oPC = GetLastUsedBy();
    object oChain = OBJECT_SELF;
    object oDoor = GetObjectByTag("BackDoor");
    object oSathan = GetObjectByTag("Sathan");
    object oDoor1 = GetObjectByTag("MetalDoor1");
    object oDoor2 = GetObjectByTag("MetalDoor2");
    object oDoor3 = GetObjectByTag("MetalDoor3");
    object oDoor4 = GetObjectByTag("MetalDoor4");
    effect eKnock = EffectVisualEffect(VFX_IMP_KNOCK);
    effect eExplode = EffectVisualEffect(VFX_DUR_CALTROPS);
    location lPC = GetLocation(GetWaypointByTag("PC_MOVE_SATHAN"));
    location lMove = GetLocation(GetWaypointByTag("SATHAN_RUN_HERE"));
    location lFX1 = GetLocation(GetWaypointByTag("WP_KNOCK1"));
    location lFX2 = GetLocation(GetWaypointByTag("WP_KNOCK2"));
    location lFX3 = GetLocation(GetWaypointByTag("WP_KNOCK3"));
    location lFX4 = GetLocation(GetWaypointByTag("WP_KNOCK4"));
    location lFX5 = GetLocation(GetWaypointByTag("WP_KNOCK5"));
    location lExplode = GetLocation(GetWaypointByTag("WP_EXPLOSION"));
          // If not good to go...
    if (!GetLocalInt(oPC, "ChainUsable") == TRUE){
        PlaySound("as_dr_locked3");
        ActionSpeakString("This chain appears to do nothing.");
    }
          // If they can use the pullchain...
    if (GetLocalInt(oPC, "ChainUsable") == TRUE) {
       AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 0.5, 0.5));
       ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE, 0.5, 0.5);
       SetPlotFlag(oDoor, FALSE);
       ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lExplode, 1.0f);
       DestroyObject(oDoor);
       //SetLocalInt(oPC, "SathanAttacked", TRUE);
       DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eKnock, lFX1, 1.0f));
       DelayCommand(1.0, SetLocked(oDoor1, FALSE));
       DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eKnock, lFX2, 1.0f));
       DelayCommand(1.0, SetLocked(oDoor2, FALSE));
       DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eKnock, lFX3, 1.0f));
       DelayCommand(1.0, SetLocked(oDoor3, FALSE));
       DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eKnock, lFX4, 1.0f));
       DelayCommand(1.0, SetLocked(oDoor4, FALSE));
       DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eKnock, lFX5, 1.0f));
       DelayCommand(1.5, AssignCommand(oPC, ClearAllActions()));
       DelayCommand(1.5, AssignCommand(oPC, ActionForceMoveToLocation(lPC, TRUE)));
       DelayCommand(2.0, AssignCommand(oSathan, ActionMoveToLocation(lMove, TRUE)));
       DelayCommand(2.0, AssignCommand(oSathan, ActionSpeakString("You have been getting too close! I'm sorry, but I cannot allow you to live.")));
       DelayCommand(3.0, AdjustReputation(oPC, oSathan, -100));
       DelayCommand(3.4, AssignCommand(oSathan, ActionAttack(GetFirstPC())));
       DelayCommand(4.5, DestroyObject(oDoor1));
       DelayCommand(4.5, DestroyObject(oDoor2));
       DelayCommand(4.5, DestroyObject(oDoor3));
       DelayCommand(4.5, DestroyObject(oDoor4));
       }
}
