Invité Invité
| Sujet: [VX] Un nouveau menu de fin de combat. Jeu 4 Aoû 2011 - 20:32 | |
| Description: Change l'écran de fin de combat Utilisation: A placer au-dessus de Main. Compatibilité : Avec Tankentai et le système de standard, aucune erreur à été trouver pour le moment Auteur: chicoh Script: - Code:
-
#============================================================================== # Scene Result Battle by Chicoh #============================================================================== # Edições do script #============================================================================== module Config #============================================================================ # Aqui é edidato as opções da cena de resultado #============================================================================ #------------------------------------------------------------------------- # Edição de Cores #------------------------------------------------------------------------- EXP_BAR1=29 #primeira cor da barra de exp EXP_BAR2=28 #segunda cor da barra de exp COLOR_TEXT=17 #cor da fonte dos textos extras COLOR_NAME=18 #cor da fonte dos nomes #------------------------------------------------------------------------- # Edição de textos #------------------------------------------------------------------------- EXP_TEXT = "EXP ganho:" ITEM_TEXT = "Recompensa:" LEVEL_UP = "Level Up!" NEW_SKILL = "New Skill!" #------------------------------------------------------------------------- # Edição de sons #------------------------------------------------------------------------- LEARN_EXP_SE = RPG::SE.new("Cursor", 80, 150) ITEM_SE = RPG::SE.new("Equip", 80, 100) LEVEL_UP_SE = RPG::SE.new("Up", 80, 100) NEW_SKILL_SE = RPG::SE.new("Chime2", 80, 100) GOLD_SE = RPG::SE.new("Shop", 80, 100) #------------------------------------------------------------------------- # Edições extras #------------------------------------------------------------------------- FULL_RESTORE = true #recupera o hp e mp do char quando passa de nivel WAIT_AFTER_BATTLE = 120 #tempo em frames de espera após o termino da batalha #============================================================================ # Aqui é edidato as opções da cena de distribuição de pontos #============================================================================ #------------------------------------------------------------------------- # Edição de textos #------------------------------------------------------------------------- POINT_S = "Pontos" #o que será exibido em pontos OK = "Ok" #------------------------------------------------------------------------- # Edição de sons #------------------------------------------------------------------------- SE_OK=RPG::SE.new("Decision1", 100, 100) SE_ADD=RPG::SE.new("Raise3", 100, 100) SE_LESS=RPG::SE.new("Fall", 100, 100) SE_ERRO=RPG::SE.new("Buzzer1", 100, 100) #------------------------------------------------------------------------- # Edição de teclas #------------------------------------------------------------------------- ADD = Input::RIGHT #botao para adicionar pontos LESS = Input::LEFT #botao para retirar pontos #------------------------------------------------------------------------- # Edições extras #------------------------------------------------------------------------- DISTRIBUCT = true #se for true tera opção de distribuir pontos se for false nao terá POS_X = 128 #posição na horizontal da janela de distribuição de pontos POS_Y = 128 #posição na vertical da janela de distribuição de pontos POINT = 5 #pontos recebidos em cada nivel #============================================================================ # Aqui é edidato as opções das janelas(window) #============================================================================ OPACITY = 255 BLACK_GROUND=true #true: mostra um foundo negro false:o fundo da batalha end #============================================================================== # Window_Base #============================================================================== class Window_Base < Window def result_color return text_color(Config::COLOR_TEXT) end def name_color return text_color(Config::COLOR_NAME) end def draw_actor_level_menu(actor, x, y) self.contents.font.color = result_color self.contents.draw_text(x, y, 32, WLH, Vocab::level_a) self.contents.font.color = normal_color self.contents.draw_text(x + 32, y, 24, WLH, actor.level, 2) end def draw_actor_class_menu(actor, x, y) self.contents.font.color = normal_color self.contents.draw_text(x, y, 85, WLH, actor.class.name) end def exp_gauge_color1 return text_color(Config::EXP_BAR1) end def exp_gauge_color2 return text_color(Config::EXP_BAR2) end def draw_actor_exp_meter(actor, x, y, width = 100) if actor.next_exp != 0 exp = actor.now_exp else exp = 1 end gw = width * exp / [actor.next_exp, 1].max if(gw>100) gw=100 end gc1 = exp_gauge_color1 gc2 = exp_gauge_color2 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) self.contents.font.color = result_color self.contents.draw_text(x, y, 30, WLH, "Exp") self.contents.font.color = normal_color xr = x + width if(actor.level<99) percent=((actor.now_exp*100)/(actor.next_exp)).to_i() self.contents.draw_text(xr - 60, y, 60, WLH, gw.to_s+"%", 2) else self.contents.draw_text(xr - 60, y, 60, WLH, actor.next_rest_exp_s, 2) end end def draw_item_name_result(item, x, y, enabled = true) if item != nil draw_icon(item.icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, 96, WLH, item.name) end end end #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler include Config 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 def change_exp2(exp, show) last_level = @level last_skills = skills @exp = [[exp, 9999999].min, 0].max while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0 $result_window.update level_up if FULL_RESTORE == true recover_all end end while @exp < @exp_list[@level] level_down end @hp = [@hp, maxhp].min @mp = [@mp, maxmp].min if show and @level > last_level display_level_up2(skills - last_skills) $active_popup = 1 end end def display_level_up2(new_skills) for skill in new_skills $active_newskill = 1 end end def gain_exp2(exp, show) if double_exp_gain change_exp2(@exp + exp * 2, show) else change_exp2(@exp + exp, show) end end end #============================================================================== # ■ Window_BattleResult #============================================================================== class Window_BattleResult < Window_Base include Config def initialize super(0, 0, 384, 416) self.z = 150 self.opacity=OPACITY refresh update end def refresh self.contents.clear @item_max = $game_party.members.size for actor in $game_party.members draw_actor_face(actor, 2, actor.index * 96 + 2,92) x = 104 y = actor.index * 96 + WLH / 2 exp=$game_troop.exp_total draw_actor_name(actor, x, y) draw_actor_level_menu(actor, x + 120, y) draw_actor_state(actor, x, y + WLH * 2) draw_actor_hp(actor, x + 120, y + WLH * 1) draw_actor_mp(actor, x + 120, y + WLH * 2) draw_actor_exp_meter(actor, x , y + WLH * 1) end Graphics.frame_reset end def update refresh end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle < Scene_Base include Config def create_blackground @menuback_sprite = Sprite.new @menuback_sprite.bitmap = $game_temp.background_bitmap @menuback_sprite.color.set(0, 0, 0, 255) update_menu_background end def process_victory @info_viewport.visible = false @message_window.visible = false RPG::BGM.stop $game_system.battle_end_me.play unless $BTEST $game_temp.map_bgm.play $game_temp.map_bgs.play end wait(WAIT_AFTER_BATTLE) if(BLACK_GROUND==true) create_blackground end display_result wait(120) battle_end(0) end alias terminate_str11h terminate def terminate $result_window.dispose if $result_window != nil @exp_result.dispose if $result_window != nil @gold_result.dispose if $result_window != nil @item_result.dispose if $result_window != nil terminate_str11h end def display_result $drop = $game_troop.make_drop_items for item in $drop $game_party.gain_item(item, 1) ITEM_SE.play end gold = $game_troop.gold_total if gold > 0 GOLD_SE.play end $game_party.gain_gold(gold) $xp = $game_troop.exp_total @point=($game_troop.exp_total/100.0).round() $result_window = Window_BattleResult.new @exp_result = Window_Exp_Result.new @gold_result = Window_Gold_Result.new @item_result = Window_Item_Result.new while($xp>0) if($xp<@point || @point <= 0) @point=1 end update_basic $xp -= @point display_level_up LEARN_EXP_SE.play @gold_result.update @item_result.update $result_window.update @exp_result.update end end def display_level_up for actor in $game_party.existing_members last_level = actor.level last_skills = actor.skills actor.gain_exp2(@point, true) if $active_popup == 1 @level_popup=Level_popup.new(actor.index * 96 + 32) wait(20) @level_popup.dispose if(Config::DISTRIBUCT==true) @window_level=Window_Level_Up.new(actor,Config::POS_X,Config::POS_Y) @window_level.active=true while(@window_level.active==true) @window_level.update wait(1) end @window_level.dispose end $active_popup=0 end if $active_newskill == 1 @skill_popup=Skill_popup.new(actor.index * 96 + 32) wait(20) @skill_popup.dispose $active_newskill=0 end end end end class Level_popup < Window_Base include Config def initialize(y) super(32, y, 128, 64) self.z = 300 self.opacity=OPACITY refresh end def refresh self.contents.clear self.contents.draw_text(0, -16, 128, 64, LEVEL_UP) LEVEL_UP_SE.play end end class Skill_popup < Window_Base include Config def initialize(y) super(192, y, 128, 64) self.z = 320 refresh end def refresh self.contents.clear self.contents.draw_text(0, -16, 128, 64, NEW_SKILL) NEW_SKILL_SE.play end end class Window_Exp_Result < Window_Base include Config def initialize super(384, 0, 160, WLH + 64) self.z = 150 self.opacity=OPACITY refresh update end def refresh self.contents.clear self.contents.font.color = result_color self.contents.draw_text(0, -16, 200, 64, EXP_TEXT) self.contents.font.color = normal_color self.contents.draw_text(0, 16, 200, 64, $game_troop.exp_total) end def update refresh end end class Window_Gold_Result < Window_Base def initialize super(384, 88, 160, WLH + 32) self.z = 150 self.opacity=Config::OPACITY refresh update end def refresh self.contents.clear draw_currency_value($game_party.gold, 4, 0, 120) end def update refresh end end class Window_Item_Result < Window_Base include Config def initialize super(384, 144, 160, 272) self.z = 150 self.opacity=OPACITY refresh update end def refresh self.contents.clear self.contents.font.color = result_color self.contents.draw_text(0, -16, 200, 64, ITEM_TEXT) self.contents.font.color = normal_color yn = 32 for item in $drop draw_item_name_result(item, 4, yn) yn += 32 end end def update refresh end end
#-------------------------------------------------------------------------- # Window_Level_Up #--------------------------------------------------------------------------
class Game_Actor < Game_Battler attr_accessor :point alias setup_level_up_actor setup def setup(actor_id) setup_level_up_actor(actor_id) @point=0 end def point return @point end alias level_up_level_up_actor level_up def level_up @point+=Config::POINT level_up_level_up_actor end end
class Window_Level_Up < Window_Command def initialize(actor,x,y) @actor=actor @point_max=@actor.point s1 = Vocab::atk s2 = Vocab::def s3 = Vocab::spi s4 = Vocab::agi s5 = Config::OK super(256, [s1, s2,s3,s4,s5], 1, 5) self.z = 600 self.x=x self.y=y self.active = true self.index = 0 self.opacity=Config::OPACITY @name_pop=Name_popup.new(@actor) @name_pop.x=x @name_pop.y=y-24 @commands = [s1, s2, s3, s4, s5] @item_max = 5 refresh update end def refresh self.contents.clear for i in 0...@item_max-1 draw_status(i) end self.contents.draw_text(4, 96, 64, WLH, @commands[@item_max-1]) self.contents.font.color = result_color self.contents.draw_text(128, 96, 64, WLH,Config::POINT_S+":") self.contents.font.color = normal_color self.contents.draw_text(192, 96, 32, WLH,@actor.point,2) end def draw_status(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = result_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, @commands[index]) self.contents.font.color = normal_color rect2 = item_rect(index) rect2.x += 192 rect2.width -= 8 case index when 0 self.contents.draw_text(rect2,@actor.atk) when 1 self.contents.draw_text(rect2,@actor.def) when 2 self.contents.draw_text(rect2,@actor.spi) when 3 self.contents.draw_text(rect2,@actor.agi) end end alias level_up_update update def update refresh case self.index when 0 if Input.trigger?(Config::ADD) && @actor.point>0 @actor.atk+=1 @actor.point-=1 Config::SE_ADD.play elsif Input.trigger?(Config::ADD) Config::SE_ERRO.play end if Input.trigger?(Config::LESS) && @actor.point<@point_max @actor.atk-=1 @actor.point+=1 Config::SE_LESS.play elsif Input.trigger?(Config::LESS) Config::SE_ERRO.play end when 1 if Input.trigger?(Config::ADD) && @actor.point>0 @actor.def+=1 @actor.point-=1 Config::SE_ADD.play elsif Input.trigger?(Config::ADD) Config::SE_ERRO.play end if Input.trigger?(Config::LESS) && @actor.point<@point_max @actor.def-=1 @actor.point+=1 Config::SE_LESS.play elsif Input.trigger?(Config::LESS) Config::SE_ERRO.play end when 2 if Input.trigger?(Config::ADD) && @actor.point>0 @actor.spi+=1 @actor.point-=1 Config::SE_ADD.play elsif Input.trigger?(Config::ADD) Config::SE_ERRO.play end if Input.trigger?(Config::LESS) && @actor.point<@point_max @actor.spi-=1 @actor.point+=1 Config::SE_LESS.play elsif Input.trigger?(Config::LESS) Config::SE_ERRO.play end when 3 if Input.trigger?(Config::ADD) && @actor.point>0 @actor.agi+=1 @actor.point-=1 Config::SE_ADD.play elsif Input.trigger?(Config::ADD) Config::SE_ERRO.play end if Input.trigger?(Config::LESS) && @actor.point<@point_max @actor.agi-=1 @actor.point+=1 Config::SE_LESS.play elsif Input.trigger?(Config::LESS) Config::SE_ERRO.play end when 4 if Input.trigger?(Input::C) Config::SE_OK.play self.active=false self.x+=999 @name_pop.x+=999 end end level_up_update end def item_rect(index) rect = Rect.new(0, 0, 0, 0) if(index==@item_max-1) rect.width = 64 else rect.width = (contents.width + @spacing) / @column_max - @spacing end rect.height = WLH rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * WLH return rect end def dispose self.contents.dispose super end end
class Name_popup < Window_Base def initialize(actor) @player=actor super(0, 0, 96, 64) self.z = 650 self.opacity = 0 refresh end def refresh self.contents.clear self.contents.font.color = name_color self.contents.draw_text(0, 0, 96, WLH, @player.name) self.contents.font.color = normal_color end end Screen: |
|