03-08-2008, 05:29 AM 
	
	
	
		CMItems
version 2
Version 2 is an upgrade of CMItems and is now compatible with KCG. Please note that this is made for a 3 person party and will require minor editing to work with 4 people. Also in the screenshot I did some minor code changes to make the background.
  			
		
  			
		
  			
		
  			
		
![[Image: cmitemsv2hc1.png]](http://img125.imageshack.us/img125/2826/cmitemsv2hc1.png) 
	
	
	
	version 2
Version 2 is an upgrade of CMItems and is now compatible with KCG. Please note that this is made for a 3 person party and will require minor editing to work with 4 people. Also in the screenshot I did some minor code changes to make the background.
 Module KCG
  			Code:
module KGC  
 $game_special_elements = {}
 $imported = {}
 $data_states = load_data("Data/States.rxdata")
 $data_system = load_data("Data/System.rxdata")
 end CMItems Scene
  			Code:
#==============================================================================
#  CMItems
#  -----------------------
#  
#  This script is designed to look a bit like the item menu in FF8, it's not all that complex.
#  It should works with all menu systems.  To activate CMItems, replace in scene_menu
#
#  $scene = Scene_Item
#
#  with...
#
#  $scene = Scene_CMItems
#
#
#  Also remember to copy the main script or it will not work
#
#  Thanks for using my script!
#==============================================================================
class Scene_Item
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make help window, item window
    @help_window = Window_ItemD.new
    @item_window = Window_Item.new
    @target_window2 = Window_TargetMenuFalse.new
    # Associate help window
    @item_window.help_window = @help_window
    # Make target window (set to invisible / inactive)
    @target_window = Window_TargetMenu.new
    @target_window.visible = false
    @target_window.active = false
    
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @help_window.dispose
    @item_window.dispose
    @target_window2.dispose
    @target_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @help_window.update
    @item_window.update
    @target_window2.update
    @target_window.update
    # If item window is active: call update_item
    if @item_window.active
      update_item
      return
    end
    # If target window is active: call update_target
    if @target_window.visible
      if @target_window.active
        update_target
        return
      else
        self.cursor_rect.opacity = 0
      end
    return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(0)
      return
    end
    
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If not a use item
      unless @item.is_a?(RPG::Item)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If it can't be used
      unless $game_party.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # If effect scope is an ally
      if @item.scope >= 3
        # Activate target window
        @item_window.active = false
        @target_window.visible = true
        @target_window.active = true
        # Set cursor position to effect scope (single / all)
        if @item.scope == 4 || @item.scope == 6
          @target_window.index = -1
        else
          @target_window.index = 0
        end
      # If effect scope is other than an ally
      else
        # If command event ID is valid
        if @item.common_event_id > 0
          # Command event call reservation
          $game_temp.common_event_id = @item.common_event_id
          # Play item use SE
          $game_system.se_play(@item.menu_se)
          # If consumable
          if @item.consumable
            # Decrease used items by 1
            $game_party.lose_item(@item.id, 1)
            # Draw item window item
            @item_window.draw_item(@item_window.index)
          end
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  def update_target
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # If unable to use because items ran out
      unless $game_party.item_can_use?(@item.id)
        # Remake item window contents
        @item_window.refresh
      end
      # Erase target window
      @item_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If items are used up
      if $game_party.item_number(@item.id) == 0
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If target is all
      if @target_window.index == -1
        # Apply item effects to entire party
        used = false
        for i in $game_party.actors
          used |= i.item_effect(@item)
        end
      end
      # If single target
      if @target_window.index >= 0
        # Apply item use effects to target actor
        target = $game_party.actors[@target_window.index]
        used = target.item_effect(@item)
      end
      # If an item was used
      if used
        # Play item use SE
        $game_system.se_play(@item.menu_se)
        # If consumable
        if @item.consumable
          # Decrease used items by 1
          $game_party.lose_item(@item.id, 1)
          # Redraw item window item
          @item_window.draw_item(@item_window.index)
        end
        # Remake target window contents
        @target_window2.refresh
        # If all party members are dead
        if $game_party.all_dead?
          # Switch to game over screen
          $scene = Scene_Gameover.new
          return
        end
        # If common event ID is valid
        if @item.common_event_id > 0
          # Common event call reservation
          $game_temp.common_event_id = @item.common_event_id
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      # If item wasn't used
      unless used
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end CMItems Windows
  			Code:
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays items in possession on the item screens.
#==============================================================================
class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 60, 320, 420)
    @column_max = 1
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    # Also add weapons and items if outside of battle
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (0 + 0)
    y = index / 1 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays items in possession on the battle screens.
