Le Deal du moment : -45%
WHIRLPOOL OWFC3C26X – Lave-vaisselle pose libre ...
Voir le deal
339 €

Aller en bas
Anonymous
Invité
Invité

 - Script Catégorie d'objets Empty Script Catégorie d'objets

Mar 17 Juin 2008 - 17:06
J'ai vue quelques demandes pour un tel script alors voila!

Vous apprendez à connaitre KGC tout comme moi si ce n'est pas déja fait....et vous aller les adorer!

Traduction original en anglais par Mr.Anonymous

Ce script permet de classer les objets dans de multiple catégories.

 - Script Catégorie d'objets Menu_i10


Partie 1, À placer au dessu de Main :
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ◆ Item Categorization - KGC_CategorizeItem ◆ VX ◆
#_/ ◇ Last update : 2008/04/10 ◇
#_/ ◇ Translated by Mr. Anonymous ◇
#_/-----------------------------------------------------------------------------
#_/ Adds a function to the Items screen which allows the player to display
#_/ items by catagory.
#_/ 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.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#===============================================================
#
# rpgmakervx.1fr1.net
#
#===============================================================


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

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

module KGC
module CategorizeItem
# ◆ 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
# databasexsd "Notes")
NOT_ALLOW_DUPLICATE = false

# ◆ 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", "Head Gear", "Body Gear",
# "Accessories", "Valuables", "Special Items", "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 Items", # AKA Plot Devices. Special keys, etc.
"All Items", # According to the script's author(s), it isn't neccessary
# to set this in brackets for item notes, it's automatic.
# However, I must note that I haven't gotten this to work
# correctly.
]

# ◆ Default Catagory Display ◆
# Not hard to figure this one out.
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 CATAGORY_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 CATAGORY_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} items.",
"Viewing All #{Vocab.item} goods.",
]

# ◆ 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
end
end

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

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

module KGC::CategorizeItem
# ◆ Item Index ◆
ITEM_DEFAULT_CATEGORY_INDEX = CATEGORY_IDENTIFIER.index(ITEM_DEFAULT_CATEGORY)

# ◆ Reserved Category Index ◆
# To be honest I'm not entirely sure what this affects.
RESERVED_CATEGORY_INDEX = {
"All Items" => CATEGORY_IDENTIFIER.index("All Items"),
"Valuables" => CATEGORY_IDENTIFIER.index("Valuables"),
"Weapons" => CATEGORY_IDENTIFIER.index("Weapons"),
"Gear" => CATEGORY_IDENTIFIER.index("Gear"),
"Shields" => CATEGORY_IDENTIFIER.index("Shields"),
"Head Gear" => CATEGORY_IDENTIFIER.index("Head Gear"),
"Body Gear" => CATEGORY_IDENTIFIER.index("Body Gear"),
"Accessories" => CATEGORY_IDENTIFIER.index("Accessories")
}


Dernière édition par Fenrir le Mar 17 Juin 2008 - 18:30, édité 2 fois
Anonymous
Invité
Invité

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Mar 17 Juin 2008 - 17:07
Partie 2, à placer à la suite de la première partie dans le même script

# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# 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.split(/[\r\n]+/).each { |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 item_category
create_categorize_item_cache if @__item_category == nil
return @__item_category
end
end

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

#==============================================================================
# ■ 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
end

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

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

class RPG::Weapon < RPG::BaseItem
#--------------------------------------------------------------------------
# ○ アイテム分類のキャッシュ生成
#--------------------------------------------------------------------------
def create_categorize_item_cache
@__item_category = []
@__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Weapon"]
super
end
end

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

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

class RPG::Armor < RPG::BaseItem
#--------------------------------------------------------------------------
# ○ アイテム分類のキャッシュ生成
#--------------------------------------------------------------------------
def create_categorize_item_cache
@__item_category = []
@__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Armor"]
type = nil
case self.kind
when 0
type = "Shields"
when 1
type = "Head Gear"
when 2
type = "Body Gear"
when 3
type = "Accessories"
end
if type != nil
@__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX[type]
end
super
end
end

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

#==============================================================================
# ■ 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 @category == KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["All Items"]
return true
end

