Equipaggiamento dal menù oggetti
DescrizionePermette di equipaggiare gli eroi direttamente dal menù oggetti. Un metodo simile è presente in Tales of Phantasia.
Autore
mikb89
Allegati
N/A
Istruzioni per l'uso
Basta incollare il testo in un nuovo script sopra Main
Spoiler
# Equipaggiamento dal menù oggetti. # Impostare qui il colore che si vuole dare all'equipaggiamento # nella finestra Oggetti. COLORE_EQUIPAGGIAMENTO = Color.new(192, 224, 255, 255) class Scene_Item alias main_w_equip main def main @equip_window = Window_EquipTarget.new @equip_window.visible = false @equip_window.active = false main_w_equip @equip_window.dispose end def update @help_window.update @item_window.update @target_window.update @equip_window.update if @item_window.active update_item return end if @target_window.active update_target return end if @equip_window.active update_equip return end end def update_item 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) @item = @item_window.item if @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor) @item_window.active = false $game_system.se_play($data_system.decision_se) @equip_window.x = (@item_window.index + 1) % 2 * 304 @equip_window.visible = true @equip_window.active = true @equip_window.index = 0 @equip_window.item = @item return end unless $game_party.item_can_use?(@item.id) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) if @item.scope >= 3 @item_window.active = false @target_window.x = (@item_window.index + 1) % 2 * 304 @target_window.visible = true @target_window.active = true if @item.scope == 4 || @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end else if @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $game_system.se_play(@item.menu_se) if @item.consumable $game_party.lose_item(@item.id, 1) @item_window.draw_item(@item_window.index) end $scene = Scene_Map.new return end end return end end def update_equip if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @item_window.refresh @item_window.active = true @equip_window.visible = false @equip_window.active = false return end if Input.trigger?(Input::C) if (@item.is_a?(RPG::Weapon) and $game_party.weapon_number(@item.id) == 0) or (@item.is_a?(RPG::Armor) and $game_party.armor_number(@item.id) == 0) $game_system.se_play($data_system.buzzer_se) return end if $game_party.actors[@equip_window.index].equippable?(@item) $game_system.se_play($data_system.equip_se) if @item.is_a?(RPG::Weapon) $game_party.actors[@equip_window.index].equip(0, @item.id) else $game_party.actors[@equip_window.index].equip(@item.kind + 1, @item.id) end @equip_window.refresh @item_window.refresh else $game_system.se_play($data_system.buzzer_se) end return end end end class Window_EquipTarget < Window_Selectable def initialize super(0, 0, 336, 480) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize self.z += 10 @item_max = $game_party.actors.size refresh end def refresh if @item == nil return end self.contents.clear for i in 0...$game_party.actors.size x = 4 y = i * 116 actor = $game_party.actors[i] if actor.equippable?(@item) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end if @item.is_a?(RPG::Weapon) item1 = $data_weapons[actor.weapon_id] elsif @item.kind == 0 item1 = $data_armors[actor.armor1_id] elsif @item.kind == 1 item1 = $data_armors[actor.armor2_id] elsif @item.kind == 2 item1 = $data_armors[actor.armor3_id] else item1 = $data_armors[actor.armor4_id] end if actor.equippable?(@item) if @item.is_a?(RPG::Weapon) atk1 = item1 != nil ? item1.atk : 0 atk2 = @item != nil ? @item.atk : 0 change = atk2 - atk1 end if @item.is_a?(RPG::Armor) pdef1 = item1 != nil ? item1.pdef : 0 mdef1 = item1 != nil ? item1.mdef : 0 pdef2 = @item != nil ? @item.pdef : 0 mdef2 = @item != nil ? @item.mdef : 0 change = pdef2 - pdef1 + mdef2 - mdef1 end if change > 0 self.contents.font.color = Color.new(0, 256, 0, 256) elsif change < 0 self.contents.font.color = Color.new(256, 0, 0, 256) else self.contents.font.color = normal_color end self.contents.draw_text(x, y + 64, 232, 32, sprintf("%+d", change), 2) end if actor.equippable?(@item) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end self.contents.draw_text(x, y, 120, 32, actor.name) self.contents.draw_text(x + 144, y, 236, 32, actor.class_name) if item1 != nil bitmap = RPG::Cache.icon(item1.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x + 8, y + 4 + 32, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28 + 8, y + 32, 212, 32, item1.name) end self.contents.draw_text(x, y + 64, 232, 32, "Cambiamento:", 0) end end def update_cursor_rect self.cursor_rect.set(0, @index * 116, self.width - 32, 96) end def item=(item) @item = item refresh end end class Window_Item < Window_Selectable def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end if $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end unless item.is_a?(RPG::Item) self.contents.font.color = COLORE_EQUIPAGGIAMENTO end x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) if item.is_a?(RPG::Item) opacity = self.contents.font.color == normal_color ? 255 : 128 else opacity = 255 end self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end end
Bugs e Conflitti Noti
N/A
Altri Dettagli
N/A