![]() |
|
[XP] Crash Skrypt - Wersja do druku +- Ultima Forum (https://forum.ultimateam.pl) +-- Dział: RPG Maker (/Forum-RPG-Maker) +--- Dział: Wsparcie (/Forum-Wsparcie) +--- Wątek: [XP] Crash Skrypt (/Thread-XP-Crash-Skrypt) |
Crash Skrypt - Adrapnikram - 26-08-14 01:53 Mam problem ze skryptem Ayene na menu przedmiotów. Wyskakuje mi problem z nilem na 274 linijce. Skrypt przestaje działać kiedy mam jakiś przedmiot w inwentarzu. Oto skrypt po mojej konfiguracji. Spoiler: (Otwórz) #============================================================================== # Kategoryzacja przedmiotów [XP] # by Ayene # 05.05.2012 ver 1.0 # http://www.ultimateam.pl #============================================================================== # Opis: # Skrypt umożliwia grupowanie przedmiotów w Plecaku w dowolne kategorie, np. # bronie, mapy, przedmioty leczące, klucze itd. W tym celu wystarczy # odpowiednio skonfigurować linijki poniżej (sekcja Konfiguracja). #============================================================================== # Konfiguracja: #============================================================================== module AYE module ITEM_CAT # Poszczególne kategorie przedmiotów wymienione po przecinku. # Muszą być zadeklarowane w CATEGORY_NAME i CATEGORY_ITEMS ITEM_CATEGORIES = [:item, :battle, :weapon, :armor, :acc, :quest, :notes, :maps, :keys, :all] # Nazwy ketegorii CATEGORY_NAME = { # <- nie usuwać # :symbol => ["Komenda", "Opis", "Ikona"], :item => ["Mikstury", "Wyświetla wszystkie mikstury.", "mikstura zycia_d"], :battle => ["Rośliny", "Wyświetla zebrane rośliny.", "Roślina lecznicza"], :weapon => ["Oręż", "Wyświetla wszystkie bronie.", "Oręż"], :armor => ["Prowiant", "Wyświetla przedmioty do zjedzenia.", "Surowe mięso"], :acc => ["Pancerze", "Wyświetla przedmioty obronne.", "Pancerze"], :quest => ["Trofea", "Wyświetla trofea zwierząt.", "Trofea"], :notes => ["Dokumenty", "Wyświetla posiadane dokumenty.", "Książka"], :maps => ["Mapy", "Wyświetla posiadane mapy.", "Mapy"], :keys => ["Inne", "Wyświetla pozostałe rzeczy.", "Węgiel"], :all => ["Wszystkie przedmioty", "Wyświetla wszystkie przedmioty.", "Skrzynka"], } # <- nie usuwać # Przedmioty przypisane do kategorii CATEGORY_ITEMS = { # <- nie usuwać # :symbol => ["Typ" , [ID, ID, ID, ...], # gdzie: Typ w bazie danych - Item (przedmiot), Weapon (broń), Armor (pancerz), # :all - wszystkie kategorie :item => ["Item", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,12, 13, 14, 15, 16, 17, 18,36]], :battle => ["Item", [19, 20, 21, 23, 22, 24, 25, 26,27,28,29,30,31,32,33,34,35,37,38]], :weapon => ["Weapon", :all], :armor => ["Armor", [38,39]], :acc => ["Armor", []], :quest => ["Item", []], :notes => ["Item", [51,52]], :maps => ["Item", [50,53]], :keys => ["Item", [75, 76, 77, 78, 79, 80,81, 82, 83, 84, 85, 86,88,89]], :all => [:all, :all] } # <- nie usuwać end end class Game_Temp #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :item_menu #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias aye_itemcat_gmtemp_ini initialize def initialize aye_itemcat_gmtemp_ini @item_menu = false end end #============================================================================== # ** Game_Party #============================================================================== class Game_Party def all_item_number(item) case item when RPG::Weapon return @weapons.include?(item.id) ? @weapons[item.id] : 0 when RPG::Armor return @armors.include?(item.id) ? @armors[item.id] : 0 else return @items.include?(item.id) ? @items[item.id] : 0 end end end class Window_Help < Window_Base include AYE::ITEM_CAT #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) if $game_temp.item_menu self.y = 480 - height end end end #============================================================================== # ** Window_ItemHelp #============================================================================== class Window_ItemHelp < Window_Base include AYE::ITEM_CAT #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize cw = 32 + ITEM_CATEGORIES.size * 32 super(cw, 0, 640-cw, 64) self.contents = Bitmap.new(width - 32, height - 32) end #-------------------------------------------------------------------------- # * Set Text #-------------------------------------------------------------------------- def set_text(index) if index != @index self.contents.clear self.contents.font.color = normal_color text = CATEGORY_NAME[ITEM_CATEGORIES[index]][0] self.contents.draw_text(4, 0, self.width - 40, 32, text, 1) @index = index end end end #============================================================================== # ** Window_ItemCategory #============================================================================== class Window_ItemCategory < Window_Selectable include AYE::ITEM_CAT #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize cw = 32 + ITEM_CATEGORIES.size * 32 super(0, 0, cw, 64) @commands = ITEM_CATEGORIES @item_max = @commands.size @column_max = @item_max self.contents = Bitmap.new(cw - 32, height - 32) refresh self.index = 0 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @commands.each_with_index {|com, i|draw_item(com, i)} end #-------------------------------------------------------------------------- # * Draw Item # index : item number # color : text character color #-------------------------------------------------------------------------- def draw_item(command, index) rect = Rect.new(0, 0, 24, 24) bitmap = RPG::Cache.icon(CATEGORY_NAME[command][2]) self.contents.blt(4 + 32 * index, 4, bitmap, rect) end #-------------------------------------------------------------------------- # * Cursor Rectangle Update #-------------------------------------------------------------------------- def update_cursor_rect self.cursor_rect.set(@index * 32, 0, 32, 32) end end #============================================================================== # ** Window_Item #============================================================================== class Window_Item < Window_Selectable include AYE::ITEM_CAT #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 352) @column_max = 2 unless $game_temp.in_battle category(0) self.active = false end refresh self.index = 0 if $game_temp.in_battle self.y = 64 self.height = 256 self.back_opacity = 160 end end #-------------------------------------------------------------------------- # * Category #-------------------------------------------------------------------------- def category(index) self.index = 0 @items = [] @category = ITEM_CATEGORIES[index] @itemtype = CATEGORY_ITEMS[@category][0] if @category != :all @items = CATEGORY_ITEMS[@category][1] end end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] if $game_temp.in_battle for i in 1...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end else @all_item = [] case @itemtype when "Item" @all_item = $data_items when "Weapon" @all_item = $data_weapons when "Armor" @all_item = $data_armors else @all_item = $data_items + $data_weapons + $data_armors end @all_item.each{|item| unless item == nil if $game_party.all_item_number(item) > 0 if @category != :all and @items != :all if @items.include?(item.id) @data.push(item) end else @data.push(item) end end 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 #============================================================================== # ** Scene_Item #============================================================================== class Scene_Item include AYE::ITEM_CAT #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- alias aye_itemcat_scitem_main main def main $game_temp.item_menu = true @category_window = Window_ItemCategory.new @catname_window = Window_ItemHelp.new @catname_window.set_text(@category_window.index) aye_itemcat_scitem_main $game_temp.item_menu = false @category_window.dispose @catname_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- alias aye_itemcat_scitem_update update def update @category_window.update @catname_window.update if @category_window.active update_category return end aye_itemcat_scitem_update end #-------------------------------------------------------------------------- # * Frame Update (when category window is active) #-------------------------------------------------------------------------- def update_category @help_window.set_text(CATEGORY_NAME[ITEM_CATEGORIES[@category_window.index]][1]) @item_window.category(@category_window.index) if Input.repeat?(Input::RIGHT) || Input.repeat?(Input::LEFT) @item_window.refresh @catname_window.set_text(@category_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 @category_window.active = false return end end #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- alias aye_itemcat_scitem_update_item update_item def update_item if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @item_window.active = false @category_window.active = true return else aye_itemcat_scitem_update_item return end end end RE: Crash Skrypt - Ayene - 26-08-14 11:45 Sideview nadpisywał część klas, używanych przez skrypt na kategoryzację. Napisz swój plik Scripts poniższym. Pamiętaj o kopii zapasowej. https://www.sendspace.com/file/627h3f RE: Crash Skrypt - Adrapnikram - 26-08-14 12:32 Mam kopię zapasową :D Wielkie dzięki Aye. Ląduje "Pomógł". Można zamknąć. |
