tModLoader Official tModLoader Help Thread

Snippet is no longer the main priority, but Help/FAQ and Guides/How-to's is!
This mean I'll now focus on adding more help/tutorials/how-to's/guides to this thread rather than trying to release Snippet asap.

Small update: (09-08-2015)
Not a lot of time today ;(
  • Added TileID for Anvils and Workbenches to FAQ
  • Added guide to using Terraria.ID
I've added small info on Anvils and WorkBenches to the FAQ.
What is the id for anvils / workbenches / furnaces and how to use it?
Also there's now a small guide on Terraria.ID (second post), also tells you which classes you can then use.
Guide: How to use and uses of Terraria.ID

I have also updated the Snippet section, no more download as both Snippet and BaseMod were outdated. The Examples section and Docs section have been updated.
 
As I'm trying to make a basic mod, I'm building it and it's showing an error for "SoulsOfFlight". Is there a page I can be taken to that has the Item names that I'd use? (For the ones already in game)
 
As I'm trying to make a basic mod, I'm building it and it's showing an error for "SoulsOfFlight". Is there a page I can be taken to that has the Item names that I'd use? (For the ones already in game)
You'll need to post the whole error otherwise I don't know what's going wrong. To access all item id's it's best if you check out my second post in this thread on how to use Terraria.ID it contains all vanilla id's.
 
3F14xjT.png

I did use the "ItemID" command. Would it work if I changed it to it's internal ID rather than it's name?
 
Thank you! :)
EDIT: Ran "SoulOfFlight" through the mod. Brought up same error. Should I try the internal ID?
This is the full definition:
Terraria.ID.ItemID.SoulofFlight
If you have 'using Terraria.ID' then the following should work
ItemID.SoulofFlight

Remember C# is capital sensitive, I don't know what you mean with internal id.
[DOUBLEPOST=1439404578,1439404481][/DOUBLEPOST]I highly recommend you to use MVS as it will make your life a lot easier because of Intellisense, which will basically give you any errors and shows you what you can use. A link to a tutorial for that is in OP.
 
This is the full definition:
Terraria.ID.ItemID.SoulofFlight
If you have 'using Terraria.ID' then the following should work
ItemID.SoulofFlight

Remember C# is capital sensitive, I don't know what you mean with internal id.
Thanks. Also, Internal ID is the code for each item. Like the base number, for example "Anvil" is 16.
 
Thanks. Also, Internal ID is the code for each item. Like the base number, for example "Anvil" is 16.
That's exactly what this is. It's just the 'type' of object. By the way, 16 is not just 'Anvil'. 16 is a collection of Tiles, such as a regular Anvil and Mythril Anvil. Same goes for ItemID.Furnaces
 
Alright I've updated docs, damn that's a lot of work. I'm not sure how I'm going to put in examples for Snippet, for now just ask me!
 
Hello there. I've tried to create my own weapon but encountered an error when i tried to build the mod.

Missing texture Eclipse/Items/Arkhalis
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

The problem is i can't find where i have to set this up so it can load the texture
 
Hello there. I've tried to create my own weapon but encountered an error when i tried to build the mod.

Missing texture Eclipse/Items/Arkhalis
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

The problem is i can't find where i have to set this up so it can load the texture

If you have AutoLoad enabled then the texture should be in the same folder with the same name
Otherwise you can override the texture path if you for example store it elsewhere
Code:
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
    texture = "Eclipse/Items/Textures"; // This is an example
    return true;
}
 
If you have AutoLoad enabled then the texture should be in the same folder with the same name
Otherwise you can override the texture path if you for example store it elsewhere
Code:
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
    texture = "Eclipse/Items/Textures"; // This is an example
    return true;
}

Autoload is indeed set on true.
Maybe i'll put in here what my source looks like. I used an other mod as help for this since i am a total newbie to modding for terraria.

So I have my Folder named Hardmode Arkhalis and in there are 2 files and a folder. The files are named build and Hardmode Arkhalis.cs

Hardmode Arkhalis.cs looks like this


