RPG Maker Détente
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.



 
RechercherDernières imagesPortailAccueilAccueilForumPraline au mielS'enregistrerConnexion

Le Deal du moment : -50%
-50% Baskets Nike Air Huarache Runner
Voir le deal
69.99 €

 

 Ranger vos objets avec "Item Categorization"

Aller en bas 
AuteurMessage
Koji

Koji


Messages : 16


Ranger vos objets avec "Item Categorization" Empty
MessageSujet: Ranger vos objets avec "Item Categorization"   Ranger vos objets avec "Item Categorization" Icon_minitimeDim 29 Sep - 20:17

Nom du script: Item Categorization
Créateur: KGC
Traducteurs: Mr. Anonymous & Mr. Bubble
Screenshot:
Ranger vos objets avec "Item Categorization" Kgc_categorizeitem_example
Script:

Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/    ◆            Item Categorization - KGC_CategorizeItem            ◆ VX ◆
#_/    ◇                  Last update : 2009/09/04                            ◇
#_/    ◇          Translated by Mr. Anonymous & Mr. Bubble                    ◇
#_/-----------------------------------------------------------------------------
#_/  Adds a function to the Items screen which allows the player to display
#_/  items by category.
#_/  To assign a category to an item, you must add <category IDENTIFIER> to the
#_/  notes on the specified item.
#_/  EX. A Potion would be listed as <category Goods> and a Sword would be
#_/  listed as <category Weapons>, provided you use the default terminology.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

$data_system = load_data("Data/System.rvdata") if $data_system == nil

#==============================================================================#
#                            ★ Customization ★                                #       
#==============================================================================#

