void main()
{
  int nEvent = GetUserDefinedEventNumber();
  if (nEvent == 1002) // OnPerceive event
  {
    object oPC = GetLastPerceived();
    if(GetIsPC(oPC))
    {
      ClearAllActions();
      ActionCastSpellAtObject(SPELL_DISPEL_MAGIC, oPC, METAMAGIC_ANY, TRUE, 0,PROJECTILE_PATH_TYPE_DEFAULT, FALSE);

    }
  }
}

