Yanfly System Options Global Volume?

SaburoX

Veteran
Veteran
Joined
Jan 27, 2013
Messages
87
Reaction score
8
Primarily Uses
Hi everyone.
I'm using Yanfly's System Options in my project (with a couple additions to afford the player a full screen option that should not be affecting this).
I've noticed a problem with the volume control; namely that it's not universal. Any script that itself calls a sound effect or other audio file is not effected by the volume settings. So for example if I use TheoAllen's Simple Message SE (or really any with that function), those settings play at their independent volume setting rather than what the game as a whole is set to.

So my question is how to I fix that? I figure I need to go into those other scripts and call the new settings from there but I don't know how to do it.

The VX versions of system options mapped volume control to variables, so I could just call them, but the Ace version doesn't do that.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
I would suggest that you have a script incompatibility.
I know that when I used XaiL System it overwrote the Yanfly Systems nullifying the controls for sound, just like what your describing.
Try disabling your scripts one at a time (or in groups) to see if that is the issue.
Use Rycochet - Disable Scripts; to easily help with that.
 

SaburoX

Veteran
Veteran
Joined
Jan 27, 2013
Messages
87
Reaction score
8
Primarily Uses
I would suggest that you have a script incompatibility.
I know that when I used XaiL System it overwrote the Yanfly Systems nullifying the controls for sound, just like what your describing.
Try disabling your scripts one at a time (or in groups) to see if that is the issue.
Use Rycochet - Disable Scripts; to easily help with that.
I had thought it might be a script incompatibility (especially since like you I'm using XaiL system) but I made a test project using the bare minimum to see if the problem was recreated: So currently I'm using
Fullscreen ++
Yanfly Ace Message
Simple Message SE
Yanfly System Options

That's it. And as I can see in Simple Message SE, it has me specify the volume of the sound effect independently. That's what's overwriting. Most scripts that have their own audio commands ask for something similar. I need a way to tell it "set the volume to whatever the volume is in Yanfly System Options".
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
Understood, I didn't really look at TheoAllen's script. There may not be a solution for what your looking for with this script.
I would suggest using Text sound effects script by Zerbu. It is what I have now and there is no problems with yanfly. I also do not use Xail system because of its issues with yanfly. My project has 187 scripts in it. So I've done quite a bit of testing for compatibility.
 

SaburoX

Veteran
Veteran
Joined
Jan 27, 2013
Messages
87
Reaction score
8
Primarily Uses
Okay, I think I've actually solved this myself after all. It's not really an issue with an unrelated script compatibility, but rather as I said it's the various audio sound effects scripts having their own settings that overwrite volume.
So I was able to fix it by finding those sections and redefining volume to call from Yanfly's after all, using the code

Code:
        volume (or vol or whatever the script uses) = $game_system.volume(:sfx) unless $game_system.nil?
        Audio.se_play(name,volume, 100)
Changing ":sfx" to ":bgm" and "audio.se_play" to "audio.me_play' as necessary. I ended up using a different Message SE script but that solution works with both.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
That might seem to work, but in reality, you just rendered the volume setting in Theo's message SE script useless.
What you really want is to keep that setting intact while fixing the SE volume setting effects at the same time.
The setting in Theo's script should be set to the volume value when the SE setting is set to 100%.

A simple fix is to use the other method to play an SE:
Code:
def play_msg_se
    @charwait += 1
    return if $game_switches[Switch_id]
    return unless @charwait % [CharWait,1].max == 0
    pitch = Pitch + (rand(RandPitch*2) - RandPitch)
    RPG::SE.new(FileName,Volume,pitch).play
  end

This method is also way more compatible with every script, so there is really not much point in using any other ways of playing any kind of audio files in scripts.
You can change the SE part in that to BGM, BGS, or ME too, based on what kind of audio type you want to play.
This way of playing an audio file should account for the SE settings from Yanfly's script.
 

SaburoX

Veteran
Veteran
Joined
Jan 27, 2013
Messages
87
Reaction score
8
Primarily Uses
That might seem to work, but in reality, you just rendered the volume setting in Theo's message SE script useless.
What you really want is to keep that setting intact while fixing the SE volume setting effects at the same time.
The setting in Theo's script should be set to the volume value when the SE setting is set to 100%.

A simple fix is to use the other method to play an SE:
Code:
def play_msg_se
    @charwait += 1
    return if $game_switches[Switch_id]
    return unless @charwait % [CharWait,1].max == 0
    pitch = Pitch + (rand(RandPitch*2) - RandPitch)
    RPG::SE.new(FileName,Volume,pitch).play
  end

This method is also way more compatible with every script, so there is really not much point in using any other ways of playing any kind of audio files in scripts.
You can change the SE part in that to BGM, BGS, or ME too, based on what kind of audio type you want to play.
This way of playing an audio file should account for the SE settings from Yanfly's script.
As I said in the previous post I've already tried using a different message SE script and there were other scripts with audio cues besides that had similar problems. This solution only seems to work for the one script; What would I do for others? Like, for example, similar volume control issues occur in Vlue's Basic Message SE which I've since upgraded to, Journey Battle System, and Moghunter's ATB.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
The exact same thing.
Change the Audio.se_play method to the RPG::SE.new(filename,volume,pitch) method.
The same can be done with any other audio playing methods, so:
  • Audio.bgm_play('folderpath+filename',volume,pitch,pos) --> RPG::BGM.new('filename',volume,pitch).play
  • Audio.bgs_play('folderpath+filename',volume,pitch,pos) --> RPG::BGS.new('filename',volume,pitch).play
  • Audio.me_play('folderpath+filename',volume,pitch) --> RPG::ME.new('filename',volume,pitch).play
  • Audio.se_play('folderpath+filename',volume,pitch) --> RPG::SE.new('filename',volume,pitch).play
The only downside is that you can't specify the folder path to the file you want to play, but that is not really a big thing, at least in most cases.
And the starting position can't be set this way for BGM and BGS, but I haven't seen any scripts actually using that anyway.

If you need to use the Audio.xx_play methods (in case some of them loads a file from a non-standard folder or need the position argument), you can simply multiply the volume value with $game_system.volume(audio_type) * 0.01, and it will work as well.
Just replace the audio_type with :bgm, :bgs, :me or :se for the correct setting values.

Note that Yanfly's System Options script is only effective after you start/load a game, so it will NOT load the settings on your title screen.
The title screen will have the default volume values you set up in Yanfly's script.
This can only be changed by making Yanfly's script settings be global settings (load from a real, physical file instead). There are scripts for this too, in case you need it.

Edit:
Damn, smiley face codes on this forum are too... annoying. Why can't I turn them off? >.>

Edit2:
Whoops, I forgot to put .play at the end of the method calls. Sorry! *-*
 
Last edited:

SaburoX

Veteran
Veteran
Joined
Jan 27, 2013
Messages
87
Reaction score
8
Primarily Uses
I tried replacing the relevant line of code in Vlue's Message SE script with the RPG::SE.new('filename',volume,pitch) method and I don't get any playback at all. I tried specifying the file directly, using the @se code as well, and "filename". either way, it's just silent.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You have to replace the arguments in that method with the ones used in Vlue script (and in any other scripts).

For example, you see this in Vlue's script:
Code:
Audio.se_play("Audio/SE/" + @se, @volume, rand(@pitch[1]-@pitch[0]) + @pitch[0])
Carefully observe the commas in the arguments.
You leave out the folder path part, so you don't need the "Audio/SE/" + part at all in the other method type.
That leaves the @se as the filename argument, because the first argument is always the filename in both method types.
The @volume is the second argument here, and it goes at the second place as well in the other method type.
The long calculation after the @volume is what will set the pitch, so, the whole rand(@pitch[1]-@pitch[0]) + @pitch[0] thing will return a single integer at the end. This is the third argument here, and goes at the same place in the other method type.

So, after learning all this, you can convert that line to this:
Code:
RPG::SE.new(@se, @volume, rand(@pitch[1]-@pitch[0]) + @pitch[0]).play
This is how the other method type looks like, using the same arguments as Vlue used originally.

You can do this with every Audio.xx_play(f,v,p) method calls, just use the same arguments you see in the RPG::XX(f,v,p).play method type.

When I write things like RPG::SE('filename',volume,pitch).play, those are just examples of the method and it's arguments. You need to set the argument values yourself, copying the exact same thing won't work.

I guess, you don't get any sound effects playing because I forgot to include the .play part at the end of the method call. >.>
So, you should put that .play at the end and it should work.
 

SaburoX

Veteran
Veteran
Joined
Jan 27, 2013
Messages
87
Reaction score
8
Primarily Uses
Okay yeah. I must've been forgetting a comma or the .play.
Thanks for the help. That method is a lot cleaner.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top