Skip to content

Initial Project Creation

DarthParametric edited this page Oct 15, 2024 · 3 revisions

Install Visual Studio and the Mod Template

In order to create the mod, we'll make use of a project template which will automate most of the tedious grunt work. Go to the OwlcatNuGetTemplates repository and follow the instructions in the readme to install the appropriate voice mod template - kmsoundvoicemod, wrathsoundvoicemod, or rtsoundvoicemod. If you already have Visual Studio installed then you can skip to the last three steps covering adding NuGet as a source, installation of the Owlcat.Templates package, and the creation of your project using the voice mod template. The template not only creates the C# project, it also creates a Wwise project as well in the same folder.

Customising Your Project

In the <ProjectName>\<ProjectName>\ folder you'll find Info.json, which has been created with the basic details of your mod. You can edit this in a text editor like Notepad++. At a bare minimum, edit the Author field to add your name. You can also populate the HomePage and Repository fields if you plan to upload your mod to Nexus, Github, etc. You'll also want to change the ManagerVersion value to match whatever version of Unity Mod Manager you have installed. If desired, you can edit DisplayName to customise how the mod will appear in UMM. Don't change the Id, AssemblyName, or EntryMethod fields.

If you plan on uploading your mod to Github and don't want the Wwise project folder also being uploaded, open the .gitignore file in the project's root folder in a text editor like Notepad++, scroll to the bottom, and uncomment the appropriate line (e.g. WrathWwiseTemplate/). Take note of the trailing slash (don't delete it). This will result in only uploading the C# source code. By default only a subset of Wwise files and folders, like your audio and banks, are set to be ignored by Git.

Open the C# Project Solution

Before opening the project, make sure you run the target game at least once first in order to generate a log file. Double click on <ProjectName>.sln in the base <ProjectName> folder to open the solution in Visual Studio. In the Solution Explorer panel on the right, click on the ᐅ icon to unfold the ProjectName section. Single click on Main.cs to open it. Most of the mod's functionality is contained in this file. It tells Unity Mod Manager to load it, defines our custom Asks blueprint, and injects it into the game. KM's template has an additional file to deal with the character creator UI, VoiceUIPatch.cs, since it doesn't dynamically scale to fit added soundsets.

If you look at the static void AddAsksListBlueprint() section, you'll see the Asks blueprint which comprises the majority of the file. If you previously examined one of the vanilla barks in JSON format (either JBP or exported from BubblePrints) then the structure will be very familiar to you.

Find the following line at the top of the Asks blueprint definition according to your target game.

KM:

blueprint.DisplayName = CreateString("<ProjectName>", "<ProjectDescription>");

Wrath:

LocalizationManager.CurrentPack.PutString("<ProjectName>", "<ProjectDescription>");

RT:

TBA

The <ProjectDescription> is the string that will be shown in the character creator to describe your voiceset, so make sure that it's correct and in-line with the vanilla voice descriptions/names.

Scroll right down to the bottom and find the following line according to your target game.

KM:

ref BlueprintUnitAsksList[] voices = ref Game.Instance.BlueprintRoot.CharGen.MaleVoices;

Wrath:

BlueprintRoot.Instance.CharGen.m_MaleVoices = BlueprintRoot.Instance.CharGen.m_MaleVoices

RT:

TBA

If you plan on creating a soundset for male characters then you don't need to change anything. However, if you want to create a soundset for female characters then you need to change it as follows, according to your target game.

KM:

ref BlueprintUnitAsksList[] voices = ref Game.Instance.BlueprintRoot.CharGen.FemaleVoices;

Wrath:

BlueprintRoot.Instance.CharGen.m_FemaleVoices = BlueprintRoot.Instance.CharGen.m_FemaleVoices

RT:

TBA

Save Main.cs if you edited it.

For a generic soundset, you shouldn't need to do anything more at this point than an initial Clean in Visual Studio to make sure the Assembly Publicize step takes place. Don't perform a Build yet or you'll get an error about missing files. If you wish to add additional AnimationEvents then that will require editing the blueprint in Main.cs, which will be covered later.