Advertisement
diamondandplatinum3

Map BGM continues into Battle ~ RGSS2

Aug 23rd, 2012
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.86 KB | None | 0 0
  1. #==============================================================================
  2. #  Map BGM continues into Battle
  3. #  Version: 1.0
  4. #  Author: DiamondandPlatinum3
  5. #  Date: August 20, 2012
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #    This script will allow you to play your map BGM into battle. It's useful
  9. #    for those times when you have battle bgm that needs to kick-in before a
  10. #    battle, or perhaps changing to the battle BGM all the time is probably
  11. #    annoying. Either way, this script does what it says it does.
  12. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  13. #------------------------------------------------------------------------------
  14. #  Instructions:
  15. #  
  16. #     - Just take a look at the editable region and modify the event switch
  17. #       ID to suit your needs
  18. #
  19. #==============================================================================
  20. module MapBGMContinuesintoBattle
  21.   #===========================================
  22.   #     Editable Region
  23.   #===========================================
  24.  
  25.   # Activate the switch ID to turn off changing the battle BGM
  26.   # Whatever Switch ID you set this to be, you must turn on that switch
  27.   # before this script will work.
  28.   #
  29.   # For example, ID switch 10 would be event switch number 10
  30.  
  31.   BATTLE_BGM_UNCHANGE_EVENT_SWITCH_ID = 10  # You change the number
  32.  
  33.   PLAY_VICTORY_ME_AFTER_WINNING = false     # ( true / false )
  34.  
  35.  
  36.  
  37. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  38.  end # of editable region          ////                  ||
  39. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40.  
  41.  
  42.  
  43. include MapBGMContinuesintoBattle
  44.  
  45.  
  46.  
  47. class Scene_Map < Scene_Base  
  48.   #--------------------------------------------------------------------------
  49.   # * Call Battle
  50.   #--------------------------------------------------------------------------
  51.   alias bgmunchange_callbtl_8hf23 call_battle
  52.   def call_battle
  53.     if $game_switches[BATTLE_BGM_UNCHANGE_EVENT_SWITCH_ID]
  54.       @spriteset.update
  55.       Graphics.update
  56.       $game_player.make_encounter_count
  57.       $game_player.straighten
  58.       Sound.play_battle_start
  59.       $game_temp.next_scene = nil
  60.       $scene = Scene_Battle.new
  61.     else
  62.       bgmunchange_callbtl_8hf23
  63.     end
  64.   end
  65. end
  66.  
  67.  
  68.  
  69.  
  70.  
  71. class Scene_Battle
  72.   #--------------------------------------------------------------------------
  73.   # * Victory Processing
  74.   #--------------------------------------------------------------------------
  75.   alias bgmunchange_processvictory_8hf23 process_victory
  76.   def process_victory
  77.     if $game_switches[BATTLE_BGM_UNCHANGE_EVENT_SWITCH_ID]
  78.       @info_viewport.visible = false
  79.       @message_window.visible = true
  80.       $game_system.battle_end_me.play if PLAY_VICTORY_ME_AFTER_WINNING
  81.       display_exp_and_gold
  82.       display_drop_items
  83.       display_level_up
  84.       battle_end(0)
  85.     else
  86.       bgmunchange_processvictory_8hf23
  87.     end
  88.   end
  89.  
  90.   #--------------------------------------------------------------------------
  91.   # * End Battle
  92.   #     result : Results (0: win, 1: escape, 2:lose)
  93.   #--------------------------------------------------------------------------
  94.   alias bgmunchange_battleend_8hf23 battle_end
  95.   def battle_end(result)
  96.     if $game_switches[BATTLE_BGM_UNCHANGE_EVENT_SWITCH_ID]
  97.       if result == 2 and not $game_troop.can_lose
  98.         call_gameover
  99.       else
  100.         $game_party.clear_actions
  101.         $game_party.remove_states_battle
  102.         $game_troop.clear
  103.         if $game_temp.battle_proc != nil
  104.           $game_temp.battle_proc.call(result)
  105.           $game_temp.battle_proc = nil
  106.         end
  107.         $scene = Scene_Map.new
  108.         @message_window.clear
  109.         Graphics.fadeout(30)
  110.       end
  111.       $game_temp.in_battle = false
  112.     else
  113.       bgmunchange_battleend_8hf23(result)
  114.     end
  115.   end
  116. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement