int GetNextShieldIndex( object oShield)
{
  int iIndex = GetItemAppearance( oShield, ITEM_APPR_TYPE_SIMPLE_MODEL, 0);
  iIndex--;
  int iItemtype = GetBaseItemType( oShield);

  //shields
  if( iItemtype == BASE_ITEM_SMALLSHIELD)
  {

    if( iIndex == 40)
      iIndex = 33;
    else if( iIndex == 30)
      iIndex = 23;
    else if( iIndex == 20)
      iIndex = 13;
    else if( iIndex == 10)
      iIndex = 43;
  }
  else if( iItemtype == BASE_ITEM_LARGESHIELD)
  {
    if( iIndex == 60)  //1.69 indexes
      iIndex = 56;
    else if( iIndex == 50)
      iIndex = 43;
    else if( iIndex == 40)
      iIndex = 33;
    else if( iIndex == 30)
      iIndex = 23;
    else if( iIndex == 20)
      iIndex = 13;
    else if( iIndex == 10)
      iIndex = 75;
  }
  else if( iItemtype == BASE_ITEM_TOWERSHIELD)
  {

    if( iIndex == 50) //1.69 Indexes
      iIndex = 43;
    else if( iIndex == 40)
      iIndex = 33;
    else if( iIndex == 30)
      iIndex = 23;
    else if( iIndex == 20)
      iIndex = 13;
    else if( iIndex == 10)
      iIndex = 54;
  }
  return iIndex;
}

void main()
{
  object oPlayer = GetPCSpeaker();
  object oShield = GetItemInSlot( INVENTORY_SLOT_LEFTHAND, oPlayer);

  int iIndex = GetNextShieldIndex( oShield);

  if( GetIsDM( oPlayer))
    SendMessageToPC( oPlayer, "The index is: " + IntToString( iIndex));

  object oNewShield = CopyItemAndModify(oShield, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, iIndex, TRUE);

  if( GetIsObjectValid( oNewShield))
  {
    AssignCommand( oPlayer, ActionEquipItem( oNewShield, INVENTORY_SLOT_LEFTHAND));
    DestroyObject( oShield);
  }
  else
    DestroyObject( oNewShield);
}