result = include_KGC_CategorizeItem?(item)

unless result
# 使用可能なら追加候補とする
if $imported["UsableEquipment"] && $game_party.item_can_use?(item)
result = true
end
end
# 戦闘外ならカテゴリ一致判定
unless $game_temp.in_battle
result &= (item.item_category.include?(@category))
end

return result
end
end

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

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

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

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

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

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
show_category_window
end
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
alias terminate_KGC_CategorizeItem terminate
def terminate
terminate_KGC_CategorizeItem

@category_window.dispose
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
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
show_category_window
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 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
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_


Dernière édition par Fenrir le Mar 17 Juin 2008 - 18:30, édité 1 fois
Thierry T.
Thierry T.
Membre

Nombre de messages : 664
Age : 29
Localisation : Marseille (13).
Distinction : questionneur à répétition
Date d'inscription : 01/03/2008

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Mar 17 Juin 2008 - 17:12
Désolé mais il y a un problème à la l.53.
Anonymous
Invité
Invité

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Mar 17 Juin 2008 - 18:27
Il me semble que ce soit un probleme dans la traduction alors je vais mettre mon original (en anglais) à la place de celui que j'ai mit, et si quelqu'un a besoin d'aide pour comprendre quelque chose avec le script,
il n'auront qu'a me le demander!

EDIT : Voila, et je l'ai retester et maintenant ca fonctionne! Smile J'ai dut faire une erreure quelque part en traduisant, vraiment désolé! Maintenant pour de l'aide supp. vous n'avez qu'a demander!
Thierry T.
Thierry T.
Membre

Nombre de messages : 664
Age : 29
Localisation : Marseille (13).
Distinction : questionneur à répétition
Date d'inscription : 01/03/2008

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Mar 17 Juin 2008 - 19:30
Problème l.126
Thierry T.
Thierry T.
Membre

Nombre de messages : 664
Age : 29
Localisation : Marseille (13).
Distinction : questionneur à répétition
Date d'inscription : 01/03/2008

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Mar 17 Juin 2008 - 20:35
Ben,c'est très simple quand je veux tester mon projet une fenetre s'affiche et il y a marqué :
" error syntaxe "KGC" ligne 126 ... "
Enfin en gros ça.
Anonymous
Invité
Invité

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Jeu 19 Juin 2008 - 5:43
Je sais pas trop quoi te dire autre que...Desolé! Peut-être que ta version de VX est trop vieille ou peut-être qu'un de tes autres script l'empêche de fonctionner correctement...À moin d'avoir tout ton projet devant les yeux (facon de parler) Je vois pas comment je peux t'aider vraiment  - Script Catégorie d'objets 264793

EDIT: Au fait, si jamais tu veux réessayer avec la vrai de vrai version du script, prend celle dans le lien a la fin du script que j'ai donné, cette version est intact et devrais toujorus fonctionné, alors test ca si tu veux, bonne chance!
Thierry T.
Thierry T.
Membre

Nombre de messages : 664
Age : 29
Localisation : Marseille (13).
Distinction : questionneur à répétition
Date d'inscription : 01/03/2008

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Jeu 19 Juin 2008 - 16:54
Je suis permis de faire une traduction et il marche presque :
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ◆ Item Categorization - KGC_CategorizeItem ◆ VX ◆
#_/ ◇ Last update : 2008/04/10 ◇
#_/ ◇ Translated by Mr. Anonymous ◇
#_/-----------------------------------------------------------------------------
#_/ Adds a function to the Items screen which allows the player to display
#_/ items by catagory.
#_/ 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
# ◆ 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
# databasexsd "Notes")
NOT_ALLOW_DUPLICATE = false

# ◆ 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", "Head Gear", "Body Gear",
# "Accessories", "Valuables", "Special Items", "All Items"
CATEGORY_IDENTIFIER = [
"Soin", # Consumable items (potion)
"Combat", # Battle-only items (fire bomb)
"Armes", # Weapons
"Boucliers", # Shields
"Protections", # Head Gear / Helmets
"Armures", # Body Gear / Armor
"Accésoires", # Accessories / Rings, Necklaces, etc
"##", # Treasures and the like
"Objet rare", # AKA Plot Devices. Special keys, etc.
"Tous", # According to the script's author(s), it isn't neccessary
# to set this in brackets for item notes, it's automatic.
# However, I must note that I haven't gotten this to work
# correctly.
]

