Douglanilo
Mestre
Postagens : 959 Data de inscrição : 02/04/2009
| Assunto: Menu do VX v1.0 Dom Out 11, 2009 3:22 pm | |
| Menu do VX v1.0 por NicholasRg IntroduçãoPara os fãs do VX, eis aí uma boa réplica feita pelo grande Nicholas! Características- Menu customizado que adiciona barras de hp,sp e exp a qualquer menu que informe o hp.. e etc. - Se o seu personagen não tiver uma face , o menu funcionará do mesmo geito.. não irá dar aquele lag de "Não encontrado" Como UsarPrimeiramente insira o script acima do main, e o menu já estára funcionando. Para que as faces apareçam vocês devem colocar elas com o nome do personagem _fc .. Exemplo : "Ash_fc" então esse seria o nome da face do ash , se não entenderam direito baixem a demo. ScreenshotsDemohttp://www.4shared.com/file/140126828/e1dddeb8/Menu_do_VX.htmlscript - Código:
-
# Menu do VX , por NicholasRg # agradeço moghunter pois aprendi rgss com os menus dele # e Cogwheel pelo script de barras de hp e sp class Window_Base < Window def nada face = RPG::Cache.picture("") end def drw_face(actor,x,y) face = RPG::Cache.picture(actor.name "_fc") rescue nada cw = face.width ch = face.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x , y - ch, face, src_rect) end end class Scene_Menu def initialize(menu_index = 0) @menu_index = menu_index end def main # Criar janela de comando s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "Status" s5 = "Salvar" s6 = "Fim de Jogo" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.opacity = 230 @command_window.index = @menu_index # Se o número de membros do Grupo de Heróis for 0 if $game_party.actors.size == 0 # Desabilar as janelas de Item, Habilidades, Equipamento e Status @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # Se Salvar for Proibido if $game_system.save_disabled # Desabilitar Salvar @command_window.disable_item(4) end @spriteset = Spriteset_Map.new # Criar janela de Tempo de Jogo @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 224 @playtime_window.visible = false # Criar janela de Número Passos @steps_window = Window_Steps.new @steps_window.x = 0 @steps_window.y = 320 @steps_window.visible = false # Criar janela de Dinheiro @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 @gold_window.opacity = 230 # Criar janela de Status @status_window = Window_MenuSt.new @status_window.x = 160 @status_window.y = 0 @status_window.opacity = 230 # Executar transição Graphics.transition(20, "Graphics/Transitions/006-Stripe02") # Loop principal loop do # Atualizar a tela de jogo Graphics.update # Atualizar a entrada de informações Input.update # Atualizar Frame update # Abortar loop se a tela for alterada if $scene != self break end end # Preparar para transiçõa Graphics.freeze # Exibição das janelas @command_window.dispose @playtime_window.dispose @steps_window.dispose @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # Atualização do Frame #-------------------------------------------------------------------------- def update # Atualizar janelas @command_window.update @playtime_window.update @steps_window.update @gold_window.update @status_window.update # Se a janela de comandos estiver ativo: chamar update_command if @command_window.active update_command return end # Se a janela de Status estiver ativa: call update_status if @status_window.active update_status return end end #-------------------------------------------------------------------------- # Atualização do Frame (Quando a janela de Comandos estiver Ativa) #-------------------------------------------------------------------------- def update_command # Se o botão B for pressionado if Input.trigger?(Input::B) # Reproduzir SE de cancelamento $game_system.se_play($data_system.cancel_se) # Alternar para a tela do mapa $scene = Scene_Map.new return end # Se o botão C for pressionado if Input.trigger?(Input::C) # Se o comando for outro senão Salvar, Fim de Jogo e o número de Heróis no # Grupo for 0 if $game_party.actors.size == 0 and @command_window.index < 4 # Reproduzir SE de erro $game_system.se_play($data_system.buzzer_se) return end # Ramificação por posição do cursor na janela de comandos case @command_window.index when 0 # Itens # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Alternar para a tela de Itens $scene = Scene_Item.new when 1 # Habilidades # Play decision SE $game_system.se_play($data_system.decision_se) # Ativar o status da janela @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 # Equipamentos # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Ativar o status da janela @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 # Status # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Ativar o status da janela @command_window.active = false @status_window.active = true @status_window.index = 0 when 4 # Salvar # Se Salvar for proibido if $game_system.save_disabled # Reproduzir SE de erro $game_system.se_play($data_system.buzzer_se) return end # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Alternar para a tela de save $scene = Scene_Save.new when 5 # Fim de Jogo # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Alternar para a tela de Fim de Jogo $scene = Scene_End.new end return end end #-------------------------------------------------------------------------- # Atualização do Frame (Quando o status da Janela estiver Ativo) #-------------------------------------------------------------------------- def update_status # Se o botão B for pressionado if Input.trigger?(Input::B) # Reproduzir SE de cancelamento $game_system.se_play($data_system.cancel_se) # Torna a janela de comandos ativa @command_window.active = true @status_window.active = false @status_window.index = -1 return end # Se o botão C for pressionado if Input.trigger?(Input::C) # Ramificação por posição do cursor na janela de comandos case @command_window.index when 1 # Habilidades # Se o limite de ação deste Herói for de 2 ou mais if $game_party.actors[@status_window.index].restriction >= 2 # Reproduzir SE de erro $game_system.se_play($data_system.buzzer_se) return end # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Alternar para a tela de Habilidades $scene = Scene_Skill.new(@status_window.index) when 2 # Equipamento # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Alternar para a tela de Equipamento $scene = Scene_Equip.new(@status_window.index) when 3 # Status # Reproduzir SE de OK $game_system.se_play($data_system.decision_se) # Alternar para a tela de Status $scene = Scene_Status.new(@status_window.index) end return end end end class Window_MenuSt < Window_Selectable def initialize super(0, 0, 480, 480) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize refresh self.active = false self.index = -1 end def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size x = 64 y = i * 116 actor = $game_party.actors[i] drw_face(actor, x - 60, y 80) draw_actor_name(actor, x, y) draw_actor_level(actor, x 144, y) draw_actor_state(actor, x 90, y 32) draw_actor_exp(actor, x, y 64) draw_actor_hp(actor, x 236, y 32) draw_actor_sp(actor, x 236, y 64) end end def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, @index * 116, self.width - 32, 96) end end end #========================================================================# #== Adicionar barras de hp e sp =========================================# #= Cogwheel =============================================================# #========================================================================# 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 Window_Base < Window alias :draw_actor_hp_original :draw_actor_hp def draw_actor_hp(actor, x, y, width = 144) if actor.maxhp != 0 rate = actor.hp.to_f / actor.maxhp else rate = 0 end plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 50 height = 7 align1 = 0 align2 = 1 align3 = 0 grade1 = 1 grade2 = 0 color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(64, 0, 0, 192) color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192) color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192) if actor.maxhp != 0 hp = (width plus_width) * actor.hp * rate_width / 100 / actor.maxhp else hp = 0 end gauge_rect(x plus_x width * rate_x / 100, y plus_y, width, plus_width width * rate_width / 100, height, hp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) draw_actor_hp_original(actor, x, y, width) end alias :draw_actor_sp_original :draw_actor_sp def draw_actor_sp(actor, x, y, width = 144) if actor.maxsp != 0 rate = actor.sp.to_f / actor.maxsp else rate = 1 end plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 50 height = 7 align1 = 0 align2 = 1 align3 = 0 grade1 = 1 grade2 = 0 color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(0, 64, 0, 192) color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192) color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192) if actor.maxsp != 0 sp = (width plus_width) * actor.sp * rate_width / 100 / actor.maxsp else sp = (width plus_width) * rate_width / 100 end gauge_rect(x plus_x width * rate_x / 100, y plus_y, width, plus_width width * rate_width / 100, height, sp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) draw_actor_sp_original(actor, x, y, width) end alias :draw_actor_exp_original :draw_actor_exp def draw_actor_exp(actor, x, y, width = 204) if actor.next_exp != 0 rate = actor.now_exp.to_f / actor.next_exp else rate = 1 end plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 50 height = 7 align1 = 0 align2 = 1 align3 = 0 grade1 = 1 grade2 = 0 color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(64, 0, 0, 192) color5 = Color.new(80 * rate, 80 - 80 * rate * 2, 80 - 80 * rate, 192) color6 = Color.new(240 * rate, 240 - 240 * rate * 2, 240 - 240 * rate, 192) if actor.next_exp != 0 exp = (width plus_width) * actor.now_exp * rate_width / 100 / actor.next_exp else exp = (width plus_width) * rate_width / 100 end gauge_rect(x plus_x width * rate_x / 100, y plus_y, width, plus_width width * rate_width / 100, height, exp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) draw_actor_exp_original(actor, x, y) end def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) case align1 when 1 x = (rect_width - width) / 2 when 2 x = rect_width - width end case align2 when 1 y -= height / 2 when 2 y -= height end self.contents.fill_rect(x, y, width, height, color1) self.contents.fill_rect(x 1, y 1, width - 2, height - 2, color2) if align3 == 0 if grade1 == 2 grade1 = 3 end if grade2 == 2 grade2 = 3 end end if (align3 == 1 and grade1 == 0) or grade1 > 0 color = color3 color3 = color4 color4 = color end if (align3 == 1 and grade2 == 0) or grade2 > 0 color = color5 color5 = color6 color6 = color end self.contents.gradation_rect(x 2, y 2, width - 4, height - 4, color3, color4, grade1) if align3 == 1 x = width - gauge end self.contents.gradation_rect(x 2, y 2, gauge - 4, height - 4, color5, color6, grade2) end end class Bitmap def gradation_rect(x, y, width, height, color1, color2, align = 0) if align == 0 for i in x...x width red = color1.red (color2.red - color1.red) * (i - x) / (width - 1) green = color1.green (color2.green - color1.green) * (i - x) / (width - 1) blue = color1.blue (color2.blue - color1.blue) * (i - x) / (width - 1) alpha = color1.alpha (color2.alpha - color1.alpha) * (i - x) / (width - 1) color = Color.new(red, green, blue, alpha) fill_rect(i, y, 1, height, color) end elsif align == 1 for i in y...y height red = color1.red (color2.red - color1.red) * (i - y) / (height - 1) green = color1.green (color2.green - color1.green) * (i - y) / (height - 1) blue = color1.blue (color2.blue - color1.blue) * (i - y) / (height - 1) alpha = color1.alpha (color2.alpha - color1.alpha) * (i - y) / (height - 1) color = Color.new(red, green, blue, alpha) fill_rect(x, i, width, 1, color) end elsif align == 2 for i in x...x width for j in y...y height red = color1.red (color2.red - color1.red) * ((i - x) / (width - 1.0) (j - y) / (height - 1.0)) / 2 green = color1.green (color2.green - color1.green) * ((i - x) / (width - 1.0) (j - y) / (height - 1.0)) / 2 blue = color1.blue (color2.blue - color1.blue) * ((i - x) / (width - 1.0) (j - y) / (height - 1.0)) / 2 alpha = color1.alpha (color2.alpha - color1.alpha) * ((i - x) / (width - 1.0) (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end elsif align == 3 for i in x...x width for j in y...y height red = color1.red (color2.red - color1.red) * ((x width - i) / (width - 1.0) (j - y) / (height - 1.0)) / 2 green = color1.green (color2.green - color1.green) * ((x width - i) / (width - 1.0) (j - y) / (height - 1.0)) / 2 blue = color1.blue (color2.blue - color1.blue) * ((x width - i) / (width - 1.0) (j - y) / (height - 1.0)) / 2 alpha = color1.alpha (color2.alpha - color1.alpha) * ((x width - i) / (width - 1.0) (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end end end end module RPG class Sprite < ::Sprite def damage(value, critical) dispose_damage if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end bitmap = Bitmap.new(160, 48) bitmap.font.name = "Arial Black" bitmap.font.size = 32 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text( 1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-1, 12 1, 160, 36, damage_string, 1) bitmap.draw_text( 1, 12 1, 160, 36, damage_string, 1) if value.is_a?(Numeric) and value < 0 bitmap.font.color.set(176, 255, 144) else bitmap.font.color.set(255, 255, 255) end bitmap.draw_text(0, 12, 160, 36, damage_string, 1) if critical bitmap.font.size = 20 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text( 1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(-1, 1, 160, 20, "CRITICAL", 1) bitmap.draw_text( 1, 1, 160, 20, "CRITICAL", 1) bitmap.font.color.set(255, 255, 255) bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) end @_damage_sprite = ::Sprite.new @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 self.viewport.ox @_damage_sprite.oy = 20 self.viewport.oy @_damage_sprite.x = self.x self.viewport.rect.x @_damage_sprite.y = self.y - self.oy / 2 self.viewport.rect.y @_damage_sprite.z = 3000 @_damage_duration = 40 end def animation(animation, hit) dispose_animation @_animation = animation return if @_animation == nil @_animation_hit = hit @_animation_duration = @_animation.frame_max animation_name = @_animation.animation_name animation_hue = @_animation.animation_hue bitmap = RPG::Cache.animation(animation_name, animation_hue) if @@_reference_count.include?(bitmap) @@_reference_count[bitmap] = 1 else @@_reference_count[bitmap] = 1 end @_animation_sprites = [] if @_animation.position != 3 or not @@_animations.include?(animation) for i in 0..15 sprite = ::Sprite.new sprite.bitmap = bitmap sprite.visible = false @_animation_sprites.push(sprite) end unless @@_animations.include?(animation) @@_animations.push(animation) end end update_animation end def loop_animation(animation) return if animation == @_loop_animation dispose_loop_animation @_loop_animation = animation return if @_loop_animation == nil @_loop_animation_index = 0 animation_name = @_loop_animation.animation_name animation_hue = @_loop_animation.animation_hue bitmap = RPG::Cache.animation(animation_name, animation_hue) if @@_reference_count.include?(bitmap) @@_reference_count[bitmap] = 1 else @@_reference_count[bitmap] = 1 end @_loop_animation_sprites = [] for i in 0..15 sprite = ::Sprite.new sprite.bitmap = bitmap sprite.visible = false @_loop_animation_sprites.push(sprite) end update_loop_animation end def animation_set_sprites(sprites, cell_data, position) for i in 0..15 sprite = sprites[i] pattern = cell_data[i, 0] if sprite == nil or pattern == nil or pattern == -1 sprite.visible = false if sprite != nil next end sprite.visible = true sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192) if position == 3 if self.viewport != nil sprite.x = self.viewport.rect.width / 2 sprite.y = self.viewport.rect.height - 160 else sprite.x = 320 sprite.y = 240 end else sprite.x = self.x self.viewport.rect.x - self.ox self.src_rect.width / 2 sprite.y = self.y self.viewport.rect.y - self.oy self.src_rect.height / 2 sprite.y -= self.src_rect.height / 4 if position == 0 sprite.y = self.src_rect.height / 4 if position == 2 end sprite.x = cell_data[i, 1] sprite.y = cell_data[i, 2] sprite.z = 2000 sprite.ox = 96 sprite.oy = 96 sprite.zoom_x = cell_data[i, 3] / 100.0 sprite.zoom_y = cell_data[i, 3] / 100.0 sprite.angle = cell_data[i, 4] sprite.mirror = (cell_data[i, 5] == 1) sprite.opacity = cell_data[i, 6] * self.opacity / 255.0 sprite.blend_type = cell_data[i, 7] end end end end Perguntas frequentesP: Funciona no vx ? R:haha muito engraçado Creditos e agradecimentos"Agradeço moghunter, pois aprendi rgss com os menus dele. Agradeço cogwheel, por criar um script de barras de hp e sp." - NicholasRg NicholasRg por criar este outro grande script. Douglanilo adaptação e postagem na The World of Ever Grand |
|