[XP] BGM Change by Call Script

Started by Ronivan, February 15, 2015, 07:43:21 pm

Previous topic - Next topic

Ronivan

February 15, 2015, 07:43:21 pm Last Edit: February 15, 2015, 07:46:38 pm by Ronivan
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.

Soulshaker3

Audio.bgm_play('Audio/BGM/' + "bgm_name", volume, pitch) 
Hellow?

MetalZelda

March 14, 2015, 07:38:59 am #2 Last Edit: March 14, 2015, 07:47:42 am by MetalZelda
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

KK20

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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!