module KGC
module CategorizeItem

  #          ++ Allow Item Categories Outside of battle ++
  ENABLE_NOT_IN_BATTLE = true
  #          ++ Allow Item Categories In Battles ++
  ENABLE_IN_BATTLE    = false

  #    ++ Determine Use of Same Categories In and Out of Battle ++
  #  See the appropriate settings within this script for
  #  window customization options.
  USE_SAME_CATEGORY = true

  #                  ++ Automatically Catagorize Items ++
  ENABLE_AUTO_CATEGORIZE = true
 
  #                    ++ Duplicate Category Entries. ++
  #  Set to false, items can have multiple categories.
  #  Set to true, items will be classified under the last tag (In the item
  #  database "Notes")
  NOT_ALLOW_DUPLICATE = true

  #      ++ Memorize Item Cursor Position In Battle ++
  REMEMBER_INDEX_IN_BATTLE = true
 
  #                    ++ Category Identifier ++
  #  Arrange names in order to identify a category with the category identifier.
  #  These are the default item catagories translated for future reference.
  #  "Goods", "Combat", "Weapons", "Shields", "Helmets", "Armor",
  #  "Accessories", "Valuables", "Special", "All Items"
  CATEGORY_IDENTIFIER = [
    "Goods",          # Consumable items (potion)
    "Combat",        # Battle-only items (fire bomb)
    "Weapons",        # Weapons
    "Shields",        # Shields
    "Helmets",        # Head Gear / Helmets
    "Armor",          # Body Gear / Armor
    "Accessories",    # Accessories / Rings, Necklaces, etc
    "Valuables",      # Treasures and the like
    "Special",        # AKA Plot Devices. Special keys, etc.
    "All Items",      # All Items
  ]
 
  #                  ++ Default Item Category ++
  #  Default category items fall under if there is no specified tag.
  ITEM_DEFAULT_CATEGORY = "Goods"

  #                  ++ Item Screen Category Name ++
  #  Shows what current category is selected in the item description window.
  #  Must be arranged in the same order as CATEGORY_IDENTIFIER.
  CATEGORY_NAME = [
    "Goods",
    "Combat",
    Vocab.weapon,                # Weapons
    Vocab.armor1,                # Shields
    "#{Vocab.armor2}",          # Head Gear
    "#{Vocab.armor3}",          # Body Gear
    Vocab.armor4,                # Accessories
    "Valuables",
    "Special",
    "All",
  ]

  #                      ++ Descriptive Text ++
  #  Must be arranged in the same order as CATEGORY_IDENTIFIER
  CATEGORY_DESCRIPTION = [
    "Viewing #{Vocab.item}.",
    "Viewing Combat #{Vocab.item}. For use during battle.",
    "Viewing #{Vocab.weapon}s.",
    "Viewing #{Vocab.armor1}s.",
    "Viewing #{Vocab.armor2}s.",
    "Viewing #{Vocab.armor3}s.",
    "Viewing #{Vocab.armor4}.",
    "Viewing Valuables.",
    "Viewing Special #{Vocab.item}. A.K.A. Plot Devices.",
    "Viewing All #{Vocab.item}.",
  ]

  # ++ In-Battle Item Categories ++
  # Battle category names will only be used when USE_SAME_CATEGORY = false
  #  Shows what current category is selected in the item description window.
  #  Must be arranged in the same order as CATEGORY_IDENTIFIER.
 
  # ++ Battle Categories
  CATEGORY_IDENTIFIER_BATTLE = [
    "Goods",          # Consumable items (potion)
    "Combat",        # Battle-only items (fire bomb)
    "Weapons",        # Weapons
    "Shields",        # Shields
    "Helmets",        # Head Gear / Helmets
    "Armor",          # Body Gear / Armor
    "Accessories",    # Accessories / Rings, Necklaces, etc
    "Valuables",      # Treasures and the like
    "Special",        # AKA Plot Devices. Special keys, etc.
    "All Items",      # All Items
  ]
 
  #            ++ Default Battle Item Category ++
  #  Default battle category items fall under if there is no specified tag.
  ITEM_DEFAULT_CATEGORY_BATTLE = "Goods"
 
  #              ++ Battle Item Screen Category Name ++
  #  Shows what current category is selected in the item description window.
  #  Must be arranged in the same order as CATEGORY_IDENTIFIER_BATTLE.
  CATEGORY_NAME_BATTLE = [
    "Goods",
    "Combat",
    Vocab.weapon,                # Weapons
    Vocab.armor1,                # Shields
    "#{Vocab.armor2}",          # Head Gear
    "#{Vocab.armor3}",          # Body Gear
    Vocab.armor4,                # Accessories
    "Valuables",
    "Special",
    "All",
  ]
 
  #                  ++ Battle Descriptive Text ++
  #  Must be arranged in the same order as CATEGORY_IDENTIFIER_BATTLE
  CATEGORY_DESCRIPTION_BATTLE = [
    "Viewing #{Vocab.item}.",
    "Viewing Combat #{Vocab.item}. For use during battle.",
    "Viewing #{Vocab.weapon}s.",
    "Viewing #{Vocab.armor1}s.",
    "Viewing #{Vocab.armor2}s.",
    "Viewing #{Vocab.armor3}s.",
    "Viewing #{Vocab.armor4}.",
    "Viewing Valuables.",
    "Viewing Special #{Vocab.item}. A.K.A. Plot Devices.",
    "Viewing All #{Vocab.item}.",
  ]

  if USE_SAME_CATEGORY
    # Sets battle categories the same as out of battle categories
    # if USE_SAME_CATEGORY is true. Do not edit this section.
    CATEGORY_IDENTIFIER_BATTLE  = CATEGORY_IDENTIFIER
    ITEM_DEFAULT_CATEGORY_BATTLE = ITEM_DEFAULT_CATEGORY
    CATEGORY_NAME_BATTLE        = CATEGORY_NAME
    CATEGORY_DESCRIPTION_BATTLE  = CATEGORY_DESCRIPTION
  end
 
  # ++ Coordinates of item description window. [ x, y ]
  CATEGORY_WINDOW_POSITION  = [264, 128]
  # ++ Number of rows in the item description window.
  CATEGORY_WINDOW_COLUMNS  = 2
  # ++ Item description window column line width.
  CATEGORY_WINDOW_COL_WIDTH = 96
  # ++ Item description window column spacer width.
  CATEGORY_WINDOW_COL_SPACE = 32
 
  # ++ Coordinates of item description window in battle. [ x, y ]
  CATEGORY_WINDOW_POSITION_BATTLE  = [264, 128]
  # ++ Number of rows in the item description window in battle.
  CATEGORY_WINDOW_COLUMNS_BATTLE  = 2
  # ++ Item description window column line width in battle.
  CATEGORY_WINDOW_COL_WIDTH_BATTLE = 96
  # ++ Item description window column spacer width in battle.
  CATEGORY_WINDOW_COL_SPACE_BATTLE = 32

