[XP] SFX Option Will Not Disable In-Battle Sound Effects

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Hi guys,

I'm currently utilising Bigace360's System Options script, which can be found here: http://bigaceworld.wordpress.com/rgss/custom-menu-scripts/ace-option-system-rmxp/

It's a fantastic and easy to use script, but I'm having a problem with one of the options - the one which enables you to manipulate the volume of Sound Effects. While it works perfectly on the Overworld, any sound effects that are tied to animations in battle still play, which really defeats the purpose of disabling sound. Is there any way to fix this and tie those sound effects into this option? I'm not very good when it comes to scripting, but I imagine it might just be because the animation sound effects are performed under a different bit of code to standard sound effects. Although it's probably not that simple :)

Thank you very much for looking!
 
Last edited by a moderator:

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
I don't like doing this, but as it has been a few days...*Bump!*

Thanks again for looking!
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,541
Reaction score
14,851
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

For several reasons, please don't paste scripts into your posts. You've not formatted it as code, so the indentation has been lost, making it really difficult to read, plus, look through your post yourself and see how it's changed some of the code to smilies (if you can't find them, open the spoiler then search for Input:: ). A link is plenty. And it's okay to bump a thread if there's been no response for 3 days. Also posting in the wrong place might be a reason for the delay in getting assistance (personally, I'm more likely to look at RGSSx Script Support threads than Script Requests threads, and XP might also have fewer scripters here than VX or Ace, which means even less people are likely to look at it).

And yeah, that script changes the volume in the Game_System class, which is okay for event commands, but animations apparently don't call $game_system.se_play - they probably call Audio.se_play directly. Rather than modify Game_System, I think it would be better to directly modify the Audio module.

Try adding this to a new script slot below that one (note I haven't tested this, so if you get any errors, post back with the full error message). It removes that script's changes to Game_System's calling of the bgm/bgs/me/se play methods, and instead puts the logic into the Audio module. It needs to be removed from the Options script, otherwise when you play BGM/BGS/ME/SE via events or on the map, it's going to apply the volume modifier twice, which is undesirable.

Code:
class Game_System  attr_reader :volume  def bgm_play(bgm)    @playing_bgm = bgm    if bgm != nil and bgm.name != ""      Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)    else      Audio.bgm_stop    end    Graphics.frame_reset  end  def bgs_play(bgs)    @playing_bgs = bgs    if bgs != nil and bgs.name != ""      Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)    else      Audio.bgs_stop    end    Graphics.frame_reset  end  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  def se_play(se)    if se != nil and se.name != ""      Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)    end  endendmodule Audio  class << self    alias shaz_bgm_play bgm_play    alias shaz_bgs_play bgs_play    alias shaz_me_play me_play    alias shaz_se_play se_play  end  def self.bgm_play(filename, volume = 100, pitch = 100)    volume *= ($game_system && $game_system.volume && $game_system.volume[:bgm] ? $game_system.volume[:bgm] / 100 : 1)    shaz_bgm_play(filename, volume, pitch)  end  def self.bgs_play(filename, volume = 100, pitch = 100)    volume *= ($game_system && $game_system.volume $game_system.volume[:bgs] ? $game_system.volume[:bgs] / 100 : 1)    shaz_bgs_play(filename, volume, pitch)  end  def self.me_play(filename, volume = 100, pitch = 100)    volume *= ($game_system && $game_system.volume $game_system.volume[:me] ? $game_system.volume[:me] / 100 : 1)    shaz_me_play(filename, volume, pitch)  end  def self.se_play(filename, volume = 100, pitch = 100)    volume *= ($game_system && $game_system.volume $game_system.volume[:se] ? $game_system.volume[:se] / 100 : 1)    shaz_se_play(filename, volume, pitch)  endend
 
Last edited by a moderator:

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Hi Shaz,

Thank you very much Shaz! I apologise for posting in the wrong location - it seems obvious now, but I completely missed that section of the forum. I also removed the embedded script.

There were a couple of syntax errors, but those were easily fixed. Unfortunately, there is a larger error with the BigAce script, and it has to do with the way the sound settings are drawn in the Options menu.

The first is on line 656:

when :volume_bgm, :volume_bgs, :volume_sfx then draw_volume(item, dx, dy, dw)Then from line 665 to 678 (I think I've done it right this time):

def draw_volume(item, dx, dy, dw)self.contents.draw_text(dx, dy, dw/2, line_height, COMMAND_VOCAB[item][0], 1)case itemwhen :volume_bgm then rate = $game_system.volume:)bgm)when :volume_bgs then rate = $game_system.volume:)bgs)when :volume_sfx then rate = $game_system.volume:)sfx)endcolour1 = COMMAND_VOCAB[item][1]colour2 = COMMAND_VOCAB[item][2]value = sprintf("%d%%", rate)rate *= 0.01draw_gauge(dw/2, dy-14, 280, rate, colour1, colour2)contents.draw_text(dw/2, dy, 280, line_height, value, 2)endAny ideas?

EDIT: Oops, sorry! Forgot to post the exact error message. It says:

line 668 ArgumentError occurred.

Wrong number of arguments(1 for 0)
 
Last edited by a moderator:

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Time for another bump. I'm afraid I honestly don't know what to do here. I imagine that since Shaz's script changed the class that the Options script is referencing, I need to change either the volume_xxx or the $game_system.volume :)xxx) bits I listed in my previous post to something else - I'm just not sure what. Thanks in advance =)
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Bump! I'm sorry to keep asking, but I still haven't figured this out. As always, I would appreciate any insight into this problem =)
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,541
Reaction score
14,851
First Language
English
Primarily Uses
RMMV
mmm - didn't realize there was already a volume method there.

Replace my script with this:

