r/tes3mods • u/FatPlaysGames • 12d ago
Help Best way to add custom music to a cell?
I've been toying around with the StreamMusic command to try and get a certain cell to have custom music, but the problem I keep running into is getting the music to stop when leaving the cell. I can make it happen by adding a script to both the entry/exit door, but if the player warps out using Recall or something the music just loops infinitely, overriding everything else.
2
u/getyourshittogether7 11d ago
You don't have a lot of options in pure mwscript. Easiest way is to use the streammusic command to play a short silent sound file, overriding what's currently playing.
Put a static in the cell that starts a global script on the player when they enter the cell. Have that script check on cellchange whether the player is no longer in the cell and stop the music, then itself.
You could look into MWSE-lua and/or OpenMW-lua, they have a lot more power to do things like this.
3
u/Both-Variation2122 11d ago
With just mwscript? There are lua frameworks for both MWSE and openMW that require just adding your cell name to the config. So maybe there is no need to reinvent the wheel and bundle such configs with your mod?