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.

[VX] Possibly Small BGM Playing Fix

All right, I'm using the following Splash Screen script:

Code:
#==============================================================================

# ** Scene_Splash 2.0.2 RGSS2

# D�vic - Programming and debugging

# Isaacsol - Supporting and debugging

#

# Version history:

#   ~ 07.03.08 :: First version released with fade effects, image delaying and

#                 unlimited number of logo images.

#   ~ 10.03.08 :: Version 1.5 released with beta Audio processing; plays all

#                 types of Audio (BGM, BGS, SE & ME), but just one through all

#                 the Scene. It is possible to disable Audio.

#   ~ 24.03.08 :: Script rewrite - beta version 1.8a for animation beta

#                 function (not released beta-version).

#   ~ 25.03.08 :: Script second rewrite - non-released 1.9 beta version in tests

#                 for plain image, animation and audio compatibility.

#   ~ 25.03.08 :: Release of version 2.0! Features:

#                 - [!] Change in the Script's name to Scene_Splash [!]

#                 - Script rewritten; more clear and pure

#                 - New customisation system; unlimited amount of images and audio

#                 - Audio playing system more deep

#                 - Can be disabled in playtest

#                 - Animation compatible

#                 - New Wait engine; dœs not modify Graphics Module anymore

#                 - BreakSplash engine improved; break keys customisable

#   ~ 25.03.08 :: Version 2.0.1 - Slight edit on Scene_Title; the Splash

#                 Screen will not appear more than one time per initialisation.

#                 (Function called OneTimeSplash)

#   ~ 30.03.08 :: Version 2.0.2 - Fixed non-stopable sound bug.

#------------------------------------------------------------------------------

# Shows a splash screen on startup. Compatible only with RGSS2!

#   Questions, acknowledgments and requests may be taken on the script's

#   threads, but you can send me an e-mail at: [email=phabio_almeida@hotmail.com]phabio_almeida@hotmail.com[/email]

#------------------------------------------------------------------------------

#   English thread:

#   [url=http://www.rpgmakervx.net/index.php?showtopic=974]http://www.rpgmakervx.net/index.php?showtopic=974[/url]

#   Portuguese thread:

#   [url=http://www.rpgmakerbrasil.com/forum/f43/rmvx-scene-logo-1-7-rgss2-552.html]http://www.rpgmakerbrasil.com/forum/f43 ... 2-552.html[/url]

#   German thread:

#   [url=http://forum.rpgvx.net/index.php?showtopic=481]http://forum.rpgvx.net/index.php?showtopic=481[/url]

#------------------------------------------------------------------------------

#                                                          Respectfully,

#                                                                      D�vic.

#==============================================================================

 