#==============================================================================
class Window_ItemBattle < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 640, 160)
    @column_max = 2
    refresh
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
      self.y = 320
      self.height = 160
      self.back_opacity = 255
    end  
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    # Also add weapons and items if outside of battle
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
#==============================================================================
# ? Window_ItemDescription
#------------------------------------------------------------------------------
# ?This window is shown in a menu for an item description
#==============================================================================
class Window_ItemD < Window_Base
  #--------------------------------------------------------------------------
  # ? Initialize the window
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Verdana"
    self.contents.font.size = 22
  end
  #--------------------------------------------------------------------------
  # ? Set the text and alignment of the text in the window
  #     text  : Text to set in the help window
  #     align : alignment of the text
  #             0-Left-Justify
  #             1-Center
  #             2-Right-Justify 
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
  #--------------------------------------------------------------------------
  # ? Draw an actor's name and status in the help window.
  #     actor : Actor whose name and status will be shown in the help window
  #--------------------------------------------------------------------------
  def set_actor(actor)
    if actor != @actor
      self.contents.clear
      draw_actor_name(actor, 4, 0)
      draw_actor_state(actor, 140, 0)
      draw_actor_hp(actor, 284, 0)
      draw_actor_sp(actor, 460, 0)
      @actor = actor
      @text = nil
      self.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # ? Draw the name of an enemy and its status
  #     enemy : Enemy to use
  #--------------------------------------------------------------------------
  def set_enemy(enemy)
    text = enemy.name
    state_text = make_battler_state_text(enemy, 112, false)
    if state_text != ""
      text += "  " + state_text
    end
    set_text(text, 1)
  end
end
#==============================================================================
# ? Window_Target
#------------------------------------------------------------------------------
# ?This window is shown when the player selects an item that requires 
#   a target in the item menus within the main menu. This window 
#   isn't shown in battle.  It is just a picture
#==============================================================================
class Window_TargetMenuFalse < Window_Base
  #--------------------------------------------------------------------------
  # ? Initialize the Target window
  #--------------------------------------------------------------------------
  def initialize
    super(320, 60, 320, 420)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Verdana"
    self.contents.font.size = 22
    self.z += 10
    @item_max = $game_party.actors.size
    refresh
  end
  #--------------------------------------------------------------------------
  # ? Draw the Target window
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
      x = 60
      y = i * 105
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 30, y + 70)
      draw_actor_name(actor, x, y)
      draw_actor_state(actor, x + 120, y)
      draw_actor_hp(actor, x, y + 24)
      draw_actor_sp(actor, x + 60, y + 44)
    end
  end
end
#==============================================================================
# ? Window_Target
#------------------------------------------------------------------------------
# ?This window is shown when the player selects an item that requires 
#   a target in the item menus within the main menu. This window 
#   isn't shown in battle. This actually shows the targets 
#==============================================================================
class Window_TargetMenu < Window_Selectable
  #--------------------------------------------------------------------------
  # ? Initialize the Target window
  #--------------------------------------------------------------------------
  def initialize
    super(320, 60, 320, 420)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Verdana"  
    self.contents.font.size = 22
    self.z += 10
    @item_max = $game_party.actors.size
    refresh
  end
  #--------------------------------------------------------------------------
  # ? Draw the Target window
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
      x = 4
      y = i * 105
      actor = $game_party.actors[i]
    end
  end
  #--------------------------------------------------------------------------
  # ? Update the position of the cursor rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index <= -2
      self.cursor_rect.set(0, (@index + 10) * 105, self.width - 32, 80)
    elsif @index == -1
      self.cursor_rect.set(0, 0, self.width - 32, @item_max * 105 - 20)
    else
      self.cursor_rect.set(0, @index * 105, self.width - 32, 80)
    end
  end
end KCG Item Grouping
  			Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/????????? ? KGC_ItemGrouping?
#_/----------------------------------------------------------------------------
#_/???????????????????????
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ? ???????? ?
#==============================================================================
module KGC
 ITEM_GROUP_ELEMENTS = ["Field", "Battle", -1, -2, "Drop", 0]
 
 ITEM_GROUP_NAME = ["Field", "Battle", "Weapons", "Armor", "Drops", "All"]
 ITEM_GROUP_HELP = ["Here you find all standard items like usable in the Field",
   "Here you find all items usable specifically for battle",
   "Here you find all Weapons",
   "Here you find all Armor",
   "Here you find all items dropped from monsters and beasts",
   "Here you find all items"]