end
end

#------------------------------------------------------------------------------#

$imported = {} if $imported == nil
$imported["CategorizeItem"] = true

module KGC::CategorizeItem
  # アイテムのデフォルトカテゴリ index
  ITEM_DEFAULT_CATEGORY_INDEX =
    CATEGORY_IDENTIFIER.index(ITEM_DEFAULT_CATEGORY)
  # アイテムのデフォルトカテゴリ index (戦闘時)
  ITEM_DEFAULT_CATEGORY_INDEX_BATTLE =
    CATEGORY_IDENTIFIER_BATTLE.index(ITEM_DEFAULT_CATEGORY_BATTLE)

  # 予約識別名
  RESERVED_CATEGORIES = [
    "All Items", "Valuables", "Weapons", "Armor" ,
    "Shields", "Helmets", "Body Armor", "Accessories"
  ]
  # 予約カテゴリ index
  RESERVED_CATEGORY_INDEX = {}
  # 予約カテゴリ index (戦闘時)
  RESERVED_CATEGORY_INDEX_BATTLE = {}

  # 予約カテゴリ index 作成
  RESERVED_CATEGORIES.each { |c|
    RESERVED_CATEGORY_INDEX[c]        = CATEGORY_IDENTIFIER.index(c)
    RESERVED_CATEGORY_INDEX_BATTLE[c] = CATEGORY_IDENTIFIER_BATTLE.index(c)
  }

# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Unless you know what you're doing, it's best not to alter anything beyond  #
#  this point, as this only affects the tags used for "Notes" in database.    #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
#  Whatever word(s) are after the separator ( | ) in the following lines are
#  what are used to determine what is searched for in the "Notes" section.

  # Regular Expression Definition
  module Regexp
    # Base Item Module
    module BaseItem
      # Category tag string
      CATEGORY = /^<(?:CATEGORY|classification|category?)[ ]*(.*)>/i
    end
  end
end

#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (非戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    if @__item_category == nil || !KGC::CategorizeItem::ENABLE_AUTO_CATEGORIZE
      @__item_category = []
    else
      @__item_category.compact!
    end

    self.note.each_line { |line|
      if line =~ KGC::CategorizeItem::Regexp::BaseItem::CATEGORY
        # カテゴリ
        c = KGC::CategorizeItem::CATEGORY_IDENTIFIER.index($1)
        @__item_category << c if c != nil
      end
    }
    if @__item_category.empty?
      @__item_category << KGC::CategorizeItem::ITEM_DEFAULT_CATEGORY_INDEX
    elsif KGC::CategorizeItem::NOT_ALLOW_DUPLICATE
      # 最後に指定したカテゴリに配置
      @__item_category = [@__item_category.pop]
    end
  end
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_battle_cache
    if @__item_category_battle == nil ||
        !KGC::CategorizeItem::ENABLE_AUTO_CATEGORIZE
      @__item_category_battle = []
    else
      @__item_category_battle.compact!
    end

    self.note.each_line { |line|
      if line =~ KGC::CategorizeItem::Regexp::BaseItem::CATEGORY
        # カテゴリ
        c = KGC::CategorizeItem::CATEGORY_IDENTIFIER_BATTLE.index($1)
        @__item_category_battle << c if c != nil
      end
    }
    if @__item_category_battle.empty?
      @__item_category_battle <<
        KGC::CategorizeItem::ITEM_DEFAULT_CATEGORY_INDEX_BATTLE
    elsif KGC::CategorizeItem::NOT_ALLOW_DUPLICATE
      # 最後に指定したカテゴリに配置
      @__item_category_battle = [@__item_category_battle.pop]
    end
  end
  #--------------------------------------------------------------------------
  # ○ アイテムのカテゴリ (非戦闘時)
  #--------------------------------------------------------------------------
  def item_category
    create_categorize_item_cache if @__item_category == nil
    return @__item_category
  end
  #--------------------------------------------------------------------------
  # ○ アイテムのカテゴリ (戦闘時)
  #--------------------------------------------------------------------------
  def item_category_battle
    create_categorize_item_battle_cache if @__item_category_battle == nil
    return @__item_category_battle
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ RPG::UsableItem
#==============================================================================

