Open / Close Menu Sound

DiegoAngelGamer

Yanfly Follower
Veteran
Joined
Apr 15, 2019
Messages
33
Reaction score
10
First Language
Spanish/English
Primarily Uses
RMMV
Any help at all will be appreciated.

Well, if you open the menu in your game, you will hear the 'Accept' sound you set in the database. The same with closing the menu; you will hear the 'Cancel' sound. Is there a way of changing these sounds without changing the 'Accept' or 'Cancel' sounds in the database? If you don't understand the context or want more information, put it in the comments.

Thank you for your inestimable help and hope I can find a solution to this minor problem, thanks to you!!!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,093
Reaction score
1,509
First Language
EN
Primarily Uses
RMMZ
Pretty sure that'll need a plugin... :kaoswt:
  • "OK" sound on opening the menu seems to be played here:
    Code:
    Scene_Map.prototype.callMenu = function() {
        SoundManager.playOk();
        SceneManager.push(Scene_Menu);
        Window_MenuCommand.initCommandPosition();
        $gameTemp.clearDestination();
        this._mapNameWindow.hide();
        this._waitCount = 2;
    };
  • I think this code is responsible for the "cancel" sound on closing:
    Code:
    Window_MenuCommand.prototype.processCancel = function() {
        SoundManager.playCancel();
        this.updateInputData();
        this.deactivate();
        this.callCancelHandler();
    };
So it looks like you could make a simple plugin: copy+paste those two methods and edit the SoundManager lines as desired. What to replace those lines with? It depends which sounds you'd like to use instead: SoundManager is an interface to AudioManager specifically for system sounds, as defined in the database (cf. rpg_managers.js), but you could probably use AudioManager.playSe to play a non-system SE here without major issues. (I think the major functional difference is that system sounds are precached.)
 

DiegoAngelGamer

Yanfly Follower
Veteran
Joined
Apr 15, 2019
Messages
33
Reaction score
10
First Language
Spanish/English
Primarily Uses
RMMV
So it looks like you could make a simple plugin: copy+paste those two methods and edit the SoundManager lines as desired. What to replace those lines with? It depends which sounds you'd like to use instead: SoundManager is an interface to AudioManager specifically for system sounds, as defined in the database (cf. rpg_managers.js), but you could probably use AudioManager.playSe to play a non-system SE here without major issues. (I think the major functional difference is that system sounds are precached.)
Wow!!! That's REALLY interesting :kaojoy:. Thank you for your AWESOME help. But I can't seem to put this right. Look at this picture and tell me what's wrong. (BTW when I run the game I don't hear any sound when opening the menu, but I hear all of the others).

 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,093
Reaction score
1,509
First Language
EN
Primarily Uses
RMMZ
Oh, I should have given an example, sorry! playSe needs an "audio object" for its input, not just a string, e.g.
Code:
AudioManager.playSe({ name: 'Equipar4', volume: 20, pitch: 100 });
  • name is a string, the name of the audio file
  • volume is a number from 0~100
  • pitch is a number from 50~150
Hope that helps! :kaothx:

Edit @DiegoAngelGamer: also, I'd recommend changing the Window_Selectable part to Window_MenuCommand, otherwise I think it'll override the cancel sound for all selectable windows rather than just the pause menu. :kaoback:

(I originally wrote Window_Selectable in my first post, I guess you copied it before I corrected it. :kaoslp:)
 

DiegoAngelGamer

Yanfly Follower
Veteran
Joined
Apr 15, 2019
Messages
33
Reaction score
10
First Language
Spanish/English
Primarily Uses
RMMV
@caethyril Sorry, I was away for a bit. THAT WAS AWESOME!!! :kaojoy::kaocry: It worked exactly as planned!!! (Also I was going to edit my comment to say that after opening the menu I couldn't hear the 'Cancel' sound anywhere). Your great knowledge of JavaScript should make you the administrator of the forum!!! Not only did you tell me how to do it, but you searched for the exact lines of code that I wanted and gave me an example... :kaoluv:
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,884
Messages
1,017,238
Members
137,608
Latest member
Arm9
Top