using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace HardmodeArkhalis {
public class HardmodeArkhalis : Mod
{
public override void SetModInfo(out string name, ref ModProperties properties)
{
name = "HardmodeArkhalis";
properties.Autoload = true;
}

public override void Load()
{

}
}}

In the folder which is named Items are three files
The Eclipse.cs as well as two files name Arkhalis.png and Eclipse.png (i guess that these are the sprites used when you use the sword)
 
But what exactly is your problem here? If you have a class overriding the ModItem class then the png file should be named what that class is named. So if you have HardmodeArkhalis : ModItem then you should also have HardmodeArkhalis.png
[DOUBLEPOST=1439470398,1439470350][/DOUBLEPOST]By the way it is best to not use any spaces in filenames
 
Okay so ... Now I have Eclipse.png and Eclipse : ModItem and it build the mod and reload worked too <O> ... but now i can't actually craft the item.

SO i have it set up like this in Eclipse.cs is there anything wrong?

using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Eclipse.Items {
public class Eclipse : ModItem
{
public override void SetDefaults()
{
item.name = "Eclipse";
item.toolTip = "A sword imbued with enormous Power";
item.knockBack = 1;
item.damage = 49;
item.magic = false;
item.mana = 0;
item.useSound = 9;
item.useAnimation = 30;
item.useTime = 16;
item.useStyle = 5;
item.width = 34;
item.height = 38;
item.maxStack = 1;
item.value = 100;
item.rare = 7;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Arkhalis, 1);
recipe.AddIngredient(ItemID.TitaniumBar, 6);
recipe.AddIngredient(ItemID.Sapphire, 12);
recipe.AddTile(16);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}}
 
I don't see anything wrong other than a few things you could let out.
Try removing all the recipe ingredients and replace it for 1 dirt block and see if it works in game.
You can remove item.mana and item.maxStack since they are 0 and 1 by default.
You can remove 1 at AddIngredient for Arkhalis and SetResult since they're 1 by default.
Also for AddTile you could do TileID.Anvils since that's type 16, but whatever you prefer.
Also I notice you set item.magic to false but you don't define any other type of damage.
You can set it to item.thrown, item.magic, item.melee, item.summon or item.ranged
Either of those needs to be true otherwise the item doesn't have any type of damage
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Eclipse.Items {
    public class Eclipse : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Eclipse";
            item.toolTip = "A sword imbued with enormous Power";
            item.knockBack = 1;
            item.damage = 49;
            item.magic = false;
            item.melee = true; // Now it deals melee damage
            item.useSound = 9;
            item.useAnimation = 30;
            item.useTime = 16;
            item.useStyle = 5;
            item.width = 34;
            item.height = 38;
            item.value = 100;
            item.rare = 7;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Arkhalis);
            recipe.AddIngredient(ItemID.TitaniumBar, 6);
            recipe.AddIngredient(ItemID.Sapphire, 12);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Are you using Snippet by the way? In that case you could use QuickRecipe in AddRecipes
add 'using Snippet.Recipes' at the top of your file
This does the same as your AddRecipes above:
Code:
        public override void AddRecipes()
        {
            Recipes.QuickRecipe(mod, this, 1, new int[] { ItemID.Arkhalis, ItemID.TitaniumBar, ItemID.Sapphire }, new int[] { 1, 6, 12 }, TileID.Anvils);
        }
 
Thanks a lot for the tipps. And yeah i thought about that too but before going further into the stats and such i wanted to test if i can get the weapon to actually work.
To your question about snippet, no i am not using this yet. And i've tried it with the Dirt block but it's still not craftable <0> .... i tried every anvil type that excists and it's nowhere listed Dx
 
Thanks a lot for the tipps. And yeah i thought about that too but before going further into the stats and such i wanted to test if i can get the weapon to actually work.
To your question about snippet, no i am not using this yet. And i've tried it with the Dirt block but it's still not craftable <0> .... i tried every anvil type that excists and it's nowhere listed Dx
You are sure you have built & loaded the mod right? It is enabled? Because your code is fine and it should work.
 
Yep 100% sure i clicked on mods have it enabled reloaded i got into the mod source menu build+ reload there too it doesn't show up <O>
 
Back
Top Bottom