Skip to content

Valheim-Modding/JotunnModExample

Repository files navigation

JotunnModExample

Example Valheim mod built with Jötunn. Most of our Tutorials refer to this examples.

Building

How to setup the development enviroment for this project.

  1. Install Visual Studio 2022 and add the C# workload.
  2. Download this package: BepInEx pack for Valheim
  3. Unpack and copy the contents of BepInExPack_Valheim into your Valheim root folder. You should now see a new folder called <ValheimDir>\unstripped_corlib and more additional stuff.
  4. Clone this repository using git.
  5. Open the Solution file <JotunnModExample>\JotunnModExample.sln and build the project

A new environment file Environment.props can be created in the projects base path <JotunnModExample>. Make sure you are not in any subfolder. Paste this snippet and change the paths accordingly.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <!-- Valheim install folder. This is normally found automatically, uncomment to overwrite it. Needs to be your path to the base Valheim folder. -->
    <!-- <VALHEIM_INSTALL>X:\PathToYourSteamLibary\steamapps\common\Valheim</VALHEIM_INSTALL>-->

    <!-- This is the folder where your build gets copied to when using the post-build automations -->
    <MOD_DEPLOYPATH>$(VALHEIM_INSTALL)\BepInEx\plugins</MOD_DEPLOYPATH>
  </PropertyGroup>
</Project>

Unity

To open the embedded Unity project you first have to copy all game dlls starting with assembly_ found at <Valheim>\valheim_Data\Managed to <JotunnModExample>\JotunnUnityExample\Assets\Assemblies. Copy these before you open the project and only copy them using the explorer.