I'm trying to add sound effects on my custom menu. But upon testing
Here is my code:
Update: I don't know if this is a good way to change the default sounds of the menu, but what I did is backed up the mmz_managers.js file and modify its functions. That solved my problem.
SoundManager.playEquip();, the sound was just added on top of the default sound. How can I remove the default sound effects only on my custom menu?Here is my code:
JavaScript:
class WindowTest extends Window_Base {
constructor(rect) {
super(rect);
}
}
class SceneTest extends Scene_MenuBase
{
create()
{
super.create();
var rect = new Rectangle(100, 200, 500, 300);
this._customWindow = new WindowTest(rect);
this._customWindow.drawText("First Box", 0, 0);
this.addWindow(this._customWindow);
var rect2 = new Rectangle(3, 125, 595, 490);
this._slotCommandWindow = new TestCommand(rect2);
this._slotCommandWindow.setHandler("slotCommand1", this.slotCommandTest1.bind(this));
this._slotCommandWindow.setHandler("slotCommand2", this.slotCommandTest2.bind(this));
this._slotCommandWindow.setHandler("slotCommand3", this.slotCommandTest3.bind(this));
this.addWindow(this._slotCommandWindow);
}
slotCommandTest1()
{
console.log('command 1 selected');
}
slotCommandTest2()
{
console.log('command 2 selected');
}
slotCommandTest3()
{
console.log('command 3 selected');
}
exitSlotCommandTest()
{
console.log('exit');
}
}
class TestCommand extends Window_Command
{
constructor(rect)
{
super(rect);
}
makeCommandList()
{
this.addCommand ("First Command", "slotCommand1");
this.addCommand ("Second Command", "slotCommand2");
this.addCommand ("Third Command", "slotCommand3");
}
}
SceneTest.prototype.update = function()
{
Scene_MenuBase.prototype.update.call(this);
if(Input.isPressed("up") || Input.isPressed("down"))
{
SoundManager.playEquip();
}
}
Update: I don't know if this is a good way to change the default sounds of the menu, but what I did is backed up the mmz_managers.js file and modify its functions. That solved my problem.