This is meant to act as a guide for anyone trying to get started with modding in Valheim. I am planning on adding multiple example mods as tutorials for people to follow along with. Hope you enjoy and please leave a star if this helps you.
Make sure that you have all of the requirements downloaded onto your pc
- Go to your steam library and right click on Valheim and select manage.
- Select Local file and then open in file explorer
InSlimVLM is a mod loader that you will need in order to run your mods that you create. Here is a video tutorial by the creater of the tool https://www.youtube.com/watch?v=gBbtVRAxztM
- Open up the zip file from the InSlimVLM download and select all of the files inside of the zip
- Copy those files into Valheim game files
Steam/steamapps/common/Valheim/
- Replace the existing files with the new ones when prompted
- Also download https://cdn.discordapp.com/attachments/811730725900386344/814475805584261140/winhttp.dll
- Replace
winhttp.dll
inSteam\steamapps\common\Valheim
with the new version (This enables logging inSteam\steamapps\common\Valheim\InSlimVML\
for debug purposes) - Run Valheim and view the homepage to see that VlmSlim is running
- Download the latest release zip file from https://github.com/dnSpy/dnSpy
- Run DnSpy and select all directories shown on the left side and remove them (left side should be clear)
- Grab the .dll file
Steam/steamapps/common/Valheim/valheim_Data/Managed/assembly_valheim.dll
- Click and drag that file into the left side file explorer of DnSpy and take a look at all of the source code!
- Fork this repo
- Open up VS and create new Visual C# Class library .NET Framework based upon the code forked from here
- Make sure that you are using .NET Framework 4.7.2
- Comment out
PostBuildEvent
in theAlexValheimTest.csproj
file (we will come back to this) - On the Solution Explorer view add the following dependencies
Steam\steamapps\common\Valheim\InSlimVML\Mods\0Harmony.dll
Steam\steamapps\common\Valheim\valheim_Data\Managed\assembly_valheim.dll
Steam\steamapps\common\Valheim\valheim_Data\Managed\UnityEngine.dll
Steam\steamapps\common\Valheim\valheim_Data\Managed\UnityEngine.CoreModule.dll
- Build the project and copy the file path from the output view shown below
- Find your projects .dll file from the build
- Go back to Valheim game files
Steam\steamapps\common\Valheim\InSlimVML\Mods
- Copy and paste your generated .dll file into the
Mods
directory - Run valheim and press f5 to see the running code!
- Congrats you made your first mod
You can automatically have your .dll file go straight into the InSlimVLM folder using a PostBuildEvent
- Upon building your project, look for the direectory in which the .dll file is saved
- Copy the filepath for the .dll file (Shift + Right Click on the file name and select Copy as Path)
- Go back to the
AlexValheimTest.csproj
file and uncomment out thePostBuildEvent
- Copy and paste the file path into the first part
- Go and copy your
Steam\steamapps\common\Valheim\InSlimVML\Mods
filepath in the same way - Paste that path into the second set of quotes
- Now when you build it will automatically save the .dll file to the proper location
Alex Hurley - [email protected]
Project Link: https://github.com/ahh1539/ValheimMods