Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

> Battle music toggle?
pudding
post Jul 21 2012, 09:18 PM
Post #1


Level 9
Group Icon

Group: Revolutionary
Posts: 140
Type: Writer
RM Skill: Intermediate




Hi!
Before anyone says anything, yes I know you can change the battle music using an event but (and please correct me if I'm wrong and you can do this by eventing!) I was wondering if there was a script to do this. Basically, each time the actors go into battle, a theme from a pool of 5 will be chosen at random so if you get into a battle the music changes every time. I'm sure you can do this with eventing and I just can't figure it out, but either way (scripting or eventing) help would be MAJORLY appreciated. A game with a good example of this is Visions and Voices if anyone has played that. I can't figure out how they did it tongue.gif. Much appreciated!


__________________________
""
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
diamondandplatin...
post Jul 22 2012, 12:06 PM
Post #2


Level 5
Group Icon

Group: Member
Posts: 72
Type: Writer
RM Skill: Skilled
Rev Points: 45




VXA

code

CODE
#==============================================================================
#  Random Battle Themes
#  Version: 1.0
#  Author: DiamondandPlatinum3
#  Date: July 23, 2012
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Description:
#    This script allows you to play a random battle theme upon starting a
#    battle, it can be turned off before a boss battle via switch so that
#    the appropriate battle them still plays for them.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
#  Instructions:
#  
#     - Just take a look at the editable region and modify things
#       appropriately.
#
#==============================================================================
module RNDM_Battle_Themes
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                                                        -=
#                 Editable Region        ////            ==
#                                                        =-
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  Boss_Battle_Event_Switch_ID = 10          # Turn this switch on before a boss
                                            # battle so that the music you actually
                                            #want to play will play.

  Battle_Theme_Volume         = 100         # The Volume of the BGM
  Battle_Theme_Pitch          = 100         # The Pitch of the BGM
  
  First_Random_Battle_Theme   = "Battle1"   # The Name of One of the Random Battle Themes
  Second_Random_Battle_Theme  = "Battle2"   # The Name of One of the Random Battle Themes
  Third_Random_Battle_Theme   = "Battle3"   # The Name of One of the Random Battle Themes
  Fourth_Random_Battle_Theme  = "Battle4"   # The Name of One of the Random Battle Themes
  Fifth_Random_Battle_Theme   = "Battle5"   # The Name of One of the Random Battle Themes
  
  
#===========================================================
end # of Editable Region
#===========================================================
#---------------------------------------------------------
# No touchie past here unless you know what you are
# doing. Failure to heed this warning could cause your
# computer to yell and scream at you.
#
# Edit at your own risk.
#--------------------------------------------------------














class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # * Switch to Battle Screen
  #--------------------------------------------------------------------------
  alias rndm_battle_themes_cb_4wa2 pre_battle_scene
  def pre_battle_scene
    Graphics.update
    Graphics.freeze
    @spriteset.dispose_characters
    BattleManager.save_bgm_and_bgs
    
    @bgm_volume = RNDM_Battle_Themes::Battle_Theme_Volume
    @bgm_pitch  = RNDM_Battle_Themes::Battle_Theme_Pitch
    
    @bt = rand(5) + 1
    
    if @bt == 1
      @battle_bgm   = "Audio/BGM/" + RNDM_Battle_Themes::First_Random_Battle_Theme
      Audio.bgm_play(@battle_bgm, @bgm_volume, @bgm_pitch)
    elsif @bt == 2
      @battle_bgm   = "Audio/BGM/" + RNDM_Battle_Themes::Second_Random_Battle_Theme
      Audio.bgm_play(@battle_bgm, @bgm_volume, @bgm_pitch)
    elsif @bt == 3
      @battle_bgm   = "Audio/BGM/" + RNDM_Battle_Themes::Third_Random_Battle_Theme
      Audio.bgm_play(@battle_bgm, @bgm_volume, @bgm_pitch)
    elsif @bt == 4
      @battle_bgm   = "Audio/BGM/" + RNDM_Battle_Themes::Fourth_Random_Battle_Theme
      Audio.bgm_play(@battle_bgm, @bgm_volume, @bgm_pitch)      
    elsif @bt == 5
      @battle_bgm   = "Audio/BGM/" + RNDM_Battle_Themes::Fifth_Random_Battle_Theme
      Audio.bgm_play(@battle_bgm, @bgm_volume, @bgm_pitch)
    else #if something went wrong              
      BattleManager.play_battle_bgm
      Sound.play_battle_start
    end
      
    
    if $game_switches[RNDM_Battle_Themes::Boss_Battle_Event_Switch_ID] == true
      BattleManager.play_battle_bgm
      Sound.play_battle_start
    end
    
  end
end


__________________________
Go to the top of the page
 
+Quote Post
   
pudding
post Jul 22 2012, 12:13 PM
Post #3


Level 9
Group Icon

Group: Revolutionary
Posts: 140
Type: Writer
RM Skill: Intermediate




Thank you so much!


__________________________
""
Go to the top of the page
 
+Quote Post
   



Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 09:40 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker