Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

is there a function to call to disable music?

Is there a function I can call from script or something that will disable all game music until it's enabled again?

thanks in advanced
 

poccil

Sponsor

Practically all calls for setting the background music are found in the Game_System class.  You can change those functions so that they play music only if a switch is off.  Here is an example (assuming you use Switch 10 for disabling music):

Code:
class Game_System
  def bgm_play(bgm)
    if $game_switches[10] # If switch 10 is on, which would disable music
      return # Exit
    end
    @playing_bgm = bgm
    if bgm != nil and bgm.name != ""
      Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)
    else
      Audio.bgm_stop
    end
    Graphics.frame_reset
  end
  def me_play(me)
    if $game_switches[10] # If switch 10 is on, which would disable music
      return # Exit
    end
    if me != nil and me.name != ""
      Audio.me_play("Audio/ME/" + me.name, me.volume, me.pitch)
    else
      Audio.me_stop
    end
    Graphics.frame_reset
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top