last update: 28th of September, 2018
Table of Contents
- Table of Contents
- Introduction
- What is tModLoader?
- Help
- Text-Editors and IDEs
- Info (includes other useful guides/tutorials and mod specific wikis)
Introduction
Hello and welcome to the tModLoader's official help thread! This thread was made to take some strain off the original thread, and is just an alternative place to get help. Also this place will house links to helpful guides and tutorials, as well as snippets of code with explanation, resources.. and so forth.
Back to top
What is tModLoader?
tModLoader is like an API such as the old tConfig and discontinued tAPI. It is literally a mod to make mods. As a developer, you might already know that the Terraria src (source-code) is difficult to deal with for a modder. tModLoader aims to make it far easier for you to create your mod, as well as share your mod for others to use. Traditionally, stand-alone mods are created. An upside to this way of modding is that you can literally do whatever you want to without being limited to an API's possibilities. A downside is that stand-alone mods usually aren't compatible with each other, as well as the developer(s) needing to know the Terraria source-code.
You can find all tModLoader methods, fields and properties in
Back to top
Useful locations and paths
Below you can find folder locations which mind come in handy when using tModLoader. Only default paths are listed.
XNA .dll location / files
If you're on windows, navigate to C:\Windows\Microsoft.NET\assembly\GAC_32\
You can find the folders for the XNA framework in there. Alternatively, you could paste this search string in the path bar:
Code:
search-ms:displayname=Search%20Results%20in%20GAC_32&crumb=filename%3A~<Microsoft.XNA%20OR%20System.Generic.String%3AMicrosoft.XNA&crumb=fileextension%3A~<Microsoft.XNA*.dll%20filename%3A~<Microsoft.XNA*.dll%20OR%20System.Generic.String%3AMicrosoft.XNA*.dll&crumb=location:C%3A%5CWindows%5CMicrosoft.NET%5Cassembly%5CGAC_32
Default Terraria location
Here the main files of Terraria are stored. These locations are default locations chosen during the installation of the Terraria game.
Mac: Library/Application Support/Steam/steamapps/common/Terraria/Terraria.app/Contents/MacOS
Linux: .local/share/Steam/steamapps/common/Terraria
Windows: C:\Program Files (x86)\Steam\steamapps\common\Terraria
Linux: .local/share/Steam/steamapps/common/Terraria
Windows: C:\Program Files (x86)\Steam\steamapps\common\Terraria
GoG Terraria location
Here the main files of Terraria are stored. These locations are default locations chosen during the installation of the Terraria game.
Mac: ??
Linux: ??
Windows: C:\GOG Games\Terraria
Linux: ??
Windows: C:\GOG Games\Terraria
Default Terraria documents location
Mac: /Users/account/Library/Application Support/Terraria
Linux: ~/.local/share/Terraria OR $XDG_DATA_HOME/Terraria
Windows: %UserProfile%\Documents\My Games\Terraria
Linux: ~/.local/share/Terraria OR $XDG_DATA_HOME/Terraria
Windows: %UserProfile%\Documents\My Games\Terraria
Default tModLoader documents location
Mac: /Users/account/Library/Application Support/Terraria/ModLoader
Linux: ~/.local/share/Terraria/ModLoader OR $XDG_DATA_HOME/Terraria/ModLoader
Windows: %UserProfile%\Documents\My Games\Terraria\ModLoader
Linux: ~/.local/share/Terraria/ModLoader OR $XDG_DATA_HOME/Terraria/ModLoader
Windows: %UserProfile%\Documents\My Games\Terraria\ModLoader
Default tModLoader mods' src folder
Here the sourcecode of mods are stored in their own folders. Usually you won't have this and is only available for the particular mods' developer(s).
Mac: /Users/account/Library/Application Support/Terraria/ModLoader/Mod Sources
Linux: ~/.local/share/Terraria/ModLoader/Mod Sources OR $XDG_DATA_HOME/Terraria/ModLoader/Mod Sources
Windows: %UserProfile%\Documents\My Games\Terraria\ModLoader\Mod Sources
Linux: ~/.local/share/Terraria/ModLoader/Mod Sources OR $XDG_DATA_HOME/Terraria/ModLoader/Mod Sources
Windows: %UserProfile%\Documents\My Games\Terraria\ModLoader\Mod Sources
Default tModLoader 'mods' folder
Here, .tmod and .enabled files are stored. These files literally store the contents of a mod and if the mod is enabled in-game.
Mac: /Users/account/Library/Application Support/Terraria/ModLoader/Mods
Linux: ~/.local/share/Terraria/ModLoader/Mods OR $XDG_DATA_HOME/Terraria/ModLoader/Mods
Windows: %UserProfile%\Documents\My Games\Terraria\ModLoader\Mods
Linux: ~/.local/share/Terraria/ModLoader/Mods OR $XDG_DATA_HOME/Terraria/ModLoader/Mods
Windows: %UserProfile%\Documents\My Games\Terraria\ModLoader\Mods
Back to top
Remember you should ALWAYS show us the error(s) you've received when asking for help. Without showing us errors or code, we literally cannot help you with your troubles. For actual How-To's/Guides, visit my next post in this thread.
"Why did I lose all my characters and worlds upon installation of tModLoader?"
"How do I make characters and worlds for tModLoader?"
tModLoader uses its own folders for storing worlds and characters. This makes sure your vanilla files are nicely seperated from tModLoader modded files. tModLoader worlds aren't compatible with vanilla anyway, vanilla worlds are compatible with tModLoader though. Navigate to the main Terraria documents path, which you can find above, and copy your vanilla world files and character files into the ModLoader/Worlds and ModLoader/Players paths.
"Can I copy my old json code to work with tModLoader?"
No, as of yet json is not supported and tModLoader solely uses c#.
"What is the autoload property in tModLoader?"
The autoload property, found in the SetModInfo() method, is a property which will automatically load your mods' files. If you do not set AutoLoad to true you'll need to load your files manually in the Load() method.
"How do I even install tModLoader?"
tModLoader comes packaged in a .zip file, which you can unzip using an unzipper such as WinRAR. All you need to do is navigate to the default Terraria location, which you can find above, make a backup of your origional files and copy the contents of the .zip file. Let the files overwrite when asked.
"How can I revert to vanilla Terraria?"
You should've made a backup of all files you had to replace when installing tModLoader. These include, but are not limited to: FNA.dll, MP3Sharp.dll, Terraria.exe
If you have, restore these files. If you haven't, you can delete these files and have Steam verify the integrity of game cache. (this'll redownload the vanilla files)
You should now have vanilla Terraria again.
"Which text-editor or IDE should I use?"
I've created a special section below for text-editors and IDE choices.
"Why are people reporting my mod doesn't work in multiplayer?"
This is likely due to your mod having some code that isn't optimized for multiplayer. This can be quite a difficult thing to do.
In case your users get errors, have them post them to your thread as well as the tML thread.
(please keep in mind tML is WIP, so MP is WIP too!)
"What is all the fuzz about converting to tile positions?"
A nice clear explanation by @Eldrazi:
A Vector2 is basically a variable that holds two floats (X and Y) and is therefore mainly used as a position indicator (you also have Vector3, which will allow positions in 3 dimensions).
And it is possible to check a tile at a certain x,y coordinate. You'll want to watch out for world coordinates, though (player.position, npc.position, projectile.position, etc), since you'll want to recalculate those to 'tile coordinates'. You can do this by dividing the X and Y values of the coordinate by 16 (which is the tile size in pixels in Terraria). After that, you can call 'Main.tile[x, y]' to get the tile at the given coordinates (example using an NPC):
Code:int x = (int)(npc.position.X / 16); // Getting the X axis as a 'tile coordinate'. int y = (int)(npc.position.Y / 16); // Getting the Y axis as a 'tile coordinate'. // Now you've got your tile (using Main.tile[x, y]), do with it what you want.
"How can I create X thing? (your own item, npc, projectile etc.)"
Before you ask any questions, you should take a close look at the ExampleMod first. This mod contains almost everything that's possible, but of course the possibilities aren't limited to this mod's contents. Remember that you should create your files using the c# (c-sharp) language.
"Why can't I build / rebuild mods on Mac/Linux?"
If you want to build mods on mac/linux, you'll need to compile the dll file outside of tModLoader, then set precompile to true in build.txt
"Why are chests suddenly missing items?"
This should be fixed by now.
"How does the 'velocity' system work in Terraria?"
Go below to the 'Snippets' part, and look for a snippet on this subject.
Back to top
Text-Editors and IDEs
Are you having trouble choosing your text-editor and/or IDE? Look no further!
I also have a tutorial on how to setup your mod in Microsoft Visual Studio!
Text-editors
- Sublime text
- A text editor with support for add-ons/plugins and extensible keymaps.
- http://www.sublimetext.com/
- Notepad
- Major improvement to the regular notepad. Has features such as syntax highlighting, printing and mass replacement (with regex support)
- http://notepad-plus-plus.org/
- Major improvement to the regular notepad. Has features such as syntax highlighting, printing and mass replacement (with regex support)
- Vim
- Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X.
- http://www.vim.org/
- Atom
- Atom is a text editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file. Created by Github.
- https://atom.io/
- Atom is a text editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file. Created by Github.
- Brackets
- With focused visual tools and preprocessor support, Brackets is a modern text editor that makes it easy to design in the browser. It's crafted from the ground up for web designers and front-end developers. So, this editor is mostly for web developers, but could still be used for modding too if you like it enough.
- http://brackets.io/
- With focused visual tools and preprocessor support, Brackets is a modern text editor that makes it easy to design in the browser. It's crafted from the ground up for web designers and front-end developers. So, this editor is mostly for web developers, but could still be used for modding too if you like it enough.
- Visual Studio Code
- Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Made by Microsoft. This editor is like a light-weight version of Visual Studio: you can even debug your code with it!
- https://code.visualstudio.com/
- Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Made by Microsoft. This editor is like a light-weight version of Visual Studio: you can even debug your code with it!
IDEs (Integraded Development Environment)
Visual Studio: https://www.visualstudio.com
Tutorial on setting up Visual Studio: http://forums.terraria.org/index.ph...et-up-your-mod-using-visual-studio-mvs.26476/
Back to top
tModLoader developers: @blushiemagic, @jopojelly, @Chicken Bones, and I (@Jofairden)
Set up your tModLoader mod in MVS: (C# tutorials at the bottom) http://forums.terraria.org/index.ph...et-up-your-mod-using-visual-studio-mvs.26476/
Of course, thanks Re-Logic for creating Terraria, and thanks @blushiemagic for creating tModLoader.
Thanks so much @Yoraiz0r for supporting us in every way possible by being part of our community, actively hanging out and donating through our patreonage.
Useful sites, guides, tutorials.. and so forth
Sites
Guides/Tutorials
Most guides can be found on our github wikipedia
- Projectile Guide and Implementation (by @Sin Costan)
- How-to reinstall tModLoader
- Custom Bosses - NPC AI and Server Syncing (by @blushiemagic) (note: this tutorial was written for tAPI)
- Creating Simple UI: Custom Resource Bars (by @Subaro)
- Tutorial [1]: Getting started with tModLoader! (by @Jofairden)
- Go here if you are new to tML!
- Mod Skeleton Generator (by @jopojelly)
- Item name updater (SetDefaults to SetStaticDefaults) (for migration to 0.10)
- Official mod migration guide to 0.10
- Terraria c# crash course
- Quick c# structure guide
- NBTExplorer
- This can be used to visualize and verify ModPlayer/ModWorld saves
- "I have a problem with tModLoader" solution graph
Some popular mods have their own wikis. Use the links below to find information about them:
- Calamity Mod Wiki
- Exodus Mod Wiki
- Fargo's Mod Wiki
- GRealm Wiki
- Sacred Tools Wiki
- Spirit Mod Wiki
- Thorium Mod Wiki
- Tremor Mod Wiki
Back to top
Last edited: