Hab schon ein paar Fragen diebezüglich gelesen und find es auch sehr hilfreich:
Ein Script mit dem man Items Klassen zuweisen kann, sodass sie, wenn man bei der Auswahl ist, nur die Items einer bestimmten Klasse angezeigt bekommt und diese Klasse auch problemlos ändern kann.
In meinem Script sind das die Tasten PageUP und PageDOWN
Wie im Header beschrieben, einfach in Zeile 25 die Itemklassen definieren, die man nutzen will. Ich habe eine maximale Anzahl von 9 Klasse ermöglich, da ich denke, dass das genug sein sollte
Des weiteren sind die Zeilen 23 und 24 vielleicht wichtig, da diese definieren, welcher Klasse Waffen bzw. Rüstungszeug angehören
Welches Item zu welcher Kalsse ghört kann man einfach mit dem Itemnamen bestimmen, indem man vor dem Name die zugehörige Klasse schreibt. (z.B. statt "Heiltrank" "1Heiltrank")
Der erste Index beginnt hierbei mit 1.
Um dieses Skript auch auf den Shop oder anderer meiner Skripte zu erweitern hab ich ein zusätzliches Skript für die Klassifizierungserweiterungen erstellt:
##################################################
#
# here the scripts for the item classification
# to enable it everywhere! Just remove the
# doublecharacter infront of the classnames
# and the # before aliases and they will work!
#
##################################################
#############################
#
# for both shopa:
#
#############################
class Window_ShopSell < Window_Selectable
attr_accessor :_active_class
def initialize(klein = 0)
@klein = klein
super(0, 192, 640, 288)
@column_max = 2
self._active_class = 0
refresh
self.index = 0
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 && self._active_class == $game_temp._tidloc_item_classes[i]
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 && self._active_class == $game_temp._tidloc_weaponid
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 && self._active_class == $game_temp._tidloc_armorid
@data.push($data_armors[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
end
#############################
#
# for original shop:
#
#############################
class WWindow_ShopBuy < Window_Selectable
attr_accessor :_active_class
def initialize(shop_goods, klein = 0)
@klein = klein
super(0, 192, 368, 288)
@shop_goods = shop_goods
self._active_class = 0
refresh
self.index = 0
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]] if self._active_class == $game_temp._tidloc_item_classes[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]] if self._active_class == $game_temp._tidloc_weaponid
when 2
item = $data_armors[goods_item[1]] if self._active_class == $game_temp._tidloc_armorid
end
if item != nil
@data.push(item)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
end
class SScene_Shop
# alias wo_classes_main main
def main
@classtemp = 0
@class_window = Window_Class_Display.new(0,128,368)
@class_window.visible = false
wo_classes_main
@class_window.dispose
end
# alias wo_classes_update_command update_command
def update_command
if Input.trigger?(Input::C)
case @command_window.index
when 0
@class_window.visible = true
when 1
@class_window.visible = true
end
end
wo_classes_update_command
end
# alias wo_classes_update_buy update_buy
def update_buy
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cancel_se)
@classtemp += 1
if @classtemp > $game_temp._tidloc_itemclass.size-1
@classtemp = 0
end
@buy_window.index = 0
@class_window._class = @classtemp
@buy_window._active_class = @classtemp
@class_window.refresh
@buy_window.refresh
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cancel_se)
@classtemp -= 1
if @classtemp < 0
@classtemp = $game_temp._tidloc_itemclass.size-1
end
@buy_window.index = 0
@class_window._class = @classtemp
@buy_window._active_class = @classtemp
@class_window.refresh
@buy_window.refresh
end
wo_classes_update_buy
end
# alias wo_classes_update_sell update_sell
def update_sell
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cancel_se)
@classtemp += 1
if @classtemp > $game_temp._tidloc_itemclass.size-1
@classtemp = 0
end
@sell_window.index = 0
@class_window._class = @classtemp
@sell_window._active_class = @classtemp
@class_window.refresh
@sell_window.refresh
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cancel_se)
@classtemp -= 1
if @classtemp < 0
@classtemp = $game_temp._tidloc_itemclass.size-1
end
@sell_window.index = 0
@class_window._class = @classtemp
@sell_window._active_class = @classtemp
@class_window.refresh
@sell_window.refresh
end
wo_classes_update_sell
end
end
#############################
#
# for MeisMe's realistic shop:
#
#############################
class WWindow_ShopBuyBG < Window_Base
def initialize
super(0, 192, 320, 288)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
end
class WWindow_ShopBuy < Window_Selectable
attr_accessor :_active_class
def initialize(shop_goods)
super(0, 224, 320, 156)
@shop_goods = shop_goods
self._active_class = 0
refresh
self.index = 0
self.opacity = 0
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]] if self._active_class == $game_temp._tidloc_item_classes[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]] if self._active_class == $game_temp._tidloc_weaponid
when 2
item = $data_armors[goods_item[1]] if self._active_class == $game_temp._tidloc_armorid
end
if item != nil
@data.push(item)
end
end
@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
end
class WWindow_ShopNumber < Window_Base
def initialize
super(0, 192, 320, 288)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
@max = 1
@price = 0
@number = 1
end
end
class WWindow_ShopNumber2 < Window_Base
def initialize
super(0, 192, 320, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
@max = 1
@number = 1
end
end
class SScene_Shop
# alias wo_classes_main main
def main
@classtemp = 0
@class_window = Window_Class_Display.new(0,128,368)
@class_window.visible = false
wo_classes_main
@class_window.dispose
end
# alias wo_classes_shop_update update
def update
@class_window.update
wo_classes_shop_update
end
# alias wo_classes_command_update update_command
def update_command
if Input.trigger?(Input::C)
case @command_window.index
when 0
@class_window.visible = true
when 1
@class_window.visible = true
end
end
wo_classes_command_update
end
# alias wo_classes_buy_update update_buy
def update_buy
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cancel_se)
@classtemp += 1
if @classtemp > $game_temp._tidloc_itemclass.size-1
@classtemp = 0
end
@buy_window.index = 0
@class_window._class = @classtemp
@buy_window._active_class = @classtemp
@class_window.refresh
@buy_window.refresh
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cancel_se)
@classtemp -= 1
if @classtemp < 0
@classtemp = $game_temp._tidloc_itemclass.size-1
end
@buy_window.index = 0
@class_window._class = @classtemp
@buy_window._active_class = @classtemp
@class_window.refresh
@buy_window.refresh
end
wo_classes_buy_update
end
# alias wo_classes_sell_update update_sell
def update_sell
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cancel_se)
@classtemp += 1
if @classtemp > $game_temp._tidloc_itemclass.size-1
@classtemp = 0
end
@sell_window.index = 0
@class_window._class = @classtemp
@sell_window._active_class = @classtemp
@class_window.refresh
@sell_window.refresh
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cancel_se)
@classtemp -= 1
if @classtemp < 0
@classtemp = $game_temp._tidloc_itemclass.size-1
end
@sell_window.index = 0
@class_window._class = @classtemp
@sell_window._active_class = @classtemp
@class_window.refresh
@sell_window.refresh
end
wo_classes_sell_update
end
end
#############################
#
# for my smithery-script
#
#############################
class Window_Smith_choose < Window_Selectable
attr_accessor :_active_class
def initialize(klein = 0)
@klein = klein
super(0, 128, 320, 354)
@column_max = 1
@_active_class = 0
refresh
self.index = 0
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 && self._active_class == $game_temp._tidloc_item_classes[i]
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 && self._active_class == $game_temp._tidloc_weaponid
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 && self._active_class == $game_temp._tidloc_armorid
@data.push($data_armors[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
end
class Scene_Plan_Smith
# alias wo_classes_smith_main main
def main
@classtemp = 0
@class_window = Window_Class_Display.new(0,64,320)
@class_window.visible = false
wo_classes_smith_main
@class_window.dispose
end
# alias wo_classes_smith_update update
def update
@class_window.update
wo_classes_smith_update
end
# alias wo_classes_command_update update_command
def update_command
if Input.trigger?(Input::C)
if @version==0
if @command_window.index == 1
unless $game_temp.smith_busy[@smith_num] == 1
@class_window.visible = true
end
end
elsif @version==1
if @command_window.index == 0
unless $game_temp.smith_busy[@smith_num] == 1 || @item_window.item_max<1
@class_window.visible = true
end
end
elsif @version==2
if @command_window.index == 0
unless $game_temp.smith_busy[@smith_num] == 1
@class_window.visible = true
end
end
end
end
wo_classes_command_update
end
# alias wo_classes_itemwahl_update update_itemwahl
def update_itemwahl
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cancel_se)
@classtemp += 1
if @classtemp > $game_temp._tidloc_itemclass.size-1
@classtemp = 0
end
@itemwahl_window.index = 0
@class_window._class = @classtemp
@itemwahl_window._active_class = @classtemp
@class_window.refresh
@itemwahl_window.refresh
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cancel_se)
@classtemp -= 1
if @classtemp < 0
@classtemp = $game_temp._tidloc_itemclass.size-1
end
@itemwahl_window.index = 0
@class_window._class = @classtemp
@itemwahl_window._active_class = @classtemp
@class_window.refresh
@itemwahl_window.refresh
end
wo_classes_itemwahl_update
end
# alias wo_classes_forsmith_update update_forsmith
def update_forsmith
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::C)
if $game_temp.smith_choose_item[0] != 0 || $game_temp.smith_cost > 0
@class_window.visible = false
end
end
wo_classes_forsmith_update
end
end
#############################
#
# for my alchemy-script
#
#############################
class Window_Alch_choose < Window_Selectable
attr_accessor :_active_class
def initialize(klein = 0)
@klein = klein
super(0, 128, 320, 354)
@column_max = 1
@_active_class = 0
refresh
self.index = 0
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 && self._active_class == $game_temp._tidloc_item_classes[i]
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 && self._active_class == $game_temp._tidloc_weaponid
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 && self._active_class == $game_temp._tidloc_armorid
@data.push($data_armors[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
for i in 0...@item_max
draw_item(i)
end
end
end
end
class Scene_Plan_Alchemy
# alias wo_classes_alch_main main
def main
@classtemp = 0
@class_window = Window_Class_Display.new(0,64,320)
@class_window.visible = false
wo_classes_alch_main
@class_window.dispose
end
# alias wo_classes_alch_update update
def update
@class_window.update
wo_classes_alch_update
end
# alias wo_classes_command_update update_command
def update_command
if Input.trigger?(Input::C)
if @version==0
if @command_window.index == 1
unless $game_temp.alch_busy[@alch_num] == 1
@class_window.visible = true
end
end
elsif @version==1
if @command_window.index == 0
unless $game_temp.alch_busy[@alch_num] == 1 || @item_window.item_max<1
@class_window.visible = true
end
end
elsif @version==2
if @command_window.index == 0
unless $game_temp.alch_busy[@alch_num] == 1
@class_window.visible = true
end
end
end
end
wo_classes_command_update
end
# alias wo_classes_itemwahl_update update_itemwahl
def update_itemwahl
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cancel_se)
@classtemp += 1
if @classtemp > $game_temp._tidloc_itemclass.size-1
@classtemp = 0
end
@itemwahl_window.index = 0
@class_window._class = @classtemp
@itemwahl_window._active_class = @classtemp
@class_window.refresh
@itemwahl_window.refresh
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cancel_se)
@classtemp -= 1
if @classtemp < 0
@classtemp = $game_temp._tidloc_itemclass.size-1
end
@itemwahl_window.index = 0
@class_window._class = @classtemp
@itemwahl_window._active_class = @classtemp
@class_window.refresh
@itemwahl_window.refresh
end
wo_classes_itemwahl_update
end
# alias wo_classes_foralch_update update_foralch
def update_foralch
if Input.trigger?(Input::B)
@class_window.visible = false
end
if Input.trigger?(Input::C)
if $game_temp.alch_choose_item[0] != 0 || $game_temp.alch_cost > 0
@class_window.visible = false
end
end
wo_classes_foralch_update
end
end