The only problem now is the SFX volume not lowering on the System Options Menu. The BGM and BGS work fine but it's just the SFX's volume that won't go down for some reason.
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
The one issue is that resetting all game objects will result in none of the system options remaining. So yes that means that my second edition I made is the correct one as it does them all except system options.
I agree that we should not reset everything, though I have a few nitpicks on your second version:
- Some
$game_system attributes 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 original
setup_new_game method but aliasing
create_game_objects to save the options you want to carry and put them back in after the reset of the game objects:
Ruby:
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 #DataManager
My take on this was to create an object
YEA_Options_Data that 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.