This patch (I combined the two code snippets into one script) functions well for SEs, but the BGM option doesn't modify the volume of the currently playing BGM.I suppose you mean that the value will go down but the actual volume will not go down itself.
This issue comes from Blackmorning's Basic Module script which removes the volume modification by Yanfly's option menu.
Here is a compatibility patch that you can put below both scripts:
Ruby:#============================================================================== # ** SE (randomizes pitch) #============================================================================== class RPG::SE < RPG::AudioFile #-------------------------------------------------------------------------- # overwrite method: play (integrates both script's modifications) #-------------------------------------------------------------------------- def play unless @name.empty? #from Yanfly's system options volume = @volume volume *= $game_system.volume(:sfx) * 0.01 unless $game_system.nil? #from Blackmorning's Basic Module pitch = @pitch pitch += rand(7)-3 if BM::RAND_PITCH Audio.se_play('Audio/SE/' + @name, volume, pitch) end end end #RPG::SE
I agree that we should not reset everything, though I have a few nitpicks on your second version:
- Some$game_systemattributes are handled mid-game by the interpreter (namely saving or main menu enabling, encounters and formations, save counts, battle counts and version id), then some scripts might add other attributes to game_system. So a few bugs might get in if someone plays the game, then go back to the main menu in any way and starts a new game without shutting down the game first.
- Yanfly's option menu allows to modify some switches and variables so resetting all of them might not be the right call here, we might need to memorize them too (though in dreamfall887's case, she does not use custom switches or variables so it is fine).
What I think should be done is keeping the originalsetup_new_gamemethod but aliasingcreate_game_objectsto save the options you want to carry and put them back in after the reset of the game objects:
My take on this was to create an objectRuby:module DataManager class << self; alias title_options_create_game_objects create_game_objects; end def self.create_game_objects if $game_system.nil? title_options_create_game_objects else #if the system is already loaded then protect the options you care about: sys = $game_system.dup swi = $game_switches.dup var = $game_variables.dup title_options_create_game_objects #do something to put back the right values for system, #switches and variables here end end end #DataManagerYEA_Options_Datathat can save the options and put them back, though its implementation is not perfect as I bypass yanfly's methods that set the variables so it might have low compatibility with other addons to the option menu.
VXAce Game keeps going to Game Over Screen and I can't figure out why
RGSSx Script SupportThis patch (I combined the two code snippets into one script) functions well for SEs, but the BGM option doesn't modify the volume of the currently playing BGM.
That was not a patch. It was an example for me to use to fix the addon script.
Which is now complete. This can now be tested.
*updated to add on support for my list addon script
Ruby:
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: YEA Title Options ║ Version: 1.03 ║
# ║ Author: Roninator2 ║ ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ Preserve Yanfly System Options ╠════════════════════╣
# ║ ║ 16 Mar 2021 ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: Yanfly's System Options ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description: ║
# ║ Script allows accessing the options screen ║
# ║ before starting the game ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions: ║
# ║ plug and play ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 1.00 - 19 Mar 2021 - Script finished ║
# ║ 1.01 - 20 Sep 2022 - Fixed new game bug ║
# ║ 1.02 - 28 Sep 2025 - Corrected issue for extra system data ║
# ║ 1.03 - 28 Sep 2025 - Adeed support for my List Options addon ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks: ║
# ║ Roninator2 ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Follow the original Authors terms of use where applicable ║
# ║ - When not made by me (Roninator2) ║
# ║ Free for all uses in RPG Maker except nudity ║
# ║ Anyone using this script in their project before these terms ║
# ║ were changed are allowed to use this script even if it conflicts ║
# ║ with these new terms. New terms effective 03 Apr 2024 ║
# ║ No part of this code can be used with AI programs or tools ║
# ║ Credit must be given ║
# ╚════════════════════════════════════════════════════════════════════╝
module DataManager
class << self; alias title_options_create_game_objects create_game_objects; end
def self.create_game_objects
if $game_system.nil?
title_options_create_game_objects
else
sysbase = gather_system_colour_sound
sysextra = gather_system_switch_variable
title_options_create_game_objects
set_system_colour_sound(sysbase)
set_system_switch_variable(sysextra)
end
end
def self.gather_system_colour_sound
data = {}
data[:bgm] = $game_system.volume(:bgm)
data[:bgs] = $game_system.volume(:bgs)
data[:sfx] = $game_system.volume(:sfx)
tone = $game_system.window_tone.clone
data[:red] = tone.red
data[:green] = tone.green
data[:blue] = tone.blue
return data
end
def self.gather_system_switch_variable
data = {}
YEA::SYSTEM::CUSTOM_SWITCHES.each do |sw|
next if !YEA::SYSTEM::COMMANDS.include?(sw[0])
data[sw[0]] = $game_switches[sw[1][0]]
end
YEA::SYSTEM::CUSTOM_VARIABLES.each do |var|
next if !YEA::SYSTEM::COMMANDS.include?(var[0])
data[var[0]] = $game_variables[var[1][0]]
end
if YEA::SYSTEM.const_defined?(:CUSTOM_LISTS)
YEA::SYSTEM::CUSTOM_LISTS.each do |var|
next if !YEA::SYSTEM::COMMANDS.include?(var[0])
data[var[0]] = $game_variables[var[1][0]]
end
end
return data
end
def self.set_system_colour_sound(data)
$game_system.set_volume(:bgm, data[:bgm])
$game_system.set_volume(:bgs, data[:bgs])
$game_system.set_volume(:sfx, data[:sfx])
tone = $game_system.window_tone.clone
tone.red = data[:red]
tone.green = data[:green]
tone.blue = data[:blue]
$game_system.window_tone = tone
end
def self.set_system_switch_variable(data)
YEA::SYSTEM::CUSTOM_SWITCHES.each do |sw|
next if !YEA::SYSTEM::COMMANDS.include?(sw[0])
$game_switches[sw[1][0]] = data[sw[0]]
end
YEA::SYSTEM::CUSTOM_VARIABLES.each do |var|
next if !YEA::SYSTEM::COMMANDS.include?(var[0])
$game_variables[var[1][0]] = data[var[0]]
end
if YEA::SYSTEM.const_defined?(:CUSTOM_LISTS)
YEA::SYSTEM::CUSTOM_LISTS.each do |var|
next if !YEA::SYSTEM::COMMANDS.include?(var[0])
$game_variables[var[1][0]] = data[var[0]]
end
end
end
end #DataManager
class Scene_Title < Scene_Base
alias r2_title_options_start start
def start
r2_title_options_start
DataManager.create_game_objects# if $game_switches.nil?
end
def create_command_window
@command_window = Window_TitleCommand.new
@command_window.set_handler(:new_game, method(:command_new_game))
@command_window.set_handler(:continue, method(:command_continue))
@command_window.set_handler(:options, method(:command_options))
@command_window.set_handler(:shutdown, method(:command_shutdown))
end
def command_options
close_command_window
SceneManager.call(Scene_System)
end
end
class Window_TitleCommand < Window_Command
def make_command_list
add_command(Vocab::new_game, :new_game)
add_command(Vocab::continue, :continue, continue_enabled)
add_command("Options", :options)
add_command(Vocab::shutdown, :shutdown)
end
end
I tested it, it seems to work fine except for the boolean values that are autodash, animations, and walk/run auto. The rest works perfectly!
I was actually confused for a bit about these lines in
set_system_colour_sound:
Ruby:
bgm = 100 - data[:bgm]
$game_system.volume_change(:bgm, -bgm)
$game_system.set_volume(:bgm, data[:bgm])But what you did worked so it's good!
I didn't have such issue regarding bgm volume, not even from the pack of script posted here. Do you have this issue in your project? Can you find if any of your scripts are modifying method
play for BGM?(to find this, search in your scripts with Ctrl+SHIFT+f for
def play( to find any script that would overwrite this method in RPG::BGM)Since they are set in the script as Constants I did not include them.
DEFAULT_AUTODASH = true # Enable automatic dashing by default?
DEFAULT_INSTANTMSG = false # Enable instant message text by default?
DEFAULT_ANIMATIONS = true # Enable battle animations by default?
Try it. When I tested it only worked the way I did it.
I just updated it to include support for my list addon script
That's fair.
Yes I tested it and it worked on my side (I only have your script and Yanfly's original script in my project), I tested with this modified method:
Ruby:
def self.set_system_colour_sound(data)
$game_system.set_volume(:bgm, data[:bgm])
$game_system.set_volume(:bgs, data[:bgs])
$game_system.set_volume(:sfx, data[:sfx])
tone = $game_system.window_tone.clone
tone.red = data[:red]
tone.green = data[:green]
tone.blue = data[:blue]
$game_system.window_tone = tone
end
It crashes on my side as I don't have your list addon script.
You can't use the line
if YEA::SYSTEM::CUSTOM_LISTS != nilsince the constant does not exist and cannot be referred to.I usually use conditions on global variable
$imported to include compatibility patches with tests like this:if $imported["YEA-SystemOptions"]I see, I think that's because I did not use the command correctly I was doing [:bgm] = data[:bgm]
Means I'll have to use an $imported reference in all my scripts. ugh.
*nope, found a way to do a check for constants
updating...
Original thread: https://forums.rpgmakerweb.com/threads/game-keeps-going-to-game-over-screen-and-i-cant-figure-out-why.180313/