int FlipSwitch(object oLever = OBJECT_SELF)
{
if (GetLocalInt(OBJECT_SELF, "nToggle") == 0)
 {
 PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE, 1.0, 1.0);
 SetLocalInt(OBJECT_SELF, "nToggle", 1);
 return TRUE;
 }
else
 {
 PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE, 1.0, 1.0);
 SetLocalInt(OBJECT_SELF, "nToggle", 0);
 return FALSE;
 }
}

void main()
{
object oPC = GetLastUsedBy();

if (!(GetLocalInt(oPC, "DisarmChessboard") == 1)) return;

if (FlipSwitch())
 {
 // Teleport PC back to other levers
 object oTarget = GetWaypointByTag("WP_Levers");
 location lTarget = GetLocation(oTarget);
 oTarget=GetFirstFactionMember(oPC, FALSE);
 while (GetIsObjectValid(oTarget))
   {
   AssignCommand(oTarget, ClearAllActions());
   DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oPC));
   DelayCommand(2.5, AssignCommand(oTarget, ActionJumpToLocation(lTarget)));
   oTarget=GetNextFactionMember(oPC, FALSE);
   }
 }

else return;

}
