Jump to content
Zerbu

Zerbu Engine - Game Over BGM

Recommended Posts

Game Over BGM

 

Introduction

This script allows you to set a full BGM to play on the game over screen, instead of just an ME. The BGM will play after the ME, so if you don't want an ME at all, you can turn the ME off in the system settings. You can also set multiple game over BGMs to randomize between.

This is the last of my easy to make scripts for now. I think I'm ready to move up to a more intermediate level.

 

Instructions

To change this during the game:

ze_gameoverbgm(:randomize, [["Scene5", 100, 80]])

 

Script

 

 

#============================================================================
# Zerbu Engine - Game Over BGM
#----------------------------------------------------------------------------
# This script allows you to set a full BGM to play on the game over screen,
# instead of just an ME. The BGM will play after the ME, so if you don't
# want an ME at all, you can turn the ME off in the system settings.
# You can also set multiple game over BGMs to randomize between.
#----------------------------------------------------------------------------
# To change this during the game:
# ze_gameoverbgm(:randomize, [["Scene5", 100, 80]])
#============================================================================

#============================================================================
# ZE_Game_Over_BGM
#============================================================================
class ZE_Game_Over_BGM
 #--------------------------------------------------------------------------
 # new method: initialize
 #--------------------------------------------------------------------------
 def initialize
#---
@data = {
  #----------------------------------------------------------------------
  # Options
  #----------------------------------------------------------------------
  # This is the BGM, or list of BGMs, that can play on the game over
  # screen.
  #----------------------------------------------------------------------
  :RANDOMIZE => [
	["Scene5", 100, 80]
  ]
}
#---
 end

 #--------------------------------------------------------------------------
 # new method: []
 #--------------------------------------------------------------------------
 def [](setting)
#---
@data[setting] || false
#---
 end

 #--------------------------------------------------------------------------
 # new method: []=
 #--------------------------------------------------------------------------
 def []=(setting, value)
#---
@data[setting] = value
#---
 end
end

#============================================================================
# DataManager
#============================================================================
module DataManager
 class << self
#------------------------------------------------------------------------
# alias method: create_game_objects
#------------------------------------------------------------------------
alias ze_gameoverbgm_create_game_objects create_game_objects
def create_game_objects
  #---
  ze_gameoverbgm_create_game_objects
  $ze_gameoverbgm = ZE_Game_Over_BGM.new
  #---
end

#------------------------------------------------------------------------
# alias method: make_save_contents
#------------------------------------------------------------------------
alias ze_gameoverbgm_make_save_contents make_save_contents
def make_save_contents
  #---
  contents = ze_gameoverbgm_make_save_contents
  contents[:ze_gameoverbgm] = $ze_gameoverbgm
  contents
  #---
end

#------------------------------------------------------------------------
# alias method: extract_save_contents
#------------------------------------------------------------------------
alias ze_gameoverbgm_extract_save_contents extract_save_contents
def extract_save_contents(contents)
  #---
  ze_gameoverbgm_extract_save_contents(contents)
  $ze_gameoverbgm = contents[:ze_gameoverbgm] ? contents[:ze_gameoverbgm] : ze_gameoverbgm.new
  #---
end
 end
end

#============================================================================
# Scene_Gameover
#============================================================================
class Scene_Gameover < Scene_Base
 #--------------------------------------------------------------------------
 # alias method: play_gameover_music
 #--------------------------------------------------------------------------
 alias ze_gameoverbgm_play_gameover_music play_gameover_music
 def play_gameover_music
#---
ze_gameoverbgm_play_gameover_music
#---
bgm = $ze_gameoverbgm[:RANDOMIZE][rand($ze_gameoverbgm[:RANDOMIZE].size)]
RPG::BGM.new(bgm[0], bgm[1], bgm[2]).play
#---
 end
end

#============================================================================
# Game_Interpreter
#============================================================================
class Game_Interpreter
 #--------------------------------------------------------------------------
 # new method: ze_gameoverbgm
 #--------------------------------------------------------------------------
 def ze_gameoverbgm(setting, value)
#---
$ze_gameoverbgm[setting.upcase] = value
#---
 end
end

 

 

Edited by Zerbu

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted