Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Ronivan on February 15, 2015, 07:43:21 pm

Title: [XP] BGM Change by Call Script
Post by: Ronivan on February 15, 2015, 07:43:21 pm
Hello again everybody.
I was wondering if its possible to change battle bgm by Call Script command in a event.
The system which I'm working don't allow me to change the battle BGM, but the battle system itself is based on Call Script commands line. So I was wondering if its possible
to add a line that change Battle BGM by Call Script. I would be gratefull for any help.
Title: Re: [XP] BGM Change by Call Script
Post by: Soulshaker3 on February 15, 2015, 08:38:17 pm
Audio.bgm_play('Audio/BGM/' + "bgm_name", volume, pitch) 
Title: Re: [XP] BGM Change by Call Script
Post by: MetalZelda on March 14, 2015, 07:38:59 am
Quote from: soulshaker3 on February 15, 2015, 08:38:17 pm
Audio.bgm_play('Audio/BGM/' + "bgm_name", volume, pitch) 



It's right but he were asking for battle bgm, Audio.bgm_play is for map right ?

$data_system.battle_bgm(blabla) +
$game_system.bgm_play($game_system.battle_bgm)


before transitionning into battle might be the thing he wants, i dunno if this work, need experts
Title: Re: [XP] BGM Change by Call Script
Post by: KK20 on March 14, 2015, 04:00:46 pm
What soulshaker posted is already fine. Audio is a module that can be accessed anywhere in the engine. Heck, look at what def bgm_play does in Game_System:

  #--------------------------------------------------------------------------
  # * Play Background Music
  #     bgm : background music to be played
  #--------------------------------------------------------------------------
  def bgm_play(bgm)
    @playing_bgm = bgm
    if bgm != nil and bgm.name != ""
      Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch) #<================ This right here
    else
      Audio.bgm_stop
    end
    Graphics.frame_reset
  end

Besides, to call $game_system.bgm_play, the passed argument must be a RPG::AudioFile object. So you would have to do this:

a = RPG::AudioFile.new(FILENAME, VOLUME, PITCH) # VOLUME and PITCH can be omitted and they will default to values of 100
$game_system.bgm_play(a)

It's been almost a month and OP hasn't responded, so we can assume this is already solved.