void main()
{

object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;

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

if (GetLocalInt(oPC, "SafeSquare") == 1) return;

// Assign global variables
int i;
int nSquares = 8;
int nRowNow;
int nColumnNow;
int nRowValid;
int nColumnValid;
string sRowValid;
string sColumnValid;
string sValidTag;
effect eDamage = EffectDamage(5, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
object oBeam = GetObjectByTag("InvisBeam");
effect eBeam = EffectBeam(VFX_BEAM_LIGHTNING, oBeam, BODY_NODE_CHEST, FALSE);

// Get the tag (sPreviousSquare) of the square previously occupied by PC
int nRowPrevious = GetLocalInt(oPC, "RowPC");
int nColumnPrevious = GetLocalInt(oPC, "ColumnPC");
string sRowPrevious = IntToString(nRowPrevious);
string sColumnPrevious = IntToString(nColumnPrevious);
string sPreviousSquare = "R"+sRowPrevious+"C"+sColumnPrevious+"";

// If PC clicked statue from an unsafe square, apply damage and vfx, knock pc back to previous square
  DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oPC, 3.5f));
  DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC));
  DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_HIT_ELECTRICAL), oPC));
  DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_GLOW_RED), oPC, 5.5f));
  DelayCommand(0.5, AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetObjectByTag(""+sPreviousSquare+"")))));
  DelayCommand(1.0, SetCutsceneMode(oPC, TRUE));
  DelayCommand(5.5, AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetNearestObjectByTag("WP_Chess")))));
  DelayCommand(6.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_GLOW_WHITE), oPC, 2.0f));
  DelayCommand(6.5, SetLocalInt(oPC, "RowPC", nRowPrevious));
  DelayCommand(6.5, SetLocalInt(oPC, "ColumnPC", nColumnPrevious));
  DelayCommand(7.0, SetCutsceneMode(oPC, FALSE));

}
