Skip to content

Getting Started

James Gale edited this page Nov 23, 2022 · 12 revisions

NOTE: This page is mostly obsolesced by the "Create Mod" button in Mod Helper, which automatically creates a mod for you using this template. If either the button or that zip work for you, then the steps on this page will have already been done for you.

Creating a new Mod Project

You'll want to make a new project of the type "Class Library (.NET Framework)"

IMPORTANT: For the folder to create your project in, you should choose the "BTD6 Mod Sources" directory which is generated by default in your Documents folder when running the game with Mod Helper installed. If it's the correct folder, it will have a btd6.targets file in it.

Screenshot of Visual Studio Project Creation

I'd recommend checking the "Place Solution and project in the same directory" box on the next page, but that's up to you.

Dependencies

The new, easy way of doing dependencies is to utilize the btd6.targets file. With your project opened up, double click your project in the solution explorer to edit your .csproj file. You'll want to add the line <Import Project="..\btd6.targets" /> near the bottom, which will look something like this

csproj editing screenshot

The Old / Manual Way of doing dependecies

Screenshot of Visual Studio Reference Adding

You will want to add the following files as dependencies for your mod:

Required

  • "...\BloonsTD6\MelonLoader\MelonLoader.dll"
  • "...\BloonsTD6\MelonLoader\Managed\Assembly-CSharp.dll"
  • "...\Mods\BloonsTD6 Mod Helper.dll"

Reccomended

  • "...\BloonsTD6\MelonLoader\Managed\Il2CppSystem.dll"
  • "...\BloonsTD6\MelonLoader\Managed\mscorlib.dll"
  • "...\BloonsTD6\MelonLoader\Managed\Il2Cppmscorlib.dll"
  • "...\BloonsTD6\MelonLoader\Managed\UnhollowerBaseLib.dll"

The most common location for your BloonsTD6 folder is "C:\Program Files (x86)\Steam\steamapps\common\BloonsTD6" but you can also find it by going to steam and do Manage -> Browse Local Files

Screenshot of Steam browse local files

Main Mod File

In order to access all of the Mod Helper's features, you need a Main mod file that extends from BloonsTD6Mod instead of MelonMod.

using BTD_Mod_Helper;
using MelonLoader;

[assembly: MelonInfo(typeof(TemplateMod.Main), "Your Mod Name", "1.0.0", "Your Name")]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
namespace TemplateMod
{
    public class Main : BloonsTD6Mod
    {
	    
    }
}

This will be important for many Mod Helper features, like Towers, In Game Mod Settings, Auto Updating, and Hooks.

Compiling

To actually compile your mod, you're going to want to enable the "Build Toolbar" in Visual Studio.

Screenshot of visual studio build toolbar

Then, when you hit the Build Button, it will compile your mod and create your .dll file in the "...\YourModName\bin\Debug" folder by default.

If you don't want to have to move the .dll file from there to your mods folder every time, then you can add a Post-Build Event to copy it.

Screenshot of Visual Studio post build event

The text is copy "$(TargetDir)$(TargetFileName)" "C:\Program Files (x86)\Steam\steamapps\common\BloonsTD6\Mods" /y

You might need to change that path if your Bloons TD 6 is installed in a different location.

That's It! That's all you need to create and build Bloons Mods

Clone this wiki locally