VanCoolz

[RGSS 2] Continue Map BGM & BGS when Battle

May 11th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.81 KB | None | 0 0
  1. #==============================================================================
  2. # [RGSS 2] Continue Map BGM & BGS when Battle
  3. # Version : 1.0
  4. # Author : LowlingLife
  5. #==============================================================================
  6. # Tetap nge-play BGM & BGS dari map saat battle mulai.
  7. #==============================================================================
  8. module ContinueBG
  9.   # Set ke true jika ingin tetap mem-play map BGM saat battle mulai.
  10.   CONTINUE_BGM = true
  11.   # Set ke true jika ingin tetap mem-play map BGS saat battle mulai.
  12.   CONTINUE_BGS = true
  13.   # Set ke true jika ingin mem-play suara Start Battle.
  14.   PLAY_BATTLE_START = true
  15. end
  16. class Scene_Map < Scene_Base
  17.   include ContinueBG
  18.   #--------------------------------------------------------------------------
  19.   # * Switch to Battle Screen
  20.   #--------------------------------------------------------------------------
  21.   def call_battle
  22.     @spriteset.update
  23.     Graphics.update
  24.     $game_player.make_encounter_count
  25.     $game_player.straighten
  26.     $game_temp.map_bgm = RPG::BGM.last
  27.     $game_temp.map_bgs = RPG::BGS.last
  28.     RPG::BGM.stop unless CONTINUE_BGM
  29.     RPG::BGS.stop unless CONTINUE_BGS
  30.     Sound.play_battle_start if PLAY_BATTLE_START
  31.     $game_system.battle_bgm.play unless CONTINUE_BGM
  32.     $game_temp.next_scene = nil
  33.     $scene = Scene_Battle.new
  34.   end
  35. end
  36. class Scene_Battle < Scene_Base
  37.   include ContinueBG
  38.   #--------------------------------------------------------------------------
  39.   # * End Battle
  40.   #     result : Results (0: win, 1: escape, 2:lose)
  41.   #--------------------------------------------------------------------------
  42.   def battle_end(result)
  43.     if result == 2 and not $game_troop.can_lose
  44.       call_gameover
  45.     else
  46.       $game_party.clear_actions
  47.       $game_party.remove_states_battle
  48.       $game_troop.clear
  49.       if $game_temp.battle_proc != nil
  50.         $game_temp.battle_proc.call(result)
  51.         $game_temp.battle_proc = nil
  52.       end
  53.       unless $BTEST
  54.         $game_temp.map_bgm.play unless CONTINUE_BGM
  55.         $game_temp.map_bgs.play unless CONTINUE_BGS
  56.       end
  57.       $scene = Scene_Map.new
  58.       @message_window.clear
  59.       Graphics.fadeout(30)
  60.     end
  61.     $game_temp.in_battle = false
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # * Victory Processing
  65.   #--------------------------------------------------------------------------
  66.   def process_victory
  67.     @info_viewport.visible = false
  68.     @message_window.visible = true
  69.     RPG::BGM.stop unless CONTINUE_BGM
  70.     $game_system.battle_end_me.play
  71.     unless $BTEST
  72.       $game_temp.map_bgm.play unless CONTINUE_BGM
  73.       $game_temp.map_bgs.play unless CONTINUE_BGS
  74.     end
  75.     display_exp_and_gold
  76.     display_drop_items
  77.     display_level_up
  78.     battle_end(0)
  79.   end
  80.   end
Advertisement
Add Comment
Please, Sign In to add comment