Modding Tools - KittenAqua/TrainworksModdingTools GitHub Wiki

These wiki pages are deprecated and are outdated. Please find the newer tutorials here

Modding Tools

The following are commonly used when modding, and it is recommended that you download them.

1. Any C# decompiler

A frequently used one in the Monster Train community is dnSpy: https://github.com/0xd4d/dnSpy
Another option is ILSpy: https://github.com/icsharpcode/ILSpy
And yet another is dotPeek: https://www.jetbrains.com/decompiler/

Start up the decompiler. Navigate to the MonsterTrain_Data/Managed folder and open up Assembly-CSharp.dll in it. This is the dll that contains all the code for the game. Later we'll talk about patching methods with Harmony; for now, just know that this is how you figure out which methods to patch.

If you spend some time looking around, you'll notice that the cards are nowhere to be found. There's no Frozen Lance in the code. That's because cards don't have their own classes; they're loaded from Unity assets. In order to view them, we'll need another program:

2. A Unity asset explorer

There's really only one good option for this right now, and it's AssetStudio: https://github.com/Perfare/AssetStudio

Using it's a bit unintuitive. Follow these instructions exactly.

  1. Open AssetStudio
  2. File -> Open Folder
  3. Select the MonsterTrain_Data folder and open it; it'll take a minute to load
  4. Switch to the Asset List tab at the top
  5. Search for a card. For example, Frozen Lance is called StarterIceSpear. Click it.
  6. Another folder chooser will pop up with absolutely no explanation. Choose the Managed folder. If you don't, you'll have to close the whole program and go back to step 1.
  7. You should now see all of Frozen Lance's data on the right side. If you only see a small stub, it's because you didn't choose the Managed folder.

3. Runtime Unity Editor

The Runtime Unity Editor by ManlyMarco: https://github.com/ManlyMarco/RuntimeUnityEditor

This is a BepInEx plugin. Install it as you would any other mod. Then, while in game, hit F12, and you should see a big, scary Unity GUI. This shows all the objects in the current scene. It's very convenient for both exploration and debugging.

Next: Using Harmony