Introduction
Hey guys! Have you ever wanted to create mods? If yes (like me), this tutorial is for you!
We will make mods for version 1.4.4 of Terraria.
Let's get down to business!
What are we going to study in this tutorial:
- How to go in modding
- How to create mod skeleton
- What is in the sources of the mod and how to use that
How to go in modding
First, you should know C#. Terraria is written on it and, accordingly, mod for it must also be written on it too.
I didn't know C# in my early days in modding, so I was very unprogressive.
Second, you need tModLoader. You can download it
here.
Third, you can install a programming environment like Visual Studio (
download).
Of course, you can work in notepad, but it is very inconvenient and there, unlike the Visual Studio,
it is impossible to use the .csproj file, with the help of which Visual Studio will be able to detect errors and know the entire Terraria library (like all item IDs).
How to create mod skeleton
1. Run tModLoader and click Workshop
View attachment 406044
2. Click Develop Mods and then click Create Mod
View attachment 406046
View attachment 406047
3. Fill in these fields
- Mod name in code (eg. MyMod)
- Mod public name (eg. My First Mod)
- Mod Author(s) (eg. This is Many)
- Mod's first item. It will be sword.
We will see it in the next tutorial!
View attachment 406050
4. Click Open Sources
View attachment 406051
Now you can develop your mod!
What is in the sources of the mod and how to use that
Your mod sources will be look like that (yes, I'm on mac):
View attachment 406053
Let's take a look at each file in order!
build.txt
It contains information about the mod - its name, author, version, homepage etc. You can customise it, o' course!
Default stats:
displayName = My First Mod (the name of the mod)
author = This is Many (author of the mod)
version = 0.1 (mod version)
Additional Stats:
homepage = https://discord.gg/Z5v6JX6gEH (the main page of the mod, maybe discord server etc.)
hideCode = true/false (hide the mod's code of extracting?)
hideResources = true/false (hide the mod's .png files of extracting?)
includeSource = true/false (include mod sources on extracting?)
buildIgnore = *.csproj, *.user, obj\*, bin\*, .vs\*, Old\*, Other\* (files that you don't want to built in mod)
description.txt
The mod description. Nothing special except something:
[i/s1:981]
You can place that in your description to do item sprites in it! just replace 981 with ID of item you want to see!
View attachment 406055
icon.png
Mod icon in game. You will already have the frame for it in mod folder (View attachment 406057), but you can create your own!
Also there are 3 types of icons:
- icon is a default icon in game. Must be 80x80 pixels.
- icon_workshop is optional and it is an icon in steam workshop. Must be 512x512 pixels.
- icon_small is a bestiary filter of your mod. Must be 30x30 pixels.
MyMod.cs
This is a mod main file, like Main.cs in Terraria code. Can contain many things, we will learn about them in next tutorials!
MyMod.csproj
Used by Visual Studio to able it finding errors and know entire Terraria library.
Properties
Properties are used mainly for organization like specifing where will the sprites from weapons be searched for (leave blank and it will search the .png file with the same name as namespace's in folder where namespace directs)
Items
Yes, creating mod. This folder will contain all your mod items.
I would suggest creating a new folder named Content and putting it there, it will be much cleaner than just throwing it all around in the mod folder.
We will learn basic sword in the next tutorial
Ending
Thanks to everyone who read this tutorial to the end. I hope it will help many beginners in modding. I worked really hard on this tutorial, and I will be happy to see your feedback. Any questions allowed in comments! See you on the next tutorial!
Git Gud