class Scene_Splash

  DisableInDebug = false

  BreakSplash = true

  OneTimeSplash = true

  

  def initialize

    @logo = [

        [ 120, "Splash", 'BGM', "ALMATERIA", 100, 100 ],

        [ 120, "Splash2", 'BGM', "ALMATERIA", 100, 100 ]

      ]

    @fade_delay = 20

    @break = 'Input.press?(Input::B) || Input.press?(Input::C)'

    main

  end

  

  def main

    @logo.each { |a|

      unless a.length < 3

        case a[2]

        when 'BGM'

          Audio.bgm_play("Audio/BGM/#{a[3]}", a[4], a[5])

        when 'BGS'

          Audio.bgs_play("Audio/BGS/#{a[3]}", a[4], a[5])

        when 'ME'

          Audio.me_play("Audio/ME/#{a[3]}", a[4], a[5])

        when 'SE'

          Audio.se_play("Audio/SE/#{a[3]}", a[4], a[5])

        end

      end

      if a[0].kind_of?(Array)

        sprite = Sprite.new

        sprite.bitmap = Cache.system("#{a[1]}1")

        Graphics.transition

        Graphics.fadein(@fade_delay)

        for j in 2..(a[0][0] - 1)

          sprite = Sprite.new

          sprite.bitmap = Cache.system(a[1] + j.to_s)

          a[0][1].times {

            Graphics.update

            Input.update

            (break if eval(@break)) if BreakSplash

           }

          (break if eval(@break)) if BreakSplash

          sprite.dispose

        end

        unless eval(@break)

          sprite = Sprite.new

          sprite.bitmap = Cache.system(a[1] + a[0][0].to_s)

          Graphics.wait(a[0][2])

        end

        audio_stop(a)

        Graphics.fadeout(@fade_delay)

        sprite.dispose

      else

        sprite = Sprite.new

        sprite.bitmap = Cache.system(a[1])

        Graphics.transition

        Graphics.fadein(@fade_delay)

        a[0].times {

          Graphics.update

          Input.update

          (break if eval(@break)) if BreakSplash

         }

        audio_stop(a)

        Graphics.fadeout(@fade_delay)

        sprite.dispose

      end

      Graphics.freeze

     }

   end

  

   def audio_stop(a)

    unless a.length < 3

      case a[2]

      when 'BGM'

        Audio.bgm_fade(@fade_delay)

      when 'BGS'

        Audio.bgs_fade(@fade_delay)

      when 'ME'

        Audio.me_fade(@fade_delay)

      when 'SE'

        Audio.se_stop

      end

    end

  end

end

 

class Scene_Title

  alias old_start start

  def start

    unless $splash

      $splash = true if Scene_Splash::OneTimeSplash

      if Scene_Splash::DisableInDebug

        Scene_Splash.new unless $TEST

      else

        Scene_Splash.new

      end

    end

    old_start

  end

end

Problem I'm having is that the BGM shuts off if I go to another splash screen or to the main menu if neither calls for it, or will restart if the second splash screen or the main menu call for it. What I *WANT* is for the BGM to play throughout all splash screens and the main menu. Little help? :eek:

((y-yeah, I'm working on games again, otl))

Edit: Erm, yeah, this is for VX. Shaddup I was tired yesterday. :|
 
Comment the lines that say, "audio.stop(a)", and only include the "'BGM', 'name', 100, 100" with the first splash screen. And let's overwrite the method in scene title that starts the BGM...

Code:
#==============================================================================

# ** Scene_Splash 2.0.2 RGSS2

# D�vic - Programming and debugging

# Isaacsol - Supporting and debugging

#

# Version history:

#   ~ 07.03.08 :: First version released with fade effects, image delaying and

#                 unlimited number of logo images.

#   ~ 10.03.08 :: Version 1.5 released with beta Audio processing; plays all

#                 types of Audio (BGM, BGS, SE & ME), but just one through all

#                 the Scene. It is possible to disable Audio.

#   ~ 24.03.08 :: Script rewrite - beta version 1.8a for animation beta

#                 function (not released beta-version).

#   ~ 25.03.08 :: Script second rewrite - non-released 1.9 beta version in tests

#                 for plain image, animation and audio compatibility.

#   ~ 25.03.08 :: Release of version 2.0! Features:

#                 - [!] Change in the Script's name to Scene_Splash [!]

#                 - Script rewritten; more clear and pure

#                 - New customisation system; unlimited amount of images and audio

#                 - Audio playing system more deep

#                 - Can be disabled in playtest

#                 - Animation compatible

#                 - New Wait engine; dœs not modify Graphics Module anymore

#                 - BreakSplash engine improved; break keys customisable

#   ~ 25.03.08 :: Version 2.0.1 - Slight edit on Scene_Title; the Splash

#                 Screen will not appear more than one time per initialisation.

#                 (Function called OneTimeSplash)

#   ~ 30.03.08 :: Version 2.0.2 - Fixed non-stopable sound bug.

#------------------------------------------------------------------------------

# Shows a splash screen on startup. Compatible only with RGSS2!

#   Questions, acknowledgments and requests may be taken on the script's

#   threads, but you can send me an e-mail at: [email=phabio_almeida@hotmail.com]phabio_almeida@hotmail.com[/email]

#------------------------------------------------------------------------------

#   English thread:

#   [url=http://www.rpgmakervx.net/index.php?showtopic=974]http://www.rpgmakervx.net/index.php?showtopic=974[/url]

#   Portuguese thread:

#   [url=http://www.rpgmakerbrasil.com/forum/f43]http://www.rpgmakerbrasil.com/forum/f43[/url] ... 2-552.html

#   German thread:

#   [url=http://forum.rpgvx.net/index.php?showtopic=481]http://forum.rpgvx.net/index.php?showtopic=481[/url]

#------------------------------------------------------------------------------

#                                                          Respectfully,

#                                                                      D�vic.

#==============================================================================

 

class Scene_Splash

  DisableInDebug = false

  BreakSplash = true

  OneTimeSplash = true

 

  def initialize

    @logo = [

        [ 120, "Splash", 'BGM', "ALMATERIA", 100, 100 ],

        [ 120, "Splash2" ]

      ]

    @fade_delay = 20

    @break = 'Input.press?(Input::B) || Input.press?(Input::C)'

    main

  end

 

  def main

    @logo.each { |a|

      unless a.length < 3

        case a[2]

        when 'BGM'

          Audio.bgm_play("Audio/BGM/#{a[3]}", a[4], a[5])

        when 'BGS'

          Audio.bgs_play("Audio/BGS/#{a[3]}", a[4], a[5])

        when 'ME'

          Audio.me_play("Audio/ME/#{a[3]}", a[4], a[5])

        when 'SE'

          Audio.se_play("Audio/SE/#{a[3]}", a[4], a[5])

        end

      end

      if a[0].kind_of?(Array)

        sprite = Sprite.new

        sprite.bitmap = Cache.system("#{a[1]}1")

        Graphics.transition

        Graphics.fadein(@fade_delay)

        for j in 2..(a[0][0] - 1)

          sprite = Sprite.new

          sprite.bitmap = Cache.system(a[1] + j.to_s)

          a[0][1].times {

            Graphics.update

            Input.update

            (break if eval(@break)) if BreakSplash

           }

          (break if eval(@break)) if BreakSplash

          sprite.dispose

        end

        unless eval(@break)

          sprite = Sprite.new

          sprite.bitmap = Cache.system(a[1] + a[0][0].to_s)

          Graphics.wait(a[0][2])

        end

#        audio_stop(a)

        Graphics.fadeout(@fade_delay)

        sprite.dispose

      else

        sprite = Sprite.new

        sprite.bitmap = Cache.system(a[1])

        Graphics.transition

        Graphics.fadein(@fade_delay)

        a[0].times {

          Graphics.update

          Input.update

          (break if eval(@break)) if BreakSplash

         }

#        audio_stop(a)

        Graphics.fadeout(@fade_delay)

        sprite.dispose

      end

      Graphics.freeze

     }

   end

 

   def audio_stop(a)

    unless a.length < 3

      case a[2]

      when 'BGM'

        Audio.bgm_fade(@fade_delay)

      when 'BGS'

        Audio.bgs_fade(@fade_delay)

      when 'ME'

        Audio.me_fade(@fade_delay)

      when 'SE'

        Audio.se_stop

      end

    end

  end

end

 

class Scene_Title

  alias old_start start

  def start

    unless $splash

      $splash = true if Scene_Splash::OneTimeSplash

      if Scene_Splash::DisableInDebug

        Scene_Splash.new unless $TEST

      else

        Scene_Splash.new

      end

    end

    old_start

  end

  #--------------------------------------------------------------------------

  # * Play Title Screen Music

  #--------------------------------------------------------------------------

  def play_title_music

#    $data_system.title_bgm.play

    RPG::BGS.stop

    RPG::ME.stop

  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