end
#?????????????????????????????????????????
$imported["ItemGrouping"] = true
$game_special_elements["item_hide"] = $data_system.elements.index("item_hide")
module KGC
 ITEM_GROUP = []
 for i in 0...ITEM_GROUP_ELEMENTS.size
   if ITEM_GROUP_ELEMENTS[i].is_a?(Numeric) && ITEM_GROUP_ELEMENTS[i] <= 0
     ITEM_GROUP[i] = ITEM_GROUP_ELEMENTS[i]
     next
   end
   key = "item_#{i}}"
   $game_special_elements[key] = $data_system.elements.index(ITEM_GROUP_ELEMENTS[i])
   ITEM_GROUP[i] = $game_special_elements[key]
 end
end
class Object
 include KGC
end
#?????????????????????????????????????????
#==============================================================================
# ? Module_RPG
#------------------------------------------------------------------------------
# ?RPG????????
#==============================================================================
module RPG
 class Item
   def usable?
     if $game_party.item_can_use?(self.id)
       return true
     end
     return false
   end
 end
 unless $imported["UsableWeapon"]
 class Weapon
   def usable?
     return false
   end
 end
 end
end
#?????????????????????????????????????????
#==============================================================================
# ? Window_Item
#------------------------------------------------------------------------------
# ??????????????????????????????????????
#==============================================================================
class Window_Item < Window_Selectable
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 alias initialize_KGC_ItemGrouping initialize
 def initialize
   initialize_KGC_ItemGrouping
   unless $game_temp.in_battle
     self.index = -1
     self.active = false
   end
  @column_max = 1
  refresh
  # If in battle, move window to center of screen
  # and make it semi-transparent
  if $game_temp.in_battle
    @column_max = 2
    self.y = 480 - 160
    self.height = 160
    self.width = 640
    self.back_opacity = 255
    self.z = 9999
  end
 end
 #--------------------------------------------------------------------------
 # ? ?????
 #     index : ????ID
 #     type  : ??(0:????  1:??  2:??)
 #--------------------------------------------------------------------------
 def hide?(index, type = 0)
   case type
   when 0  
     elements = $data_items[index].element_set.dup
   when 1  
     elements = $data_weapons[index].element_set.dup
   when 2  
     elements = $data_armors[index].guard_element_set.dup
   end
   return elements.include?($game_special_elements["item_hide"])
 end
 #--------------------------------------------------------------------------
 # ? ??????????????
 #     itemkind : ???????
 #--------------------------------------------------------------------------
 def itemlist(itemkind)
   @data = []
   unless $game_temp.in_battle
     if ITEM_GROUP[itemkind] == 0
       for i in 1...$data_items.size
         if $game_party.item_number(i) > 0 && !self.hide?(i, 0)
           @data.push($data_items[i])
         end
       end
       for i in 1...$data_weapons.size
         if $game_party.weapon_number(i) > 0 && !self.hide?(i, 1)
           @data.push($data_weapons[i])
         end
       end
       for i in 1...$data_armors.size
         if $game_party.armor_number(i) > 0 && !self.hide?(i, 2)
           @data.push($data_armors[i])
         end
       end
     elsif ITEM_GROUP[itemkind] == -1
       for i in 1...$data_weapons.size
         if $game_party.weapon_number(i) > 0 && !self.hide?(i, 1)
           @data.push($data_weapons[i])
         end
       end
     elsif ITEM_GROUP[itemkind] == -2
       for i in 1...$data_armors.size
         if $game_party.armor_number(i) > 0 && !self.hide?(i, 2)
           @data.push($data_armors[i])
         end
       end
     else
       for i in 1...$data_items.size
         if $game_party.item_number(i) > 0 && !self.hide?(i, 0) &&
             $data_items[i].element_set.include?(ITEM_GROUP[itemkind])
           @data.push($data_items[i])
         end
       end
     end
   else
     for i in 1...$data_items.size
       if $game_party.item_number(i) > 0 && !self.hide?(i, 0)
         @data.push($data_items[i])
       end
     end
     for i in 1...$data_weapons.size
       if $game_party.weapon_number(i) > 0 && !self.hide?(i, 1) && $data_weapons[i].usable?
         @data.push($data_weapons[i])
       end
     end
   end
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #     itemkind : ???????
 #--------------------------------------------------------------------------
 def refresh(itemkind = 0)
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   self.itemlist(itemkind)
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     for i in 0...@item_max
       draw_item(i)
     end
   end
 end
 #--------------------------------------------------------------------------
 # ? ?????
 #     index : ????
 #--------------------------------------------------------------------------
 def draw_item(index)
   item = @data[index]
   case item
   when RPG::Item
     number = $game_party.item_number(item.id)
   when RPG::Weapon
     number = $game_party.weapon_number(item.id)
   when RPG::Armor
     number = $game_party.armor_number(item.id)
   end
   if (item.is_a?(RPG::Item) && item.usable?) ||
       ($game_temp.in_battle && item.is_a?(RPG::Weapon) && item.usable?)
     self.contents.font.color = normal_color
   else
     self.contents.font.color = disabled_color
   end
   x = 4
   if $game_temp.in_battle
    x = 4 + index % 2 * (0 + 0)
  end
   if $game_temp.in_battle
     y = index / 2 * 32
   else
     y = index * 32
   end 
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
   self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
 end
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
 end
