Advertisement
diamondandplatinum3

Change Vehicle BGM based on Time ~ RGSS2

Sep 1st, 2012
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.40 KB | None | 0 0
  1. #==============================================================================
  2. #  Change Vehicle BGM based on Time
  3. #  Version: 1.0
  4. #  Author: DiamondandPlatinum3
  5. #  Date: September 1, 2012
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #    This script will allow you to stop the vehicle BGM from playing based on
  9. #    an event switch, but will also allow you to change the BGM that is played
  10. #    depending on the time of day
  11. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  12. #------------------------------------------------------------------------------
  13. #  Instructions:
  14. #  
  15. #     - Just take a look at the editable region and modify the settings to
  16. #       suit your needs
  17. #
  18. #       Also Please note that this script was designed to change BGM based on a
  19. #       24-hour clock, it probably won't work the way you intended if this is
  20. #       not your case.
  21. #==============================================================================
  22. module DP3_Vehicle_Sound_Options
  23.   #===========================================
  24.   #     Editable Region
  25.   #===========================================
  26.  
  27.   # The ID of the switch which turns off changing the BGM on all vehicles
  28.   Event_Switch_ID     = 10    
  29.  
  30.   # Switch BGM Based on Time?
  31.   SwitchBGMOnTime     = true
  32.  
  33.   # Which Variable is keeping track of your time?
  34.   TimeTrackVariableID = 10 # This is the same variable you are using to keep track of time
  35.                            
  36.                            
  37.   # If you are switching the BGM based on time, what are you switching them to?  
  38.  
  39.                       #  Name of BGM,  Volume, Pitch
  40.   Midnight_BGMTheme   = [ "Battle1",    100,    100 ]
  41.   OneAM_BGMTheme      = [ "Battle1",    100,    100 ]
  42.   TwoAM_BGMTheme      = [ "Battle1",    100,    100 ]
  43.   ThreeAM_BGMTheme    = [ "Battle1",    100,    100 ]
  44.   FourAM_BGMTheme     = [ "Battle2",    100,    100 ]
  45.   FiveAM_BGMTheme     = [ "Battle2",    100,    100 ]
  46.   SixAM_BGMTheme      = [ "Battle2",    100,    100 ]
  47.   SevenAM_BGMTheme    = [ "Battle2",    100,    100 ]
  48.   EightAM_BGMTheme    = [ "Battle3",    100,    100 ]
  49.   NineAM_BGMTheme     = [ "Battle3",    100,    100 ]
  50.   TenAM_BGMTheme      = [ "Battle3",    100,    100 ]
  51.   ElevenAM_BGMTheme   = [ "Battle3",    100,    100 ]
  52.   Midday_BGMTheme     = [ "Battle4",    100,    100 ]
  53.   OnePM_BGMTheme      = [ "Battle4",    100,    100 ]
  54.   TwoPM_BGMTheme      = [ "Battle4",    100,    100 ]
  55.   ThreePM_BGMTheme    = [ "Battle4",    100,    100 ]
  56.   FourPM_BGMTheme     = [ "Battle5",    100,    100 ]
  57.   FivePM_BGMTheme     = [ "Battle5",    100,    100 ]
  58.   SixPM_BGMTheme      = [ "Battle5",    100,    100 ]
  59.   SevenPM_BGMTheme    = [ "Battle5",    100,    100 ]
  60.   EightPM_BGMTheme    = [ "Battle6",    100,    100 ]
  61.   NinePM_BGMTheme     = [ "Battle6",    100,    100 ]
  62.   TenPM_BGMTheme      = [ "Battle6",    100,    100 ]
  63.   ElevenPM_BGMTheme   = [ "Battle6",    100,    100 ]
  64.  
  65.  
  66.  
  67. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  68.  end # of editable region          ////                  ||
  69. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. include DP3_Vehicle_Sound_Options
  79.  
  80. class Game_Vehicle < Game_Character
  81.   alias dp3_nobgm_during_travel get_on
  82.   def get_on
  83.     if $game_switches[Event_Switch_ID]
  84.       @driving = true
  85.       @walk_anime = true
  86.       @step_anime = true
  87.       if @type == 2
  88.         @priority_type = 2
  89.       end
  90.     elsif SwitchBGMOnTime
  91.       @driving = true
  92.       @walk_anime = true
  93.       @step_anime = true
  94.       if @type == 2              
  95.         @priority_type = 2
  96.       end
  97.       changevehiclebgmontime
  98.     else
  99.       dp3_nobgm_during_travel
  100.     end
  101.   end
  102.  
  103.  
  104.  
  105.  
  106.  
  107.   def changevehiclebgmontime
  108.     case $game_variables[TimeTrackVariableID]
  109.     when 0 # Midnight
  110.       RPG::BGM.new(Midnight_BGMTheme[0], Midnight_BGMTheme[1], Midnight_BGMTheme[2]).play
  111.     when 1 # One AM
  112.       RPG::BGM.new(OneAM_BGMTheme[0], OneAM_BGMTheme[1], OneAM_BGMTheme[2]).play
  113.     when 2 # Two AM
  114.       RPG::BGM.new(TwoAM_BGMTheme[0], TwoAM_BGMTheme[1], TwoAM_BGMTheme[2]).play
  115.     when 3 # Three AM
  116.       RPG::BGM.new(ThreeAM_BGMTheme[0], ThreeAM_BGMTheme[1], ThreeAM_BGMTheme[2]).play
  117.     when 4 # Four AM
  118.       RPG::BGM.new(FourAM_BGMTheme[0], FourAM_BGMTheme[1], FourAM_BGMTheme[2]).play
  119.     when 5 # Five AM
  120.       RPG::BGM.new(FiveAM_BGMTheme[0], FiveAM_BGMTheme[1], FiveAM_BGMTheme[2]).play
  121.     when 6 # Six AM
  122.       RPG::BGM.new(SixAM_BGMTheme[0], SixAM_BGMTheme[1], SixAM_BGMTheme[2]).play
  123.     when 7 # Seven AM
  124.       RPG::BGM.new(SevenAM_BGMTheme[0], SevenAM_BGMTheme[1], SevenAM_BGMTheme[2]).play
  125.     when 8 # Eight AM
  126.       RPG::BGM.new(EightAM_BGMTheme[0], EightAM_BGMTheme[1], EightAM_BGMTheme[2]).play
  127.     when 9 # Nine AM
  128.       RPG::BGM.new(NineAM_BGMTheme[0], NineAM_BGMTheme[1], NineAM_BGMTheme[2]).play
  129.     when 10 # Ten AM
  130.       RPG::BGM.new(TenAM_BGMTheme[0], TenAM_BGMTheme[1], TenAM_BGMTheme[2]).play
  131.     when 11 # Eleven AM
  132.       RPG::BGM.new(ElevenAM_BGMTheme[0], ElevenAM_BGMTheme[1], ElevenAM_BGMTheme[2]).play
  133.     when 12 # Midday
  134.       RPG::BGM.new(Midday_BGMTheme[0], Midday_BGMTheme[1], Midday_BGMTheme[2]).play
  135.     when 13 # One PM
  136.       RPG::BGM.new(OnePM_BGMTheme[0], OnePM_BGMTheme[1], OnePM_BGMTheme[2]).play
  137.     when 14 # Two PM
  138.       RPG::BGM.new(TwoPM_BGMTheme[0], TwoPM_BGMTheme[1], TwoPM_BGMTheme[2]).play
  139.     when 15 # Three PM
  140.       RPG::BGM.new(ThreePM_BGMTheme[0], ThreePM_BGMTheme[1], ThreePM_BGMTheme[2]).play
  141.     when 16 # Four PM
  142.       RPG::BGM.new(FourPM_BGMTheme[0], FourPM_BGMTheme[1], FourPM_BGMTheme[2]).play
  143.     when 17 # Five PM
  144.       RPG::BGM.new(FivePM_BGMTheme[0], FivePM_BGMTheme[1], FivePM_BGMTheme[2]).play
  145.     when 18 # Six PM
  146.       RPG::BGM.new(SixPM_BGMTheme[0], SixPM_BGMTheme[1], SixPM_BGMTheme[2]).play
  147.     when 19 # Seven PM
  148.       RPG::BGM.new(SevenPM_BGMTheme[0], SevenPM_BGMTheme[1], SevenPM_BGMTheme[2]).play
  149.     when 20 # Eight PM
  150.       RPG::BGM.new(EightPM_BGMTheme[0], EightPM_BGMTheme[1], EightPM_BGMTheme[2]).play
  151.     when 21 # Nine PM
  152.       RPG::BGM.new(NinePM_BGMTheme[0], NinePM_BGMTheme[1], NinePM_BGMTheme[2]).play
  153.     when 22 # Ten PM
  154.       RPG::BGM.new(TenPM_BGMTheme[0], TenPM_BGMTheme[1], TenPM_BGMTheme[2]).play
  155.     when 23 # Eleven PM
  156.       RPG::BGM.new(ElevenPM_BGMTheme[0], ElevenPM_BGMTheme[1], ElevenPM_BGMTheme[2]).play
  157.     else
  158.       @bgm.play
  159.     end
  160.   end
  161. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement