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.

quick script

I need help with the victory music because its long very long
so i need a quick script that i can put in so its stops playing after
you get out of victory screen.
 
Okay, first in Game_System look for

Code:
  #--------------------------------------------------------------------------
  # * Play Music Effect
  #     me : music effect to be played
  #--------------------------------------------------------------------------
  def me_play(me)
    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

After it, add:

Code:
  #--------------------------------------------------------------------------
  # * Stop Background Music
  #--------------------------------------------------------------------------
  def me_stop
    Audio.me_stop
  end
  #--------------------------------------------------------------------------
  # * Fade Out Background Music
  #     time : fade-out time (in seconds)
  #--------------------------------------------------------------------------
  def me_fade(time)
    @playing_me = nil
    Audio.me_fade(time * 1000)
  end

Now, in Scene_Battle 2, find this bit and add in the one line in red:

Code:
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Battle ends
[COLOR=Red]      $game_system.me_stop[/COLOR]
      battle_end(0)

You can also use $game_system.me_fade(x) instead, where x is how long you want it to take to fade out. I believe it's in milliseconds, but play around with it to find out.
 
Code:
begin
  SDK.log('Victory Music Ends', 'sandgolem', 1, '7.06.06')
  rescue
end

class Scene_Battle
  alias sandgolem_victorymusend_battle_main main
  def main
    sandgolem_victorymusend_battle_main
    Audio.me_stop
  end
end

Here is a script from sandgolem. I tried to find the link to the exact script but I couldn't find it. Anyway, what I like about this script is that you don't have to change any of your default scripts. You insert this script above main and under sdk, if you have it. It still works even if you don't have sdk.
 

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