Would there be a feasible way to make a code mod using C# and load custom music to run alongside the current OST? It's amazing music, however, after a few hours of play it gets a little repetitive.
I know C# very well and already make loads of mods for Stardew Valley, so if someone could point me in the right direction of what handles music in the game, I could make this a framework ? :)
#Music Modding?
1 messages · Page 1 of 1 (latest)
Also idk if Software Inc. has any Open Source repos or a community-backed decompilation? This would help with implementing this music system. But maybe it's easier to do with just the modding API than I anticipate :p
You can use any Unity/C# function you want, but to access System.IO you'd need to have full access (can be done with a static variable which can be found inside the modding documentation)
Ah I see
Is the game open source then or no to be able to see how the game handles playing the OST?
No, it's not opensource, but as it is written in C# and not il2cpp you can access it's sourcecode (Open Assembly-Csharp.dll)
This works with any Unity game that does not use il2cpp
Newer ones tend to use il2cpp, but there are decompilers for them as well, just more complicated
And to make a mod follow the wiki, it's pretty easy
Just make a reference to the libraries mentioned in the wiki and you'll be able to access them
The library you want is probably UISoundFX.MusicTracks (Which looks like the music from the game) Not sure about this, but yeah
The clip to include probably has to be a child from MusicInstance, but at the end the most important seems to be Clip, as this is whats played 😄
The question is, where is it initialized? But you can go from there
It's probably precompiled in the Editor now that I think about it, but you can intercept it, as you have access to all objects in a Scene
Sadly most of the music related audio stuff is private 😄
UISoundFX.Instance
Don't forget to add a "state" like BuildMode, Spring, ... to your MusicInstance
but from there on you should be able to edit the music easily now that i think about it
- UISoundFX.Instance.MusicTracks
- Add your MusicInstance objects there, they've some custom things like State (seems important as it is changed by code to Spring, BuildMode etc)
- You can include the AudioClips the way you would include them in any Unity game by code
- You need to GiveMeFreedom or however the variable is called. You can find it in the wiki
- That should be it
Ahhhh awesome! Thank you!!
Thanks :)
You shouldn't need GiveMeFreedom. The DLLMod class has a "LoadAudio" function to load mp3, ogg or wav files.
looking at it now, you should be able to just add MusicInstances to the UISoundFX instance with AudioClips loaded using the LoadAudio function and it would work on the SteamWorkshop as well