# ◆ Default Catagory Display ◆
# Not hard to figure this one out.
ITEM_DEFAULT_CATEGORY = "Soin"

# ◆ Item Screen Category Name ◆
# Shows what current category is selected in the item description window.
# Must be arranged in the same order as CATAGORY_IDENTIFIER.
CATEGORY_NAME = [
"Soin",
"Combat",
Vocab.weapon, # Weapons
Vocab.armor1, # Shields
"#{Vocab.armor2}", # Head Gear
"#{Vocab.armor3}", # Body Gear
"Accésoires" # Accessories
"##",
"Objets rare",
"Tous",
]
# ◆ Descriptive Text ◆
# Must be arranged in the same order as CATAGORY_IDENTIFIER
CATEGORY_DESCRIPTION = [
"Objets des soin",
"Objets uniquement pour le combat.",
"Armes.",
"#{Vocab.armor1}s.",
"#{Vocab.armor2}s.",
"#{Vocab.armor3}s.",
"Accésoires",
"##",
"Objets rare",
"Tout les objets",
]

# ◆ 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
end
end

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

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

module KGC::CategorizeItem
# ◆ Item Index ◆
ITEM_DEFAULT_CATEGORY_INDEX = CATEGORY_IDENTIFIER.index(ITEM_DEFAULT_CATEGORY)

# ◆ Reserved Category Index ◆
# To be honest I'm not entirely sure what this affects.
RESERVED_CATEGORY_INDEX = {
"Tous" => CATEGORY_IDENTIFIER.index("Tous"),
"##" => CATEGORY_IDENTIFIER.index("##"),
"Armes" => CATEGORY_IDENTIFIER.index("Armes"),
"Protections" => CATEGORY_IDENTIFIER.index("Protections"),
"Boucliers" => CATEGORY_IDENTIFIER.index("Boucliers"),
"Casques" => CATEGORY_IDENTIFIER.index("Casques"),
"Armures" => CATEGORY_IDENTIFIER.index("Armures"),
"Accessories" => CATEGORY_IDENTIFIER.index("Accessories")
}
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# 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.split(/[\r\n]+/).each { |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 item_category
create_categorize_item_cache if @__item_category == nil
return @__item_category
end
end

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

#==============================================================================
# ■ 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["##"]
end
super
end
end

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

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

class RPG::Weapon < RPG::BaseItem
#--------------------------------------------------------------------------
# ○ アイテム分類のキャッシュ生成
#--------------------------------------------------------------------------
def create_categorize_item_cache
@__item_category = []
@__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Armes"]
super
end
end

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

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

class RPG::Armor < RPG::BaseItem
#--------------------------------------------------------------------------
# ○ アイテム分類のキャッシュ生成
#--------------------------------------------------------------------------
def create_categorize_item_cache
@__item_category = []
@__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Armures"]
type = nil
case self.kind
when 0
type = "Boucliers"
when 1
type = "Casques"
when 2
type = "Armures"
when 3
type = "Accésoires"
end
if type != nil
@__item_category << KGC::CategorizeItem::RESERVED_CATEGORY_INDEX[type]
end
super
end
end

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

#==============================================================================
# ■ 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 @category == KGC::CategorizeItem::RESERVED_CATEGORY_INDEX["Tous"]
return true
end

result = include_KGC_CategorizeItem?(item)

unless result
# 使用可能なら追加候補とする
if $imported["UsableEquipment"] && $game_party.item_can_use?(item)
result = true
end
end
# 戦闘外ならカテゴリ一致判定
unless $game_temp.in_battle
result &= (item.item_category.include?(@category))
end

return result
end
end

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

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

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


Dernière édition par thierry13 le Jeu 19 Juin 2008 - 16:55, édité 1 fois
Thierry T.
Thierry T.
Membre