class Game_System def bgm_play(bgm) @playing_bgm = bgm if bgm != nil and bgm.name != "" Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch) else Audio.bgm_stop end Graphics.frame_reset end def bgs_play(bgs) @playing_bgs = bgs if bgs != nil and bgs.name != "" Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch) else Audio.bgs_stop end Graphics.frame_reset end 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 def se_play(se) if se != nil and se.name != "" Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch) end endendmodule Audio class << self alias shaz_bgm_play bgm_play alias shaz_bgs_play bgs_play alias shaz_me_play me_play alias shaz_se_play se_play end def self.bgm_play(filename, volume = 100, pitch = 100) volume *= ($game_system && $game_system.volume:)bgm) ? $game_system.volume:)bgm) / 100 : 1) shaz_bgm_play(filename, volume, pitch) end def self.bgs_play(filename, volume = 100, pitch = 100) volume *= ($game_system $game_system.volume:)bgs) ? $game_system.volume:)bgs) / 100 : 1) shaz_bgs_play(filename, volume, pitch) end def self.me_play(filename, volume = 100, pitch = 100) volume *= ($game_system $game_system.volume:)me) ? $game_system.volume:)me) / 100 : 1) shaz_me_play(filename, volume, pitch) end def self.se_play(filename, volume = 100, pitch = 100) volume *= ($game_system $game_system.volume:)se) ? $game_system.volume:)se) / 100 : 1) shaz_se_play(filename, volume, pitch) endend
And because you didn't say what the syntax errors were, you'll have to fix them again.
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Thank you very much Shaz! I really appreciate your help. And no worries - the syntax errors were just a few && symbols near the bottom of the script.

Unfortunately, this leads to a host of new problems. I can now access the Options menu, and the sound settings appear correctly. However, the volume no longer works. Pre-set sound effects (e.g. in Menus) aren't playing at all, and if I change the volume in the Options menu from 100 to 99, the sound turns off completely (it's become binary instead of incremental). Is this something to do with the volume modifier being applied twice, as mentioned in your first post? This seems like it would be a different problem, but I'm really not sure what to make of it.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,541
Reaction score
14,851
First Language
English
Primarily Uses
RMMV
Is my script BELOW the original one? If it's not, then yes, the volume modifier is being applied twice. If it is below, then it shouldn't be, and there's probably something else at work.
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Thanks a lot for the suggestion, but I had put your script directly below the BigAce script already. So it must be something else then...
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
I'm sorry to keep bumping the topic and bothering everyone (particularly you Shaz!), but I'm really not sure what to do about this. I imagined it would be a pretty simple fix, but apparently not...

As far as Shaz's script, I've found that if I take away the second section (module Audio - lines 36-63), then the class Game_System section (lines 1-33) disables the BigAce Option Menu's ability to manipulate the sound (although all normal sound effects still work just fine). With the module Audio section added back in, I can only turn the sound off or on - the option becomes completely binary, and all standard sound effects (e.g. menu noises) stop playing entirely.
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Time for another bump =)

Is there no way to create a new audio class at the top of the BigAce script, which would include the animation sound effects (which Shaz found out call Audio.se_play, instead of $game_system.se_play), and then simply reference that in the BigAce script, instead of what's currently there? Or alternatively, make the animations call $game_system.se_play instead of Audio.se_play, thus bringing them into line with everything else (although I imagine Enterbrain set it up like that for a reason). I must admit, though, I can't even find the script where animations call any type of sound class or module. Anyway, I should note that I'm terrible when it comes to programming, so this is all just conjecture.

Although hang on a second - lines 488 to 494 of the BigAce script define sound effects (specifically se_play(se)) and on line 491 it seems to utilise Audio.se_play. So perhaps that wasn't the problem after all...

For reference:

Code:
	def se_play(se)		if !se.nil? && se.name != ""			volume = se.volume * $game_system.volume(:sfx) / 100			Audio.se_play("Audio/SE/" + se.name, volume, se.pitch)		end	endend
 
Last edited by a moderator:

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
I am very sorry to keep bumping the topic, but I really need a solution for this. Naturally, it's a big problem if the player turns the sound effect volume down and then gets blasted by animations during battle. Unfortunately, I don't even know where to begin with this issue...

With that said, I know people have been viewing the topic, so thank you all very much for looking, regardless of solutions =)
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Bump! I really need to get this problem solved. If anyone has any ideas, I'd sincerely appreciate it.
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Apologies for continuing to bump the topic, but I'm still urgently looking for a solution. As always, any help would be greatly appreciated =)
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
Still here, I'm afraid! Although this may be the last bump... I've asked on multiple other forums without any luck, and tried to contact BigAce360 himself on here (unfortunately, he doesn't visit very often), so I'm pretty much out of ideas. Still, I know people are viewing the topic (443 views!) so thank you all very much for looking =D
 

CriticalGames

Veteran
Veteran
Joined
Aug 8, 2014
Messages
220
Reaction score
65
First Language
English
Primarily Uses
The problem has finally been solved, thanks to Bigace360 himself! It had nothing to do with his script, but was just an RMXP issue.

If anyone is having a similar issue with battle animation sound effects, I recommend taking a look at this script here: http://save-point.org/thread-2585.html
 

Latest Threads

Latest Posts

Latest Profile Posts

Let's see if I can make it in time xD
Knipsel.PNG
Add Smart Help Window Popup to Items and Skills | RPG Maker News #79

Is it unusual to think your own music is strange? xD I honestly don't know if I'm gonna use any of them :p
I've been keeping my cards fairly close to my chest, but Team Muxedo Task is proud to present the first offering for our contest entry: the title screen background.1624496085488.png

Forum statistics

Threads
112,517
Messages
1,068,849
Members
146,195
Latest member
noverian
Top