Terraria how to create mod
Terraria how to create mod
Terraria → Файлы
Terraria — приключенческая песочница с элементами платформера и видом сбоку. Вам предстоит отправиться в красочный мир, где вы сможете. Подробнее
Это инструмент для создания простых модов в считанные минуты.
Использование:
1. сначала вам нужно будет создать скелет для вашего мода на этом сайте: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html
При открытии исполняемого файла вы увидите кнопку выбора рабочего каталога — это каталог, в котором расположены файлы build.txt и т. д. Теперь вы можете легко редактировать и заполнять все необходимые поля. Когда вы закончите вносить информацию, вам нужно обновить и проверить, все ли правильно — если это так, вы можете нажать кнопку, чтобы создать свой файл. Вам не нужно беспокоиться о том, куда закинуть файлы, все расположено правильно, и должно работать нормально.
2. Теперь вам нужно переместить всю папку Mod в эту папку:
C: / Users / Ваше имя пользователя / Documents / Мои игры / Terraria / ModLoader / Mod Sources
Папка может еще не существовать, если это так, просто создайте ее. Теперь вы можете открыть TerrariaModLoader и заметить новый пункт меню: нажмите «Mod Sources», и в этой папке должен быть ваш мод! Нажмите на кнопку: Build and Refresh, и ваш мод заработает!
tModLoader Tutorial: [1] Getting started with tModLoader
Jofairden
Duke Fishron
ExampleMod is a mod that contains various code to ‘showcase’ what tModLoader is capable of. Please note that most of these are very blunt examples, they should be considered a base reference but nothing more.
There’s also the old tAPI docs, but they’re practically useless at this point.
Now, let’s get to it already. Please note I like to write out things, a lot. If you’re not about text, it might be better to watch a video guide instead.
I’m coming with tAPI/tConfig experience, what do I need to know?
Honestly, probably not much. tModLoader can be quite different in a lot of ways. Certain things are definitely similar though, such as things like ModItem, ModBuff etc. One thing you should know is that tML does not use JSON files (as handled previously) Furthermore, most communication is handled through our Discord server and Yorai/Skiphs are available there as well for more intermediate questions.
To get started, you’re going to need a so called: ‘mod skeleton’ These are simply the base files you will need to get started. It is recommended to use jopo’s ‘mod skeleton generator’ which does most work for you, so let’s go ahaid and do that.
The generator is located here: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html
You will be greeted by a few textboxes, fill these in and hit the generate button. It is common to end your mod name with ‘Mod’ so for example if I’m considering «Jofairden’s Mod» I should name it «JofairdensMod», you should delete all special characters.
Noteworthy: you should never use whitespaces for most of this stuff (as these are internal names), either don’t use spaces at all or use hyphens. E.g. My Super Sword becomes MySuperSword or My_Super_Sword. The latter is considered ugly by most developers, so going with the former is your safest bet and the most common convention in mods. Also note that if you have installed Terraria in a different location (not in C:\ for example), the reference to Terraria.exe will be broken and you’ll need to add it manually.
Your file should look something like this:
This is your ‘Mod’ class, notice how it derives from the ‘Mod’ class which lies within tML. Your mod project should have only one ‘Mod’ class.
More information about class inheritance and derived classes can be found here. In general, deriving from ‘Mod’ allows tML to pick up on your mod, and allows you (`the modder`) to access various methods to work with. (these are often called ‘hooks’) You will later notice that almost all of your classes for your mod will derive from some class that lies within tML.
Your mod skeleton has only one method, in this case it’s actually not really a method (but it certainly looks like one)
The method you see is actually your class constructor, it is called when a new instance of your class is created. In this case, we can change various properties of our mod in it, which will then be set when tML creates a new instance of your mod. More information about class constructors can be found here. In the generated skeleton, various ‘Autoload’ properties are set to true. It is recommended to keep Autoloading on, as it saves you from writing a lot of unnecessary code.
Next, we’re going to look at another file in your mod’s root directory: build.txt
The build.txt file
The description.txt file
This file is also pretty self explanatory. The information in this file will be used when you publish your mod to the mod browser.
Let’s continue: our first item
You can open the sword file the same way you did for your mod file. You will notice, there’s quite a bit more code to this than our skeleton mod class. Your code should look similar to the following:
Notice that there are 3 methods going on. Let’s go over them and see what they do.
Just recently, SetDefaults got separated with SetStaticDefaults, and this new method was introduced together with language support for mods. Most ‘static’ stuff (that is not directly tied to the item object) will go in this method, such as setting the displayed name and tooltip(s). In my example, I want my sword to show as «Jofairden’s Sword» and not as «JofairdensSword», so let’s go ahaid and change that:
Next, we will look at the ‘regular’ SetDefaults() method. Here we can set various properties related to the item object, such as the damage and knockback. You can change these properties to your liking, and there are more properties available than you will see in the generated skeleton. This is the part where you’ll want to have Visual Studio, as it contains ‘Intellisense’ which will show you all the properties available on the item object.
For my sword, I’m going to define custom behaviour, so let’s set the damage to 1 and the knockback to nothing for the sake of exampleness:
To remove the knockback, I can set it to 0, but I can also simply omit the line of setting it, as the default knockback is always 0.
Notice that the knockback is a float and not an integer, meaning floating numbers are possible, such as 6.5f knockback. Also notice how the type is denoted by appending the ‘f’ after the number, e.g: item.knockback = 6.5f (also note that simply noting 6.5 will result in an error, as this is a double and not a float (which can also be denoted by appending a ‘d’ after the number))
It is very important that you understand the various different built-in data types in c-sharp, more information on this is available here.
The last method is AddRecipes(), in which we can create new recipes for our sword. Of course, we could create any kind of recipe we want here. But restraining the recipes created to the actual item itself is good in terms of code organization. The generated code should look something like this:
This code creates a new ModRecipe object, with our mod as the source of the recipe. Note that ‘mod’ (in new ModRecipe(mod)) is simply a mod object (of our mod) available in the current scope. Not all times is this object available, more on this in the tips section.
Next, we add ‘DirtBlock’ (a block of dirt) as a required ingredient, with the requirement of having at least 10 (`ten`). Note that the value passed here for the item is an integer, an item type or `ID` if you will. Almost all vanilla item types can be found in the Terraria.ID.ItemID namespace. Since the Terraria.ID namespace is included at the top of our file, we can simply call the ItemID class as shown. There are various ways to require modded items as an ingredient, more on this at a later stage.
Next, we add ‘WorkBenches’ as a required tile. This means the player will need to stand at any workbench for the recipe to be available. This TileID class comes from the same namespace as `ItemID`, so from the Terraria.ID namespace.
Next, we set the result to ‘this’, which is a reference to our current class, our ‘ModItem’ in this case. At the end, we call the method AddRecipe() on the ModRecipe object to add the recipe to the game. Note that if you want to create another recipe for the sword (say, with some other ingredients), you can reuse the same object and simply construct a new ModRecipe instance:
More on recipes in a later tutorial.
Right now you have the barebones set up for your mod. If you go in-game and try to build the mod, it should work.
Right under the mod’s name, it’ll either say ‘Disabled’ or ‘Enabled. Disabled mods will not be part of your Terraria.
If you want to enable a mod, either click ‘Click to enable’ or click ‘Enable All’.
Make sure to click ‘Reload mods’ when you’ve changed enabled/disabled statuses.
The ‘More info’ button shows an information tab about the mod.
‘Mod Sources’ refers to your ‘Mod Sources ‘ folder in your documents. This is where all your source files for your mods are located, which for me would be ‘JofairdensMod’. In this menu you see several buttons, showcased in the following image.
tModLoader/tModLoader
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
60 errors, + evil cleanups. *
60 errors, + evil cleanups. *
README.md
tModLoader, a Terraria modding API
tModLoader (TML) is an open-source, community-driven, modification and expansion of the Terraria game that makes it possible to make and play mods. TML expands your Terraria adventures with new content to explore created by the Terraria community! TML allows players to create and play Terraria mods and is designed in such a way so that you can play alone or together with friends, with one mod or with multiple mods: choose to play however you like! It is however required that all your friends also install TML if you want to play together; vanilla users can’t play with TML users. Find the instructions below to learn how to install TML.
Note: the code on this GitHub repository will be ahead of the current released version.
Want to play or create mods? Or do you want to contribute to tModLoader perhaps? Click the text that applies to you.
First and foremost, TML is largely a community endeavor: built by the community; used by the community. Without all the contributions people in the community have made over the years, TML would not be in the state it is in. TML is a free-to-use modification of the game and will stay that way. However, if you would like to buy us a coffee, or maybe even multiple, you can choose to pledge some money to support us financially. We’d like to kindly express once again that TML was not created to create a profit. All of the core team members continue their best efforts to improve and maintain TML despite their real-life obligations, free of charge or any request from the community.
The preferred method of supporting the core team is by choosing a pledge through Patreon. All of the money donated this way is equally shared amongst the core members to those who wish to receive part of it. This truly is the right way to support us financially if you want to do so. By becoming a patron you can receive a special role on our Discord server if desired. You should be able to couple your Discord account to your Patreon account and automatically receive your role.
If you do not want to use a Patreon subscription, you should contact one of the core team members through the Discord server to find an appropriate method of supporting us. Thanks again!
If you would like to contact us or TML users, it’s best to join our Discord server. To use Discord you will need to register a new account on their website.
TML is largely created and maintained by a core team of contributors: Blushiemagic, Chicken-Bones, Jopojelly, Jofairden, Mirsario and Solxanich
This project exists in its current state thanks to all the people who have contributed:
TML is licensed under the MIT license
About
A mod to make and play Terraria mods. Supports Terraria 1.4 (and earlier) installations
Terraria how to create mod
6,937 | уникальных посетителей |
146 | добавили в избранное |
also im terrible at spelling so deal with it, and this is for PC, idk how to mac sorry.
now on to the guide!:
Firstly!: create a new folder on the desktop (or wherever you would like, and can access easily) name it what you like (i name mine terrariaSTUFF lol)
ill refer to this as your ‘resources’ folder were gonna put stuff in it
here are the two folders:
you now have your resources folder with two shortcuts, this will make life much easier, we will add a few more things to it soon.
i also keep my player and world backups in this folder(a practice every hard-core player should get used to), and since i create mods and use lots of other tools, its very useful to have everything i need in one place.
alrighty! feel the cleansing power of organization wash over you as we get ready for the next step in our journey
here is a link to the tmodloader files on the official terraria forum:
scroll down to the DOWNLOADS section and click on the steam version (windows obviously)
warning: if you dont know how to unzip files ill just say you have no buisiness modding, but, google it.
now open your new TMODLOADER folder and change the name of the terraria.exe file (i use terrariaMOD.exe so ill be calling it that, but you could name it tmodloader.exe or whatever you want)
i know this seems like a lot but you are 90% done!! and these steps make everything easier in the end
now all you do is simply copy the contents of the tmodloader folder (not the folder itself, all the files inside) and paste them in your GAME folder!! youve just installed tmodloader!
make a shortcut to your newly installed TerrariaMOD.exe (from within the GAME folder NOT the Tmodloader folder), and place in your resources folder (or desktop, or both). this will be how you launch modded terraria. if you run the game via steam, or the regular terraria.exe in your GAME folder, you will be running vanilla, you can make a shortcut to this as well, for playing with unmodded friends etc. you could even run them at the same time if youre feelin crazy
one last step: when you run the modded game for the first time, exit at the main menu before opening any menus, to finalize set-up. after that you can run the game again and start dowloading mods! ill get to that next section. this also creates the ‘ModLoader’ folder inside your ‘GAME folder’
A MAJOR note: as i mentioned in the first step, modded characters and worlds are saved sepparately, this means when you first run modded terraria you will have no worlds or characters. i thought it deleted everything my first time!! (although the thorium and termor mods are so cool i literally didnt care, plus im a pro so i had some backups 🙂
however, if you want to use your vanilla characters you can simply access your player folder within the FILES folder shortcut and copy and paste the characters or worlds you want into your modded FILES folder (always copy paste never click and drag!!) i dont suggest doing it the other way around lol
eyyyy! so i heard you like mods.
when accessing the mod browser, your game will likely freeze, dont make the nooby mistake of clicking and trying to unfreeze it and making it crash and spazzing out and posting on forums. just let it do its thing, its a lot of info to load. if windows asks, tell it to wait for the program to respond, it will.
check out the mod the list and download what you want! there are filter buttons to organize them better.
after downloading or updating a mod, you will have to go to the ‘mods’ menu and activate it, then ‘reload’ all mods (its all very easy if you follow on screen directions) all mods are inactive until activated. you dont have to activate mods you have downloaded you can have a mix of active/inactive.
some other things to note:
90+% of the mods work perfectly well in singleplayer, but not all mods are balanced very well, and even less work well in multiplayer. some mods will conflict with each other, but usually only when they affect the same game mechanic. this is rare-ish as most mods simply add content and thus are highly compatible.
id suggest researching mods beyond the info in the mod browser (click ‘view mods website’, it links to official terraria forums, if it doesnt have that button its very likely going to be a bad mod, check the comments, downloads, etc.)
another way to get mods is to simply join a friend who has them! one of the beautiful things about tmodloader is when joining a friend you download and activate the same mods automatically. keep in mind a lot of players like to use a ton of mods, and ones that suck, so make sure you are careful. few mods work well in multiplayer, thorium and tremor are the best for this, having more than 4-5 mods is surely asking for lag. (however in singleplayer, load it up!!)
another note, you may find yourself with undesireable mods, the only way to remove them is to physically delete the files, located in a folder simply called ‘mods’ in the modded FILES folder
i bet you think youre like, a modding master now right?
well, updates are a little tricky
for example, terraria is currently at v 1.3.3.2
lets say it updated to 1.4 tomorrow (lol i wish)
you can still run modded, but stuck in 1.3.3.2 with no new content.
now you lurk on the tmodloader forum page like everyone else, waiting for the update. generally best to wait for official game patches like 1.4.0.1 etc, first, as tmodloader devs probably will too.
just dont be one of those many obnoxious people that spams the forum asking when it will be updated.
also, mods can be updated, there are filter buttons in the mod browser that allow you to show only your downloaded mods that have updates. sometimes, a mod may take forever to update, i would cancle and exit the game and relaunch. sometimes that helps
also keep in mind, when tmodloader updates, some mods have to update too, and some wont be able to right away so they might not work. the good mods are always updated within a few days tho, and some dont have to, so not to worry. just be patient
anyhoo! that should be it! i hope this makes it simple for people to play with the amazing mods out there. i wouldnt promote it if it wasnt truly worth exploring!
may the slimes be ever in your favor, for the night is dark, and full of flying eyeballs.
tAPI Getting Started with Modding
berberborscing
Skeletron Prime
Do none of the mods the Terraria community has to offer interest you? Do you have a lot of ideas that others don’t?
Do you wish to indulge into the world of modding? If you’re here, then I suppose so!
There are set guidelines for these mods however. Make sure to follow them!
-If a sprite for an item is not yours, make sure you have permission from the sprite creator and give him credit. The credit is worthless without the permission!
-Making unobtainable items obtainable is against the rules: This includes items removed from the game such as the Zapinator, developer items, and currently existing items that are unobtainable (Such as the Gravity Globe and the SDMG)
-Try not to make your weapons unbalanced on purpose. Balancing is good and prevents your item from being useless / overused for it’s sheer (lack of) power.
-Obviously nothing offensive and vulgar.
-It’s OK if you have a ridiculously powerful weapon in your mod, as long as it isn’t ridiculously easy to obtain. For example, crafting a machine gun that shoots so fast it could crash the game, being crafted with a single block of dirt. Unless your mod is the overpowered weapons mod, in which that case, go right ahead.
After you finish downloading Terraria, it’s time to find a place to put your mod. Find your workspace in \Documents\My Games\Terraria\tAPI\Mods\Sources.
Make a new folder, and the folder’s name will be the name of your mod.