Change a database Sound Effect mid-game

Hello

I'm using a plugin that plays the "Equip" sound effect from the database when swapping weapons mid fight. I like the sound I picked for the Equip menu, but it's not the best sound for swapping weapons around during a battle.

I'm thinking of adding a command pre-battle and post-battle that changes the system sound for Equip, but there's no such command in RMMZ or in the plugin commands. I also couldn't find anything in the script call list.

Thanks!
Could you insert a screenshot of the plugin parameters? Sometimes these parameters can be customized. It might allow you to choose a different SE
Could you insert a screenshot of the plugin parameters? Sometimes these parameters can be customized. It might allow you to choose a different SE

Thanks for the quick reply!
Unfortunately, the plugin has very few parameters and none related to sound. This is the documentation:
Maybe, if the sound is used only in battle it is possible to change it if you hack the SoundManager.playEquip method.
However I have no idea if visustella actually uses that method to play sound.
1726047364176.png


Here’s a possible solution. Go to the Visustella BattleCore plugin, enter "Mechanics Settings," and add the code you see under "perform actions" (Post-Start Battle)

The number you see inside the playSystemSound method refers to the position of the sounds in the database (System 1). The count starts from zero.

In this example: At the beginning of the battle, I choose the sound "Save2" instead of the sound "Equip1."

At the end of the battle, I revert everything back to its original state. This allows you to change the sounds in your database without any issues. The only restriction is that you can only replace sounds with SE that are present in the System 1 database

Revert to the initial state after the battle
1726047958144.png


As seen before, here we restore the sound after the battle ends. So, we will write similar code in the Post-End Battle section.
The only restriction is that you can only replace sounds with SE that are present in the System 1 database
I don't see any reason you can't replace the this.playSystemSound() with the regular code to play a sound effect, as found on the script call list.

You could even use a game variable to store the filename referenced in that function call to change the sound under any circumstances you like.
Here's a script call that will change the equip sound for MV, I assume it's the same for MZ. Change what is in the quotes to the sound's filename that you want. A couple of things to note, this change will affect all saves, and will last until you change it back or when the game is shutdown or the game window is closed. Each time the game is opened back up, the sound fx will revert back to what's in the database. I hope that was clear. Good luck.
JavaScript:
$dataSystem.sounds[4].name = "Equip2";
I don't see any reason you can't replace the this.playSystemSound() with the regular code to play a sound effect, as found on the script call list.

You could even use a game variable to store the filename referenced in that function call to change the sound under any circumstances you like.

This is a wonderful idea. This way, there would be greater customization. I'll immediately add the code variant. Thank you for the suggestion :LZYsmile:


/*
Variant of the code suggested above. Here, it is important to enter the exact name of the file without the extension.
*/
JavaScript:
SoundManager.playEquip = function() {
    AudioManager.playSe({name: 'Save2', pan: 0, pitch: 100, volume: 100});
};
Sorry I'm just seeing this now.

Thanks a lot for the wonderful and really detailed help!
I'll try to implement that soon!


Edit: I just tried it and it works perfectly!
Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/change-a-database-sound-effect-mid-game.171827/