end
#?????????????????????????????????????????
#==============================================================================
# ? Window_ItemGroup
#------------------------------------------------------------------------------
# ????????????????????????
#==============================================================================
class Window_ItemGroup < Window_Selectable
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 640, 60)
   self.contents = Bitmap.new(width - 32, height - 32)
   @commands = []
   for name in ITEM_GROUP_NAME
     @commands.push(name)
   end
   @item_max = @commands.size
   @column_max = @commands.size
   @item_width = (width - 32) / @commands.size
   self.index = 0
   self.opacity = 0
   refresh
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def refresh
   for i in 0...@commands.size
     rect = Rect.new(@item_width * i, 0, @item_width, 32)
     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
     self.contents.font.color = system_color
     self.contents.draw_text(rect, @commands[i], 1)
   end
 end
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def update_cursor_rect
   if index != -1
     self.cursor_rect.set(@item_width * index, 0, @item_width, 32)
   end
 end
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(ITEM_GROUP_HELP[self.index])
 end
end
#?????????????????????????????????????????
#==============================================================================
# ? Scene_Item
#------------------------------------------------------------------------------
# ???????????????????
#==============================================================================
class Scene_Item
 #--------------------------------------------------------------------------
 # ? ?????
 #--------------------------------------------------------------------------
 alias main_KGC_ItemGrouping main
 def main
   # ??????????
   @group_window = Window_ItemGroup.new
   @group_window.back_opacity = 160 if $imported["MenuAlter"]
   # ???????
   main_KGC_ItemGrouping
   # ????????
   @group_window.dispose
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
   unless @window_initialize
     @group_window.z = @help_window.z + 1
     @group_window.help_window = @help_window
     @window_initialize = true
   end
   @help_window.update
   @item_window.update
   @target_window.update
   @group_window.update
   # update_item
   if @item_window.active
     update_item
     return
   end
   #update_target
   if @target_window.active
     update_target
     return
   end
   # update_group
   if @group_window.active
     update_group
     return
   end
 end
 #--------------------------------------------------------------------------
 # ? ?????? (??????????????????)
 #--------------------------------------------------------------------------
 alias update_item_KGC_ItemGrouping update_item
 def update_item
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     @group_window.active = true
     @group_window.visible = true
     @item_window.active = false
     @item_window.index = -1
     return
   end
   update_item_KGC_ItemGrouping
 end
 #--------------------------------------------------------------------------
 # ? ?????? (???????????????????)
 #--------------------------------------------------------------------------
 def update_target
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     unless $game_party.item_can_use?(@item.id)
       @item_window.refresh(@group_window.index)
     end
     @item_window.active = true
     @target_window.visible = false
     @target_window.active = false
     return
   end
   if Input.trigger?(Input::C)
     if $game_party.item_number(@item.id) == 0
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     if @target_window.index == -1
       used = false
       for i in $game_party.actors
         used |= i.item_effect(@item)
       end
     end
     if @target_window.index >= 0
       target = $game_party.actors[@target_window.index]
       used = target.item_effect(@item)
     end
     if used
       $game_system.se_play(@item.menu_se)
       if @item.consumable
         $game_party.lose_item(@item.id, 1)
         @item_window.draw_item(@item_window.index)
       end
       @target_window.refresh
       if $game_party.all_dead?
         $scene = Scene_Gameover.new
         return
       end
       if @item.common_event_id > 0
         $game_temp.common_event_id = @item.common_event_id
         $scene = Scene_Map.new
         return
       end
     end
     unless used
       $game_system.se_play($data_system.buzzer_se)
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # ? ?????? (????????????????)
 #--------------------------------------------------------------------------
 def update_group
   if @now_itemkind != @group_window.index
     @item_window.refresh(@group_window.index)
     @now_itemkind = @group_window.index
   end
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(0)
     return
   end
   if Input.trigger?(Input::C)
     $game_system.se_play($data_system.decision_se)
     @item_window.active = true
     @item_window.index = 0
     @group_window.active = false
     @group_window.visible = false if $imported["HelpExtension"]
     return
   end
 end
end![[Image: cmitemsv2hc1.png]](http://img125.imageshack.us/img125/2826/cmitemsv2hc1.png) 
	
 
 
 CMItems V2
 CMItems V2