FANDOM


Difficulty: Difficulty-2
Clock: N/A


Under Contruction

Under Construction
This page has been marked as under construction, which means information may change rapidly as it updated, or that the page is awaiting updates.


Introduction Edit

This guide doesn't deal directly with modding, but is more general advice on how to work with tConfig, and how to find information in the code and on the wiki yourself.

Requirements Edit

  • While it's not required, having the decompiled code from the patched tConfig .exe is very helpful as it lets you see all the classes and code from the modded game.
  • The same goes for the default .ini files

How to Find an Item's Type Edit

It is useful to figure out what an item's type is, because then you can make items replicate its effects or use a similar graphic. It also lets you know what to look for in the source code if you wanted to see how it works.

By Name Edit

  • In the default .ini files, open the item folder
  • Locate the item's .ini and open the file
  • Find the "type=" attribute


By Graphic Edit

  • Using the default game graphics, find "item_n.png"


This is the process for how the various lists were compiled, only done more exhaustively. The same process goes for gore, and NPCS. For tiles, you have to do the reverse: check by graphics, then filename, because the file names are rather cryptic for example: "1.ini", "5.ini", and so on.

How to find a Projectile's type Edit

Projectiles are a special case as well, because there isn't a perfect 1:1 ratio of items to projectiles. Some are even spawned by NPCs. To find the type for a projectile, there are a few different methods.

By Name Edit

  • If you know the projectile name, open the default .ini files
  • Find the projectile.ini file and open it
  • Locate the "type=" attribute


By Graphic Edit

  • Using the default graphics, look through the projectile image files until you find the appropriate graphic. Projectiles can be tricky, and it may not be apparent what graphic it is using.
  • The name should be something like "projectile_n.png". This will be the number of your projectile that you can refer to it.


By Item Edit

  • This only works for items that shoot, such as Aquatic Scepter, bows, and guns. It will not work for NPCs, since projectiles are spawned in their C# code, specifically, the AI.
  • Open the item's .ini file and find the line that says "projectile=".
  • This will be the type of the projectile.


Again, you can refer to the different lists for reference, but if the wiki isn't available for some reason, this allows you to still get the same information.

How to find a custom types Edit

Custom items are loaded from the .ini files you create in your compiled mod. However, these are loaded after the normal items, and at that point, exist purely in running code. So how do you know what the type of your item is?

If you decompiled tConfig and looked at the different classes, you would see Config.cs and a number of classes such as ItemHandler.cs and ProjectileHandler.cs. These classes contain dictionaries you can refer to, such as "byName", which you give it a string and it returns an integer - your custom item's ID.


Gore Edit

int goreID = Config.goreID["goreName"];

Items Edit

int itemID = Config.itemDefs.byName["Item Name"].type;

Projectiles Edit

int projID = Config.projDefs.byName["Projectile Name"].type;

NPCs Edit

int npcID = Config.npcDefs.byName["NPC Name"].type;

Buffs Edit

int buffID = Config.buffID["Buff Name"];

Tiles Edit

int tileID = Config.tileDefs.ID["Tile Name"];


How to find the original code for _________ Edit

It is commonly asked how to find the original code for X item or what exactly does Y attribute really do. Well, it's all written in the code somewhere. The trick is finding it. This is a method to search all of the decompiled code for tConfig (or the default ini files or just about anything else that's text based) using cmd.exe on Windows operating systems and DOS commands.

The result is a file that contains a list of all appearances of a search word in each file with line numbers for easy reference. A competing alternative is using a search function on each file individually.

Opening CMD.exe and preparing for search Edit

The most universal method for finding / opening CMD.exe is using the Run command from the start menu. The appearance and positioning of Run varies but it is usually visible somewhere after clicking START in the bottom corner. Once you click on Run, just type in

cmd

and click OK. A black box with white text should pop up.

You will also need to make a blank *.txt document. It does not matter where it is or how it's named. You can just right click the desktop and create a New > Text Document if you like.

CMD input Edit

You will now need to type a long line into the CMD program (that black box). The words written in FULL CAPS will be things you change to match your search. Everything else, including quotation marks, must be typed as shown below:

for /r "TCONFIG CODE FOLDER PATH" %i in (*.*) do find /n /i "SEARCH WORD" "%i" >> "EMPTY TEXT DOCUMENT PATH"

TCONFIG CODE FOLDER PATH will be the path on your computer that contains all of decompiled tConfig files (or whatever folder you want to search through). Instead of typing this in, you can grab that folder and drag right onto the black box and CMD.exe will type in the folder path for you, complete with quotation marks if required.

SEARCH WORD will be the word that you're searching for. If you want to see what the isWet property does then your SEARCH WORD is isWet.

EMPTY TEXT DOCUMENT PATH will be the file path to the empty text document that you made. Once again, you don't have to type this in; you can drag the empty text document onto the black box and it will type it in for you.

For DOS Command Example Input

Output Edit

Once you type in your line and hit ENTER, you will see a bunch of text fly by. When it's all done, you can open the empty text document you made and find that it is full of information.

The lines that begin with a bunch of dashes are the files that it has searched through. There will be one of these lines for each file. If your SEARCH WORD was not found in that file, then it will be simply list the next file.

If your SEARCH WORD was found in the document then underneath the file name it will list every line where it was found. On the far left is a number in brackets. This is the line number where the word was found. The rest of the line is the everything in that line of code where your word was found.

For DOS Command Example Output

How to use this technique effectively Edit

Using the GoTo function Edit

Most text editing programs have a GoTo function. This will allow you to type in the line you wish to see and the program will bring you straight to that line. For most programs, this is under Edit > GoTo or simply Ctrl + G. Thus, when your text document lists the line with [7566], you can open that file, hit Ctrl + G, type in 7566, and be brought to that line.

Finding the properties of items, projectiles, NPCs, and other things Edit

When looking for the properties of things, you often want your search word to be similar to == ### with the number of the item / projectile / NPC type. Thus, if you want to find the code for a Fiery Greatsword, your SEARCH WORD would look like

== 121

This will be within quotation marks when you type it out in CMD.exe. Remember: a line that says

this.type == 121

in Item.cs is referring to a Fiery Greatsword but that same line in NPC.cs is referring to a Corrupted Slime since "this" means NPC in that file.

Finding out what attributes do Edit

If you want to know exactly what an attribute from the *.ini files do, just type that attribute in as your SEARCH WORD. Your output will all the lines of code where that attribute is used so you know where in the code to look.

Finding out what things have a certain attribute Edit

This works just as the above section does except that you will search through the default *.ini files provided by on this wikia. Just use the file path where you keep the defaults for TCONFIG CODE FOLDER PATH instead of the path for the decompiled code. This is a great way to make a list of all the items (or other things) that have a certain attribute.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.