Nombre de messages : 664
Age : 29
Localisation : Marseille (13).
Distinction : questionneur à répétition
Date d'inscription : 01/03/2008

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Jeu 19 Juin 2008 - 16:55
Code:
#==================================End Class===================================#

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

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
show_category_window
end
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
alias terminate_KGC_CategorizeItem terminate
def terminate
terminate_KGC_CategorizeItem

@category_window.dispose
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
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
show_category_window
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 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
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
Ps: En français pouvait vous me traduire "Valuables" pendant ce temps je l'ai remplacé par "##"
Problème l.67 !! Pouvez-vous m'aider ??
Douk
Douk
Membre

Nombre de messages : 296
Age : 30
Distinction : aucune
Date d'inscription : 23/04/2008
http://www.arcantia.info-a.googlepages.com/index.html

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Jeu 19 Juin 2008 - 17:09
Moi personnellement c'est déjà fait la traduction(Sauf Valuables) et ça marche.
En plus tu as mis les scripts à l'envers !
Si tu les as mis comme ça dans ton projet, c'est normal que ça marche pas Rolling Eyes
Anonymous
Invité
Invité

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Jeu 19 Juin 2008 - 17:28
Bon! J'vous avais bien dit qu'il fonctionnais!:P Et comme j'ai dit avant thierry13, selon moi, tu dois avoir un autres script qui empeche celui la de marcher comme il le faut!

Et pour Valuables, je vous conseille quelque chose comme Objets de Valeurs, Tresors ou un truc du genre. Moi mon jeu est en anglais alors j'ai pas ce probleme. Smile
Tom1695
Tom1695
Membre

Nombre de messages : 57
Age : 28
Localisation : Tarn
Distinction : aucune
Date d'inscription : 07/04/2008

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Dim 22 Juin 2008 - 9:14
Valuables signifie "De Valeur"
fabY
fabY
Membre

Nombre de messages : 229
Distinction : aucune
Date d'inscription : 29/01/2008
http://rpg-maker-vx.bbactif.com/index.htm

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Mar 24 Juin 2008 - 15:50
C'est un excellent script =). Comme tous ceux qui viennent de chez KGC.
Je l'avais depuis bien bien longtemps moi en tout cas...
Anonymous
Invité
Invité

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Mar 24 Juin 2008 - 20:17
Tout comme moi! Mais j'ai vue qu'il était assez en demande alors je l'ai poster ici! Smile
pizzaman
pizzaman
Membre

Nombre de messages : 17
Distinction : aucune
Date d'inscription : 11/05/2009

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Lun 1 Juin 2009 - 0:56
Salut!!
Y'aurait il moyen de modifier ce SUPERBE script pour n'avoir que : "objets", "armures", "casques", "armes", "boucliers" et "objets clés (objets dont on ne peux pas servir pendant les combats et qu'on obtient qu'en faisant des quêtes)"
kordarr
kordarr
Modérateur

Nombre de messages : 1838
Age : 33
Localisation : île de la réunion, Le Tampon.
Distinction : Auto-proclamé sex-symbol de la commu'
Frère jumeau de Jonathan ( Secret Story )
Exhibitionniste en herbe
[Mist' & Coco' Smile]
Fan n°1 de Coco'
Psychopathe en chef
Date d'inscription : 05/11/2008

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Lun 1 Juin 2009 - 2:03
Mardi 24 juin, on tiens le nécropost de l'année, je t'aurais bien avertis mais je suis gentil^^,t fais attention la prochaine fois...Si tu veux poser des questions va dans "problème de script" et mets un lien vers ce script au lieu de nécroposter.

Et pour ta question je dirai que si tu essayais d'enlever les options non utiles dans le scrit en les effaçant totalement ç a pourrait marcher...ou pas.

Que je t'y reprenne plus.
pizzaman
pizzaman
Membre

Nombre de messages : 17
Distinction : aucune
Date d'inscription : 11/05/2009

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Lun 1 Juin 2009 - 3:12
euh, bon, ok... Mais comme c'était pas vraiment un problème que j'avais avec...
Mais bon, j'vais le faire promis !
Si j'ai bien compris "nécroposter" = remonter vieux topic -> interdit ?

Coco' : Ouais c'est ça...
Contenu sponsorisé

 - Script Catégorie d'objets Empty Re: Script Catégorie d'objets

Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum