Shepher Admin
Número de Mensagens : 87 Idade : 28
| Assunto: [RGSS2]1 Player menu Completo Qui Jun 03, 2010 7:23 pm | |
| 1 Player Menu por VitorJ Introdução Esse menu foi feito para jogos com 1 só protagonista. Mostrando tudo sobre ele, E também tem modificações em todas as outras scenes derivadas do menu, Exceto Save Características
- Otimo para jogos com um player só, focando totalmente nele
- Modifica quase todas as scenes
- Tem opções por icones
- Da um ar mais agradavel pro jogo
Screenshots- Spoiler:
Principal: Item: Habilidade: Equipamento: Status: Sair: Como usarCole acima do main e costumize-o a seu gosto. Demohttp://www.4shared.com/file/135648457/1d5e381f/1_Player_Menu.htmlScript- Spoiler:
- Código:
-
#==============================================================================# # VX Menu 1 Player By VitorJ #==============================================================================#
module Menu MenuBack = "MenuFundo" # Nome da imagen de fundo do menu. BackOpac = 160 # Opacidade da imagen de fundo. Map = true # Vai mostrar o mapa no fundo? EXP = "XP" # Sigla da experiencia EXP_C_1 = Color.new(218,236,0) # Cor inicial do XP EXP_C_2 = Color.new(165,236,0) # Cor final do XP ICONS = [216,217,218,219,220,221] # Index dos icones na ordem das opções GOLD = false # Mostrar a janela de dinheiro? UNEQ = "Desequipado" # Texto que sera mostrado onde o heroi não estiver com equipamento PlayTime = "Tempo de Jogo" # Texto do tempo de jogo SaveCount = "Numero de Saves" # Texto para o numero de vezes que salvou StepCount = "Numero de Passos" # Texto para o numero de passos que o player deu Gold = "Dinheiro" # Nome do contador de dinheiro Map = "Mapa Atual" # Informação sobre o mapa ICONS2 = [188,222,48,205] # Icones (Mesma ordem dos textos acima, o mapa não tem icone) # ▼ Atributos que vão aparecer no status, coloque o ID dele. ▼ Attrib = [9, 10, 11, 12, 13, 14, 15, 16] ICONS3 = [104,105,106,107,108,109,110,111] # Icones na mesma ordem acima ICONS4 = [120,121,122,123] # Icone dos parametros #STR,DEF,INT,AGI Element = "Defesa" # Nome da informação de elementos Scenes = [true,true,true,true,true,true] # Scenes que serão modificadas #Item,Skil,Equi,Stat,Save,Sair end
class Window_Base def draw_actor_xp(actor, x, y, width = 120) draw_actor_xp_gauge(actor, x, y, width) self.contents.font.color = system_color self.contents.draw_text(x, y, 30, WLH, Menu::EXP) self.contents.font.color = Color.new(255,255,255) xr = x + width if width < 120 self.contents.draw_text(xr - 40, y, 40, WLH, actor.now_exp.to_s, 2) else self.contents.draw_text(xr - 90, y, 40, WLH, actor.now_exp.to_s, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2) self.contents.draw_text(xr - 40, y, 40, WLH, actor.next_exp.to_s, 2) end end
def draw_actor_xp_gauge(actor, x, y, width = 120) if actor.next_exp != 0 rate = actor.now_exp.to_f / actor.next_exp else rate = 1 end gw = width * rate gc1 = Menu::EXP_C_1 gc2 = Menu::EXP_C_2 self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color) self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2) end end class Game_Map attr_reader :map_id def mapname mapa = load_data("Data/MapInfos.rvdata") return mapa[@map_id].name end end
class Window_StatGeral < Window_Base def initialize(x,y) super(20, 227, 504, (24*6)+32) self.contents = Bitmap.new(width - 32, height - 32) @blink = false @t = 0 refresh end def refresh self.contents.clear w = 24 x = 204 self.contents.font.color = system_color draw_icon(Menu::ICONS2[0], 0, 0) self.contents.draw_text(32, 0, x, 24, Menu::PlayTime) @sec = Graphics.frame_count / Graphics.frame_rate hor = @sec / 60 / 60 min = @sec / 60 % 60 seg = @sec % 60 text = sprintf("%02d:%02d:%02d", hor, min, seg) text = sprintf("%02d %02d %02d", hor, min, seg) if @blink self.contents.font.color = normal_color self.contents.draw_text(0, w, x, 24, text, 2) self.contents.font.color = system_color draw_icon(Menu::ICONS2[1], 236, 0) self.contents.draw_text(236+32, 0, x, 24, Menu::SaveCount) text = "#{$game_system.save_count}" self.contents.font.color = normal_color self.contents.draw_text(236, w, x, 24, text, 2) self.contents.font.color = system_color draw_icon(Menu::ICONS2[2], 0, w*2) self.contents.draw_text(32, w*2, x, 24, Menu::StepCount) text = "#{$game_party.steps}" self.contents.font.color = normal_color self.contents.draw_text(0, w*3, x, 24, text, 2) self.contents.font.color = system_color draw_icon(Menu::ICONS2[3], 236, w*2) self.contents.draw_text(32+236, w*2, x, 24, Menu::Gold) text = "#{$game_party.gold}" self.contents.font.color = normal_color self.contents.draw_text(236, w*3, x, 24, text, 2) self.contents.font.color = system_color self.contents.draw_text(0, w*4, 472, 24, Menu::Map,1) text = "#{$game_map.mapname}" self.contents.font.color = normal_color self.contents.draw_text(0, w*5, 472, 24, text, 1) end def update super if Graphics.frame_count / Graphics.frame_rate != @sec @blink = true @t = 5 refresh end @t -= 1 if @t > 0 if @t == 0 @blink = false refresh end end end
class New_StatMenu < Window_Base def initialize(x, y) super(x, y, 92+128+32, 24*5 + 32) refresh end def refresh self.contents.clear actor = $game_party.members[0] draw_actor_face(actor, 0, 0, 92) draw_actor_state(actor, -1, 92+1) x = 92+4 y = -4 w = 24 draw_actor_name(actor, x, y) draw_actor_level(actor, x, y + w) draw_actor_hp(actor, x, y + w * 2) draw_actor_mp(actor, x, y + w * 3) draw_actor_xp(actor, x, y + w * 4) end end
class EquipMenu < Window_Base def initialize(x, y) super(x, y, 92+128+32, 24*5 + 32) refresh end def refresh self.contents.clear @actor = $game_party.members[0] @data = [] for item in @actor.equips do @data.push(item) end @item_max = @data.size self.contents.font.color = system_color w = 24 draw_item_name(@data[0], 0, w * 0) draw_item_name(@data[1], 0, w * 1,1) draw_item_name(@data[2], 0, w * 2) draw_item_name(@data[3], 0, w * 3,1) draw_item_name(@data[4], 0, w * 4) end def draw_item_name(item, x, y,type=0) if item != nil w = 0 w = (self.width - 32)-24 if type > 0 draw_icon(item.icon_index, x+w, y) self.contents.font.color = normal_color self.contents.font.color.alpha = 255 self.contents.draw_text(x + 24, y, 172, WLH, item.name) else self.contents.font.color = normal_color self.contents.font.color.alpha = 255 self.contents.draw_text(x + 24, y, 172, WLH, Menu::UNEQ) end end end
class Window_MenuCommand < Window_Selectable
attr_reader :commands # Comandos
def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32) if row_max == 0 row_max = ((commands.size) +1 + column_max - 1) / column_max end super(0, 0, width, row_max * WLH + 32, spacing) @commands = commands @item_max = commands.size @column_max = column_max refresh self.index = 0 end
def refresh self.contents.clear self.contents.draw_text(Rect.new(0,0,128,24), "Usar?") for i in 0...@item_max draw_item(i) end end
def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, @commands[index]) end def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = (contents.width + @spacing) / @column_max - @spacing rect.height = WLH rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * WLH rect.y += 24 return rect end end
######################### # Ajustes na Scene_Menu # #########################
class Icon_Commands < Window_Selectable
attr_reader :commands # Comandos
def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32) if row_max == 0 row_max = (commands.size + column_max - 1) / column_max end row_max = 1 super(94, 158, 356, 64) @commands = commands @item_max = commands.size @column_max = 6 refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end
def draw_item(index, enabled = true) rect = item_rect(index) self.contents.clear_rect(rect) draw_icon(Menu::ICONS[index], rect.x, rect.y, enabled) end def draw_icon(icon_index, x, y, enabled = true) bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128) end def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = 24 rect.height = 24 rect.x = index % @column_max * (rect.width*2) +30 rect.y = index / @column_max + 4 return rect end end
class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end
class Scene_Menu < Scene_Base
def initialize(menu_index = 0) @menu_index = menu_index end
def start super create_menu_background create_command_window @c = 1 @c2 = 0 @c3 = 0 @gold_window = Window_Gold.new(80, 124) @gold_window.visible = Menu::GOLD @status_window = New_StatMenu.new(272, 0) @equip = EquipMenu.new(20,0) @statgeral = Window_StatGeral.new(148,188+24) end def create_menu_background @menuback_sprite = Sprite.new @menuback_sprite.bitmap = $game_temp.background_bitmap @menuback_sprite.color.set(16, 16, 16, 128) @menuback_sprite.visible = Menu::Map @back = Sprite.new @back.bitmap = Cache.system(Menu::MenuBack) @back.opacity = Menu::BackOpac update_menu_background end def terminate super dispose_menu_background @statgeral.dispose @equip.dispose @back.dispose @command_window.dispose @gold_window.dispose @status_window.dispose end
def update super update_menu_background @statgeral.update @command_window.update @gold_window.update @status_window.update if @command_window.active update_command_selection elsif @status_window.active update_actor_selection end end def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end @command_window = Icon_Commands.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index if $game_party.members.size == 0 # Se não houver membros na equipe @command_window.draw_item(0, false) # Desabilita "Items" @command_window.draw_item(1, false) # Desabilita "Habilidades" @command_window.draw_item(2, false) # Desabilita "Equipamentos" @command_window.draw_item(3, false) # Desabilita "Status" end if $game_system.save_disabled # Se salvar for proibido @command_window.draw_item(4, false) # Desabilita "Salvar" end end
def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1 $scene = Scene_Skill.new(0) when 2 $scene = Scene_Equip.new(0) when 3 $scene = Scene_Status.new(0) when 4 # Salvar $scene = Scene_File.new(true, false, false) when 5 # Fim de jogo $scene = Scene_End.new end end end
def start_actor_selection @command_window.active = false @status_window.active = true if $game_party.last_actor_index < @status_window.item_max @status_window.index = $game_party.last_actor_index else @status_window.index = 0 end end
def end_actor_selection @command_window.active = true @status_window.active = false @status_window.index = -1 end
def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when 1 # Habilidades $scene = Scene_Skill.new(@status_window.index) when 2 # Equipamento $scene = Scene_Equip.new(@status_window.index) when 3 # Status $scene = Scene_Status.new(@status_window.index) end end end end
######################### # Ajustes na Scene_Item # ######################### if Menu::Scenes[0] class Window_Item < Window_Selectable
def initialize(x, y, width, height) super(x, y, width, height) @column_max = 2 @spacing = 18 self.index = 0 refresh end def create_contents self.contents.dispose self.contents = Bitmap.new(width - 32, [height - 32, (row_max * WLH)].max) end def item return @data[self.index] end
def include?(item) return false if item == nil if $game_temp.in_battle return false unless item.is_a?(RPG::Item) end return true end
def enable?(item) return $game_party.item_can_use?(item) end
def refresh @data = [] for item in $game_party.items next unless include?(item) @data.push(item) if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = @data.size - 1 end end @data.push(nil) if include?(nil) @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end
def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.item_number(item) enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) self.contents.draw_text(rect, sprintf(":%2d", number), 2) end end
def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = (contents.width + @spacing) / @column_max - @spacing rect.height = WLH rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * WLH return rect end
def update_help @help_window.set_text(item == nil ? "" : item.description) end end
class Scene_Item < Scene_Base
def start super create_menu_background @t = 0 @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Help.new @help_window.y = 416-(24+32) @help_window.viewport = @viewport @item_window = Window_Item.new(20, 158, 504, 200) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.active = false @target_window = Window_MenuStatus.new(0, 0) @status_window = New_StatMenu.new(272, 0) @equip = EquipMenu.new(20,0) @decision = Window_MenuCommand.new(128, ["Sim","Não"]) @decision.x = 208 @decision.y = 208 @decision.visible = false @decision.active = false hide_target_window end def create_menu_background @menuback_sprite = Sprite.new @menuback_sprite.bitmap = $game_temp.background_bitmap @menuback_sprite.color.set(16, 16, 16, 128) @menuback_sprite.visible = Menu::Map @back = Sprite.new @back.bitmap = Cache.system(Menu::MenuBack) @back.opacity = Menu::BackOpac update_menu_background end
def terminate super dispose_menu_background @decision.dispose @status_window.dispose @equip.dispose @back.dispose @viewport.dispose @help_window.dispose @item_window.dispose @target_window.dispose end
def return_scene $scene = Scene_Menu.new(0) end
def update super update_menu_background @help_window.update @item_window.update @target_window.update @status_window.update if @item_window.active update_item_selection elsif @target_window.active update_target_selection end if @decision.active @decision.update comfirm_update end if @t > 0 @t -= 1 end end
def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) and @t == 0 @item = @item_window.item if @item != nil $game_party.last_item_id = @item.id end if $game_party.item_can_use?(@item) Sound.play_decision @decision.active = true @decision.visible = true @item_window.active = false else Sound.play_buzzer end @t += 1 end end def comfirm_update if Input.trigger?(Input::B) Sound.play_cancel @decision.active = false @decision.visible = false @decision.index = 0 @item_window.active = true elsif Input.trigger?(Input::C) and @t == 0 @item = @item_window.item case @decision.index when 0 @decision.active = false @decision.visible = false @item_window.active = true if not $game_party.item_can_use?(@item) Sound.play_buzzer else Sound.play_decision determine_target end when 1 Sound.play_cancel @decision.active = false @decision.visible = false @item_window.active = true @decision.index = 0 end @t += 1 end end def determine_item if @item.for_friend? show_target_window(@item_window.index % 2 == 0) if @item.for_all? @target_window.index = 99 else if $game_party.last_target_index < @target_window.item_max @target_window.index = $game_party.last_target_index else @target_window.index = 0 end end else use_item_nontarget end end
def update_target_selection if Input.trigger?(Input::B) Sound.play_cancel if $game_party.item_number(@item) == 0 # Se usar itens até 0 @item_window.refresh # Atualizar janela end hide_target_window elsif Input.trigger?(Input::C) if not $game_party.item_can_use?(@item) Sound.play_buzzer else determine_target end end end
def determine_target used = false if @item.for_all? for target in $game_party.members target.item_effect(target, @item) used = true unless target.skipped end else $game_party.last_target_index = @target_window.index target = $game_party.members[0] target.item_effect(target, @item) used = true unless target.skipped end if used use_item_nontarget else Sound.play_buzzer end @status_window.refresh end
def show_target_window(right) @item_window.active = false width_remain = 544 - @target_window.width @target_window.x = right ? width_remain : 0 @target_window.visible = true @target_window.active = true if right @viewport.rect.set(0, 0, width_remain, 416) @viewport.ox = 0 else @viewport.rect.set(@target_window.width, 0, width_remain, 416) @viewport.ox = @target_window.width end end
def hide_target_window @item_window.active = true @target_window.visible = false @target_window.active = false @viewport.rect.set(0, 0, 544, 416) @viewport.ox = 0 end
def use_item_nontarget Sound.play_use_item $game_party.consume_item(@item) @item_window.draw_item(@item_window.index) @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $scene = Scene_Map.new end end end end ########################## # Ajustes na Scene_Skill # ########################## if Menu::Scenes[1] class Window_Skill < Window_Selectable
def initialize(x, y, width, height, actor) super(x, y, width, height) @actor = actor @column_max = 2 self.index = 0 refresh end
def skill return @data[self.index] end
def refresh @data = [] for skill in @actor.skills @data.push(skill) if skill.id == @actor.last_skill_id self.index = @data.size - 1 end end @item_max = @data.size create_contents for i in 0...@item_max draw_item(i) end end
def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil rect.width -= 4 enabled = @actor.skill_can_use?(skill) draw_item_name(skill, rect.x, rect.y, enabled) self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2) end end
def update_help @help_window.set_text(skill == nil ? "" : skill.description) end end
class Scene_Skill < Scene_Base
def initialize(actor_index = 0, equip_index = 0) @actor_index = actor_index end
def start super create_menu_background @t = 0 @actor = $game_party.members[0] @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Help.new @help_window.viewport = @viewport @help_window.y = 416-(24+32) @skill_window = Window_Skill.new(20, 158, 504, 200,@actor) @skill_window.viewport = @viewport @skill_window.help_window = @help_window @target_window = Window_MenuStatus.new(0, 0) @status_window = New_StatMenu.new(272, 0) @equip = EquipMenu.new(20,0) @decision = Window_MenuCommand.new(128, ["Sim","Não"]) @decision.x = 208 @decision.y = 208 @decision.visible = false @decision.active = false hide_target_window end def create_menu_background @menuback_sprite = Sprite.new @menuback_sprite.bitmap = $game_temp.background_bitmap @menuback_sprite.color.set(16, 16, 16, 128) @menuback_sprite.visible = Menu::Map @back = Sprite.new @back.bitmap = Cache.system(Menu::MenuBack) @back.opacity = Menu::BackOpac update_menu_background end def terminate super dispose_menu_background @decision.dispose @status_window.dispose @equip.dispose @back.dispose @help_window.dispose @skill_window.dispose @target_window.dispose end
def return_scene $scene = Scene_Menu.new(1) end
def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Skill.new(@actor_index) end
def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Skill.new(@actor_index) end
def update super update_menu_background @help_window.update @skill_window.update @target_window.update if @skill_window.active update_skill_selection elsif @target_window.active update_target_selection end if @decision.active comfirm_update @decision.update end if @t > 0 @t -= 1 end end def update_skill_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) and @t = 0 @skill = @skill_window.skill if @skill != nil @actor.last_skill_id = @skill.id end if @actor.skill_can_use?(@skill) Sound.play_decision @decision.visible = true @decision.active = true @skill_window.active = false else Sound.play_buzzer end @t += 1 end end def comfirm_update if Input.trigger?(Input::B) Sound.play_cancel @decision.active = false @decision.visible = false @decision.index = 0 @skill_window.active = true elsif Input.trigger?(Input::C) and @t == 0 @skill = @skill_window.skill case @decision.index when 0 @decision.active = false @decision.visible = false @decision.index = 0 @skill_window.active = true if not @actor.skill_can_use?(@skill) Sound.play_buzzer else Sound.play_decision determine_target end when 1 Sound.play_cancel @decision.active = false @decision.visible = false @skill_window.active = true @decision.index = 0 end @t += 1 end end
def determine_skill if @skill.for_friend? show_target_window(@skill_window.index % 2 == 0) if @skill.for_all? @target_window.index = 99 elsif @skill.for_user? @target_window.index = @actor_index + 100 else if $game_party.last_target_index < @target_window.item_max @target_window.index = $game_party.last_target_index else @target_window.index = 0 end end else use_skill_nontarget end end
def update_target_selection if Input.trigger?(Input::B) Sound.play_cancel hide_target_window elsif Input.trigger?(Input::C) if not @actor.skill_can_use?(@skill) Sound.play_buzzer else determine_target end end end
def determine_target used = false if @skill.for_all? for target in $game_party.members target.skill_effect(@actor, @skill) used = true unless target.skipped end elsif @skill.for_user? target = $game_party.members[0] target.skill_effect(@actor, @skill) used = true unless target.skipped else $game_party.last_target_index = @target_window.index target = $game_party.members[0] target.skill_effect(@actor, @skill) used = true unless target.skipped end if used use_skill_nontarget else Sound.play_buzzer end end
def show_target_window(right) @skill_window.active = false width_remain = 544 - @target_window.width @target_window.x = right ? width_remain : 0 @target_window.visible = true @target_window.active = true if right @viewport.rect.set(0, 0, width_remain, 416) @viewport.ox = 0 else @viewport.rect.set(@target_window.width, 0, width_remain, 416) @viewport.ox = @target_window.width end end
def hide_target_window @skill_window.active = true @target_window.visible = false @target_window.active = false @viewport.rect.set(0, 0, 544, 416) @viewport.ox = 0 end
def use_skill_nontarget Sound.play_use_skill @actor.mp -= @actor.calc_mp_cost(@skill) @status_window.refresh @skill_window.refresh @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $scene = Scene_Map.new end end end end ########################## # Ajustes na Scene_Equip # ########################## if Menu::Scenes[2] class Window_Equip < Window_Selectable
def initialize(x, y, actor) super(x, y, 92+128+32, WLH * 5 + 32) @actor = actor refresh self.index = 0 end
def item return @data[self.index] end
def refresh self.contents.clear @actor = $game_party.members[0] @data = [] for item in @actor.equips do @data.push(item) end @item_max = @data.size self.contents.font.color = system_color w = 24 draw_item_name(@data[0], 0, w * 0) draw_item_name(@data[1], 0, w * 1,1) draw_item_name(@data[2], 0, w * 2) draw_item_name(@data[3], 0, w * 3,1) draw_item_name(@data[4], 0, w * 4) end def draw_item_name(item, x, y,type=0) if item != nil w = 0 w = (self.width - 32)-24 if type > 0 draw_icon(item.icon_index, x+w, y) self.contents.font.color = normal_color self.contents.font.color.alpha = 255 self.contents.draw_text(x + 24, y, 172, WLH, item.name) else self.contents.font.color = normal_color self.contents.font.color.alpha = 255 self.contents.draw_text(x + 24, y, 172, WLH, Menu::UNEQ) end end
def update_help @help_window.set_text(item == nil ? "" : item.description) end end
class Window_EquipStatus < Window_Base
def initialize(x, y, actor) super(x, y, 92+128+32, 24*5 + 32) @actor = actor refresh end
def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_parameter(0, WLH * 1, 0) draw_parameter(0, WLH * 2, 1) draw_parameter(0, WLH * 3, 2) draw_parameter(0, WLH * 4, 3) end
def set_new_parameters(new_atk, new_def, new_spi, new_agi) if @new_atk != new_atk or @new_def != new_def or @new_spi != new_spi or @new_agi != new_agi @new_atk = new_atk @new_def = new_def @new_spi = new_spi @new_agi = new_agi refresh end end
def new_parameter_color(old_value, new_value) if new_value > old_value # Mais forte return power_up_color elsif new_value == old_value # Sem mudança return normal_color else # Mais fraco return power_down_color end end
def draw_parameter(x, y, type) case type when 0 name = Vocab::atk value = @actor.atk new_value = @new_atk when 1 name = Vocab::def value = @actor.def new_value = @new_def when 2 name = Vocab::spi value = @actor.spi new_value = @new_spi when 3 name = Vocab::agi value = @actor.agi new_value = @new_agi end self.contents.font.color = system_color self.contents.draw_text(x + 4, y, 80, WLH, name) self.contents.font.color = normal_color self.contents.draw_text(x + 90, y, 30, WLH, value, 2) self.contents.font.color = system_color self.contents.draw_text(x + 122, y, 20, WLH, "→", 1) if new_value != nil self.contents.font.color = new_parameter_color(value, new_value) self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2) end end end
class Scene_Equip < Scene_Base
EQUIP_TYPE_MAX = 5 # Número máximo de equipamentos
def initialize(actor_index = 0, equip_index = 0) @actor_index = actor_index @equip_index = equip_index end
def start super create_menu_background @actor = $game_party.members[@actor_index] @help_window = Window_Help.new @help_window.y = 416-(24+32) create_item_windows @equip_window = Window_Equip.new(20, 0, @actor) @equip_window.help_window = @help_window @equip_window.index = @equip_index @status_window = Window_EquipStatus.new(272, 0, @actor) end def create_menu_background @menuback_sprite = Sprite.new @menuback_sprite.bitmap = $game_temp.background_bitmap @menuback_sprite.color.set(16, 16, 16, 128) @menuback_sprite.visible = Menu::Map @back = Sprite.new @back.bitmap = Cache.system(Menu::MenuBack) @back.opacity = Menu::BackOpac update_menu_background end
def terminate super dispose_menu_background @back.dispose @help_window.dispose @equip_window.dispose @status_window.dispose dispose_item_windows end
def return_scene $scene = Scene_Menu.new(2) end
def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index) end
def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Equip.new(@actor_index, @equip_window.index) end
def update super update_menu_background @help_window.update update_equip_window update_status_window update_item_windows if @equip_window.active update_equip_selection elsif @item_window.active update_item_selection end end
def create_item_windows @item_windows = [] for i in 0...EQUIP_TYPE_MAX @item_windows[i] = Window_EquipItem.new(20, 158, 504, 200, @actor, i) @item_windows[i].help_window = @help_window @item_windows[i].visible = (@equip_index == i) @item_windows[i].y = 158 @item_windows[i].height = 200 @item_windows[i].active = false @item_windows[i].index = -1 end end
def dispose_item_windows for window in @item_windows window.dispose end end
def update_item_windows for i in 0...EQUIP_TYPE_MAX @item_windows[i].visible = (@equip_window.index == i) @item_windows[i].update end @item_window = @item_windows[@equip_window.index] end
def update_equip_window @equip_window.update end
def update_status_window if @equip_window.active @status_window.set_new_parameters(nil, nil, nil, nil) elsif @item_window.active temp_actor = @actor.clone temp_actor.change_equip(@equip_window.index, @item_window.item, true) new_atk = temp_actor.atk new_def = temp_actor.def new_spi = temp_actor.spi new_agi = temp_actor.agi @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi) end @status_window.update end
def update_equip_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) if @actor.fix_equipment Sound.play_buzzer else Sound.play_decision @equip_window.active = false @item_window.active = true @item_window.index = 0 end end end
def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel @equip_window.active = true @item_window.active = false @item_window.index = -1 elsif Input.trigger?(Input::C) Sound.play_equip @actor.change_equip(@equip_window.index, @item_window.item) @equip_window.active = true @item_window.active = false @item_window.index = -1 @equip_window.refresh for item_window in @item_windows item_window.refresh end end end end end ########################### # Ajustes na Scene_Status # ########################### if Menu::Scenes[3] class Window_Status < Window_Base def initialize(actor) super(20, 158, 504, 256) @actor = actor refresh end
def refresh self.contents.clear draw_parameters(0, 0) draw_elements(288,0) end
def draw_parameters(x, y) w = 24 icon = Menu::ICONS4 for i in 0..3 draw_actor_parameter(@actor, x+w, y + w * i, i) draw_icon(icon[i],x,y + w*i) end end def draw_exp_info(x, y) s1 = @actor.exp_s s2 = @actor.next_rest_exp_s s_next = sprintf(Vocab::ExpNext, Vocab::level) self.contents.font.color = system_color self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal) self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next) self.contents.font.color = normal_color self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2) self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2) end
def draw_equipments(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip) for i in 0..4 draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1)) end end def draw_elements(x,y) attrib = Menu::Attrib attrib.compact! icon = Menu::ICONS3 icon.compact! self.contents.font.color = system_color self.contents.draw_text(x, y, 180, WLH, Menu::Element) for i in 0..(attrib.size)-1 self.contents.font.color = system_color text = $data_system.elements[attrib[i]] draw_icon(icon[i],x,y + WLH*(i+1)) self.contents.draw_text(x+24, y + WLH*(i+1), 180, WLH, text) self.contents.font.color = normal_color text = @actor.element_rate(attrib[i]) text /= 2 text = 100-text text = "#{text}%" self.contents.draw_text(x, y + WLH*(i+1), 180, WLH, text,2) end end end
class Scene_Status < Scene_Base
def initialize(actor_index = 0) @actor_index = actor_index end
def start super create_menu_background @actor = $game_party.members[@actor_index] @status_window = Window_Status.new(@actor) @status_window2 = New_StatMenu.new(272, 0) @equip = EquipMenu.new(20,0) end def create_menu_background @menuback_sprite = Sprite.new @menuback_sprite.bitmap = $game_temp.background_bitmap @menuback_sprite.color.set(16, 16, 16, 128) @menuback_sprite.visible = Menu::Map @back = Sprite.new @back.bitmap = Cache.system(Menu::MenuBack) @back.opacity = Menu::BackOpac update_menu_background end
def terminate super dispose_menu_background @back.dispose @equip.dispose @status_window2.dispose @status_window.dispose end
def return_scene $scene = Scene_Menu.new(3) end
def next_actor @actor_index += 1 @actor_index %= $game_party.members.size $scene = Scene_Status.new(@actor_index) end
def prev_actor @actor_index += $game_party.members.size - 1 @actor_index %= $game_party.members.size $scene = Scene_Status.new(@actor_index) end
def update update_menu_background @status_window.update if Input.trigger?(Input::B) Sound.play_cancel return_scene end super end end
end
######################## # Ajustes na Scene_End # ######################## if Menu::Scenes[5] class Scene_End < Scene_Base
def start super create_menu_background @status_window = New_StatMenu.new(272, 0) @equip = EquipMenu.new(20,0) create_command_window end def create_menu_background @menuback_sprite = Sprite.new @menuback_sprite.bitmap = $game_temp.background_bitmap @menuback_sprite.color.set(16, 16, 16, 128) @menuback_sprite.visible = Menu::Map @back = Sprite.new @back.bitmap = Cache.system(Menu::MenuBack) @back.opacity = Menu::BackOpac update_menu_background end
def post_start super open_command_window end
def pre_terminate super close_command_window end
def terminate super @status_window.dispose @equip.dispose dispose_command_window dispose_menu_background end
def return_scene $scene = Scene_Menu.new(5) end
def update super update_menu_background @command_window.update if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) case @command_window.index when 0 # タイトルへ command_to_title when 1 # シャットダウン command_shutdown when 2 # やめる command_cancel end end end
def update_menu_background super @menuback_sprite.tone.set(0, 0, 0, 128) end
def create_command_window s1 = Vocab::to_title s2 = Vocab::shutdown s3 = Vocab::cancel @command_window = Window_Command.new(172, [s1, s2, s3]) @command_window.x = (544 - @command_window.width) / 2 @command_window.y = (416 - @command_window.height) / 2 @command_window.openness = 0 end
def dispose_command_window @command_window.dispose end
def open_command_window @command_window.open begin @command_window.update Graphics.update end until @command_window.openness == 255 end
def close_command_window @command_window.close begin @command_window.update Graphics.update end until @command_window.openness == 0 end
def command_to_title Sound.play_decision RPG::BGM.fade(800) RPG::BGS.fade(800) RPG::ME.fade(800) $scene = Scene_Title.new close_command_window Graphics.fadeout(60) end
def command_shutdown Sound.play_decision RPG::BGM.fade(800) RPG::BGS.fade(800) RPG::ME.fade(800) $scene = nil end
def command_cancel Sound.play_decision return_scene end end
end Créditos e Agradecimentos[/i]
- VitorJ, Por criar o script.
Observações do AutorSugestões bem-vindas, Principalmente para o Scene_Status. Esse é o iconset usado por min no script. - Spoiler:
| |
|