class RPG::UsableItem < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (非戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    @__item_category = []
    if self.price == 0
      @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Valuables"]
    end
    super
  end
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_battle_cache
    @__item_category_battle = []
    if self.price == 0
      @__item_category_battle <<
        KGC::CategorizeItem::RESERVED_CATEGORY_INDEX_BATTLE["Valuables"]
    end
    super
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ RPG::Weapon
#==============================================================================

class RPG::Weapon < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (非戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    @__item_category = []
    @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Weapons"]
    super
  end
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_battle_cache
    @__item_category_battle = []
    @__item_category_battle <<
      KGC::CategorizeItem::RESERVED_CATEGORY_INDEX_BATTLE["Weapons"]
    super
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ RPG::Armor
#==============================================================================

class RPG::Armor < RPG::BaseItem
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  CATEGORIZE_TYPE = ["Shields", "Helmets", "Body Armor", "Accessories"]
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (非戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_cache
    @__item_category = []
    @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Armor"]
    type = CATEGORIZE_TYPE[self.kind]
    if type != nil
      @__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX[type]
    end
    super
  end
  #--------------------------------------------------------------------------
  # ○ アイテム分類のキャッシュ生成 (戦闘時)
  #--------------------------------------------------------------------------
  def create_categorize_item_battle_cache
    @__item_category_battle = []
    @__item_category_battle <<
      KGC::CategorizeItem::RESERVED_CATEGORY_INDEX_BATTLE["Armor"]
    type = CATEGORIZE_TYPE[self.kind]
    if type != nil
      @__item_category_battle <<
        KGC::CategorizeItem::RESERVED_CATEGORY_INDEX_BATTLE[type]
    end
    super
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Temp
#==============================================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :item_window_category    # アイテム画面で表示するカテゴリ
  attr_accessor :item_category_disabled  # アイテム画面のカテゴリ無効化フラグ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_CategorizeItem initialize
  def initialize
    initialize_KGC_CategorizeItem

    @item_window_category  = nil
    @item_category_disabled = false
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_writer  :last_item_category      # カーソル記憶用 : アイテムカテゴリ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    actor_id : アクター ID
  #--------------------------------------------------------------------------
  alias initialize_KGC_CategorizeItem initialize
  def initialize(actor_id)
    initialize_KGC_CategorizeItem(actor_id)

    @last_item_category = 0
  end
  #--------------------------------------------------------------------------
  # ○ カーソル記憶用のカテゴリ取得
  #--------------------------------------------------------------------------
  def last_item_category
    @last_item_category = 0 if @last_item_category == nil
    return @last_item_category
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Item
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader  :category                # カテゴリ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #    x      : ウィンドウの X 座標
  #    y      : ウィンドウの Y 座標
  #    width  : ウィンドウの幅
  #    height : ウィンドウの高さ
  #--------------------------------------------------------------------------
  alias initialize_KGC_CategorizeItem initialize
  def initialize(x, y, width, height)
    @category = 0

    initialize_KGC_CategorizeItem(x, y, width, height)
  end
  #--------------------------------------------------------------------------
  # ○ カテゴリ設定
  #--------------------------------------------------------------------------
  def category=(value)
    @category = value
    refresh
  end
  #--------------------------------------------------------------------------
  # ● アイテムをリストに含めるかどうか
  #    item : アイテム
  #--------------------------------------------------------------------------
  alias include_KGC_CategorizeItem? include?
  def include?(item)
    return false if item == nil

    # 「全種」なら無条件で含める
    if $game_temp.in_battle
      return true unless KGC::CategorizeItem::ENABLE_IN_BATTLE
      reserved_index = KGC::CategorizeItem::RESERVED_CATEGORY_INDEX_BATTLE
    else
      return true unless KGC::CategorizeItem::ENABLE_NOT_IN_BATTLE
      reserved_index = KGC::CategorizeItem::RESERVED_CATEGORY_INDEX
    end
    return true if @category == reserved_index["All Items"]

    result = include_KGC_CategorizeItem?(item)

    unless result
      # 使用可能なら追加候補とする
      if $imported["UsableEquipment"] && $game_party.item_can_use?(item)
        result = true
      end
    end
    # カテゴリ一致判定
    item_category = ($game_temp.in_battle ?
      item.item_category_battle : item.item_category)
    result &= item_category.include?(@category)
    # 「全種」なら含める
    return true if @category == reserved_index["All Items"]

    return result
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_ItemCategory
#------------------------------------------------------------------------------
#  アイテム画面でカテゴリ選択を行うウィンドウです。
#==============================================================================

class Window_ItemCategory < Window_Command
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    if $game_temp.in_battle
      cols    = KGC::CategorizeItem::CATEGORY_WINDOW_COLUMNS_BATTLE
      width    = KGC::CategorizeItem::CATEGORY_WINDOW_COL_WIDTH_BATTLE
      space    = KGC::CategorizeItem::CATEGORY_WINDOW_COL_SPACE_BATTLE
      commands = KGC::CategorizeItem::CATEGORY_NAME_BATTLE
      position = KGC::CategorizeItem::CATEGORY_WINDOW_POSITION_BATTLE
    else
      cols    = KGC::CategorizeItem::CATEGORY_WINDOW_COLUMNS
      width    = KGC::CategorizeItem::CATEGORY_WINDOW_COL_WIDTH
      space    = KGC::CategorizeItem::CATEGORY_WINDOW_COL_SPACE
      commands = KGC::CategorizeItem::CATEGORY_NAME
      position = KGC::CategorizeItem::CATEGORY_WINDOW_POSITION
    end
    width = width * cols + 32
    width += (cols - 1) * space
    super(width, commands, cols, 0, space)
    self.x = position[0]
    self.y = position[1]
    self.z = 1000
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    if $game_temp.in_battle
      text = KGC::CategorizeItem::CATEGORY_DESCRIPTION_BATTLE[self.index]
    else
      text = KGC::CategorizeItem::CATEGORY_DESCRIPTION[self.index]
    end
    @help_window.set_text(text)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Item
#==============================================================================

if KGC::CategorizeItem::ENABLE_NOT_IN_BATTLE
class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  alias start_KGC_CategorizeItem start
  def start
    start_KGC_CategorizeItem

    @category_window = Window_ItemCategory.new
    @category_window.help_window = @help_window

    if $game_temp.item_window_category == nil
      show_category_window
    else
      # 指定カテゴリを表示
      category = $game_temp.item_window_category
      if category.is_a?(String)
        category = KGC::CategorizeItem::CATEGORY_IDENTIFIER.index(category)
      end
      @category_window.openness = 0
      hide_category_window
      @category_window.index = category
      @item_window.category  = category
      @item_window.call_update_help
    end
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  alias terminate_KGC_CategorizeItem terminate
  def terminate
    terminate_KGC_CategorizeItem

    @category_window.dispose
    $game_temp.item_window_category = nil
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_KGC_CategorizeItem update
  def update
    @category_window.update

    update_KGC_CategorizeItem

    if @category_window.active
      update_category_selection
    end
  end
  #--------------------------------------------------------------------------
  # ○ カテゴリ選択の更新
  #--------------------------------------------------------------------------
  def update_category_selection
    unless @category_activated
      @category_activated = true
      show_category_window
      return
    end

    # 選択カテゴリー変更
    if @last_category_index != @category_window.index
      @item_window.category = @category_window.index
      @item_window.refresh
      @last_category_index = @category_window.index
    end

    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      hide_category_window
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の更新
  #--------------------------------------------------------------------------
  alias update_item_selection_KGC_CategorizeItem update_item_selection
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if $game_temp.item_category_disabled
        return_scene
      else
        show_category_window
      end
      return
    end

    update_item_selection_KGC_CategorizeItem
  end
  #--------------------------------------------------------------------------
  # ○ カテゴリウィンドウの表示
  #--------------------------------------------------------------------------
  def show_category_window
    @category_window.open
    @category_window.active = true
    @item_window.active = false
  end
  #--------------------------------------------------------------------------
  # ○ カテゴリウィンドウの非表示
  #--------------------------------------------------------------------------
  def hide_category_window
    @category_activated = false
    @category_window.close
    @category_window.active = false
    @item_window.active = true
    # アイテムウィンドウのインデックスを調整
    if @item_window.index >= @item_window.item_max
      @item_window.index = [@item_window.item_max - 1, 0].max
    end
  end
end
end  # <-- if KGC::CategorizeItem::ENABLE_NOT_IN_BATTLE

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle
#==============================================================================

if KGC::CategorizeItem::ENABLE_IN_BATTLE
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● アイテム選択の開始
  #--------------------------------------------------------------------------
  alias start_item_selection_KGC_CategorizeItem start_item_selection
  def start_item_selection
    start_item_selection_KGC_CategorizeItem

    # カテゴリウィンドウを作成
    @category_window = Window_ItemCategory.new
    @category_window.help_window = @help_window
    @category_window.z = @help_window.z + 10

    if $game_temp.item_window_category == nil
      @item_window.active = false

      # 記憶していたカテゴリを復元
      if KGC::CategorizeItem::REMEMBER_INDEX_IN_BATTLE
        @category_window.index = @active_battler.last_item_category
        @item_window.category = @category_window.index
      end
    else
      # 指定カテゴリを表示
      category = $game_temp.item_window_category
      if category.is_a?(String)
        category =
          KGC::CategorizeItem::CATEGORY_IDENTIFIER_BATTLE.index(category)
      end
      hide_item_category_window
      @category_window.openness = 0
      @category_window.index    = category
      @item_window.category    = category
      @item_window.refresh
      @item_window.call_update_help
    end
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の終了
  #--------------------------------------------------------------------------
  alias end_item_selection_KGC_CategorizeItem end_item_selection
  def end_item_selection
    if @category_window != nil
      @category_window.dispose
      @category_window = nil
    end
    $game_temp.item_window_category = nil

    end_item_selection_KGC_CategorizeItem
  end
  #--------------------------------------------------------------------------
  # ● アイテム選択の更新
  #--------------------------------------------------------------------------
  alias update_item_selection_KGC_CategorizeItem update_item_selection
  def update_item_selection
    @category_window.update
    if @category_window.active
      update_item_category_selection
      return
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      if $game_temp.item_category_disabled
        end_item_selection
      else
        show_item_category_window
      end
      return
    end

    update_item_selection_KGC_CategorizeItem
  end
  #--------------------------------------------------------------------------
  # ● アイテムの決定
  #--------------------------------------------------------------------------
  alias determine_item_KGC_CategorizeItem determine_item
  def determine_item
    # 選択したカテゴリを記憶
    if KGC::CategorizeItem::REMEMBER_INDEX_IN_BATTLE && @category_window != nil
      @active_battler.last_item_category = @category_window.index
    end

    determine_item_KGC_CategorizeItem
  end
  #--------------------------------------------------------------------------
  # ○ アイテムのカテゴリ選択の更新
  #--------------------------------------------------------------------------
  def update_item_category_selection
    @help_window.update

    # 選択カテゴリー変更
    if @last_category_index != @category_window.index
      @item_window.category = @category_window.index
      @item_window.refresh
      @last_category_index = @category_window.index
    end

    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_item_selection
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      hide_item_category_window
    end
  end
  #--------------------------------------------------------------------------
  # ○ アイテムカテゴリウィンドウの表示
  #--------------------------------------------------------------------------
  def show_item_category_window
    @category_window.open
    @category_window.active = true
    @item_window.active = false
  end
  #--------------------------------------------------------------------------
  # ○ アイテムカテゴリウィンドウの非表示
  #--------------------------------------------------------------------------
  def hide_item_category_window
    @category_activated = false
    @category_window.close
    @category_window.active = false
    @item_window.active = true
    # アイテムウィンドウのインデックスを調整
    if @item_window.index >= @item_window.item_max
      @item_window.index = [@item_window.item_max - 1, 0].max
    end
  end
end
end  # <-- if KGC::CategorizeItem::ENABLE_IN_BATTLE

#==================================End Class===================================#

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/  The original untranslated version of this script can be found here:
# http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/item&tech=categorize_item
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
Source: http://www.rpgmakervx.net/index.php?showtopic=47062&st=0&p=452562&#entry452562

Je suis toujours là, je passe de temps en temps, j’attends d'avoir une démo, pour m'incruster + chez les détendu. Anyway, Enjoy ce script très utile.

(j'espère que j'ai rien fais de travers. :[ )
Revenir en haut Aller en bas
 
Ranger vos objets avec "Item Categorization"
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» [VXAce]Pop up Item
» script sac a dos et max d'objets........'RESOLU"
» Problèmes d'installation avec Ace
» Vérifier des variables avec un interrupteur
» Libertz - "On ne fait pas que des jeux avec RM!"

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Maker Détente :: Entrepôt :: Scripts :: Scripts Vx-
Sauter vers: