tModLoader Official tModLoader Help Thread

help plz:redmunch:

Items/Armor/LightBringerChestplate_Body
at Terraria.ModLoader.Mod.GetTexture(String name)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.AddEquipTexture(EquipTexture equipTexture, ModItem item, EquipType type, String name, String texture, String armTexture, String femaleTexture)
at Terraria.ModLoader.Mod.AddEquipTexture(ModItem item, EquipType type, String name, String texture, String armTexture, String femaleTexture)
at Terraria.ModLoader.Mod.AutoloadItem(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
You don't have the animation texture for the body armor, at least not where is is looking. check the namespace, classname, spelling, etc.
 
You don't have the animation texture for the body armor, at least not where is is looking. check the namespace, classname, spelling, etc.

i fixed that but now i have this problem

Tiles/LightOreTile
at Terraria.ModLoader.Mod.GetTexture(String name)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
 
i fixed that but now i have this problem

Tiles/LightOreTile
at Terraria.ModLoader.Mod.GetTexture(String name)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
It's all the same error, you just got to check spelling and stuff.
 
hello me again with another question

i got tmod a couple of days ago I only had 1 mod and everything worked fine until my friend gets mods we want to mess around with some mods so I get some more and he does thing is when I join him it says lost connection when I try to host a world my game crashes and I was wondering why this was we both has tmod though we don't have the exact same mods would that be the reason I can play single player though

if you need it I could give the crash log and mods I have
 
It's all the same error, you just got to check spelling and stuff.

i need help again

error
c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerChestplate.cs(35,40) : error CS0118: 'ThePlusPack.Items.LightBar' is a 'type' but is used like a 'variable'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerChestplate.cs(35,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerChestplate.cs(35,40) : error CS1503: Argument 2: cannot convert from 'ThePlusPack.Items.LightBar' to 'string'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerLegs.cs(35,40) : error CS0118: 'ThePlusPack.Items.LightBar' is a 'type' but is used like a 'variable'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerLegs.cs(35,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerLegs.cs(35,40) : error CS1503: Argument 2: cannot convert from 'ThePlusPack.Items.LightBar' to 'string'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerMask.cs(41,40) : error CS0118: 'ThePlusPack.Items.LightBar' is a 'type' but is used like a 'variable'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerMask.cs(41,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerMask.cs(41,40) : error CS1503: Argument 2: cannot convert from 'ThePlusPack.Items.LightBar' to 'string'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Weapons\LightBringer.cs(36,34) : error CS0023: Operator '.' cannot be applied to operand of type '<null>'

coding
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ThePlusPack.Items
{
public class LightBar : ModItem
{
public override void SetDefaults()
{
item.name = "Light Bar";
item.width = 20;
item.height = 20;
item.maxStack = 99;
AddTooltip("THE BARS OF PHYSICAL LIGHT!!");
item.value = 100;
item.rare = 7;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Hellstone, 3);
recipe.AddIngredient(ItemID.Meteorite, 3);
recipe.AddTile(TileID.Furnaces);
recipe.SetResult(this, 1);
recipe.AddRecipe();
recipe = new ModRecipe(mod);
recipe.AddRecipeGroup("ExampleMod:ExampleItem");
recipe.SetResult(this, 1);
recipe.AddRecipe();
 
So with tModLoader is it possible to...

-Remove the starting copper items?
-Reduce the pickaxe power of a pickaxe?(Cactus Pickaxe)
-Change the range of an existing pickaxe?
-Change starting hearts?
 
i need help again

error
c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerChestplate.cs(35,40) : error CS0118: 'ThePlusPack.Items.LightBar' is a 'type' but is used like a 'variable'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerChestplate.cs(35,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerChestplate.cs(35,40) : error CS1503: Argument 2: cannot convert from 'ThePlusPack.Items.LightBar' to 'string'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerLegs.cs(35,40) : error CS0118: 'ThePlusPack.Items.LightBar' is a 'type' but is used like a 'variable'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerLegs.cs(35,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerLegs.cs(35,40) : error CS1503: Argument 2: cannot convert from 'ThePlusPack.Items.LightBar' to 'string'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerMask.cs(41,40) : error CS0118: 'ThePlusPack.Items.LightBar' is a 'type' but is used like a 'variable'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerMask.cs(41,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(Terraria.ModLoader.Mod, string, int)' has some invalid arguments

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Armor\LightBringerMask.cs(41,40) : error CS1503: Argument 2: cannot convert from 'ThePlusPack.Items.LightBar' to 'string'

c:\Users\thorn\Documents\My Games\Terraria\ModLoader\Mod Sources\ThePlusPack\Items\Weapons\LightBringer.cs(36,34) : error CS0023: Operator '.' cannot be applied to operand of type '<null>'

coding
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ThePlusPack.Items
{
public class LightBar : ModItem
{
public override void SetDefaults()
{
item.name = "Light Bar";
item.width = 20;
item.height = 20;
item.maxStack = 99;
AddTooltip("THE BARS OF PHYSICAL LIGHT!!");
item.value = 100;
item.rare = 7;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Hellstone, 3);
recipe.AddIngredient(ItemID.Meteorite, 3);
recipe.AddTile(TileID.Furnaces);
recipe.SetResult(this, 1);
recipe.AddRecipe();
recipe = new ModRecipe(mod);
recipe.AddRecipeGroup("ExampleMod:ExampleItem");
recipe.SetResult(this, 1);
recipe.AddRecipe();
I don't think any of the errors you listed are in the file you posted.
 
I tried making a custom recipe, but I got this error:

c:\Users\cntdr\Documents\My Games\Terraria\ModLoader\Mod Sources\MyCustomRecipes\MyCustomRecipes.cs(25,21) : error CS1518: Expected class, delegate, enum, interface, or struct

c:\Users\cntdr\Documents\My Games\Terraria\ModLoader\Mod Sources\MyCustomRecipes\MyCustomRecipes.cs(27,32) : error CS1518: Expected class, delegate, enum, interface, or struct

c:\Users\cntdr\Documents\My Games\Terraria\ModLoader\Mod Sources\MyCustomRecipes\MyCustomRecipes.cs(33,1) : error CS1022: Type or namespace definition, or end-of-file expected

This was my "MyCustomRecipes.cs" file:

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using MyCustomRecipes.Items;

namespace MyCustomRecipes
{
    public class MyCustomRecipes : Mod
    {
        public MyCustomRecipes()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }

    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(this);
        recipe.AddIngredient(ItemID.Dirt, 1);
        recipe.SetResult(ItemID.WrathPotion, 1);
        recipe.AddRecipe();
    }

}
 
I tried making a custom recipe, but I got this error:



This was my "MyCustomRecipes.cs" file:

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using MyCustomRecipes.Items;

namespace MyCustomRecipes
{
    public class MyCustomRecipes : Mod
    {
        public MyCustomRecipes()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }

    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(this);
        recipe.AddIngredient(ItemID.Dirt, 1);
        recipe.SetResult(ItemID.WrathPotion, 1);
        recipe.AddRecipe();
    }

}
You have that method there outside of the class it belongs to. Move that } down so that the method is in the class
 
Can someone help a total noob(me) in a problem?
What does this error code mean and how to fix it?
I'll show my code, which is pretty much copypasted from the example mod if it is needed
Code:
Failed to load C:\Users\Samu\Documents\My Games\Terraria\ModLoader\Mod Sources\Headband\build.txt
System.FormatException: Input string was not in a correct format.
   at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
   at System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent)
   at System.Version.TryParseVersion(String version, VersionResult& result)
   at System.Version.Parse(String input)
   at System.Version..ctor(String version)
   at Terraria.ModLoader.BuildProperties.ReadBuildFile(String modDir)
   at Terraria.ModLoader.ModCompile.ReadProperties(String modFolder, IBuildStatus status)
 
I tried making a custom recipe, but I got this error:



This was my "MyCustomRecipes.cs" file:

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using MyCustomRecipes.Items;

namespace MyCustomRecipes
{
    public class MyCustomRecipes : Mod
    {
        public MyCustomRecipes()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }

    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(this);
        recipe.AddIngredient(ItemID.Dirt, 1);
        recipe.SetResult(ItemID.WrathPotion, 1);
        recipe.AddRecipe();
    }

}
Okay I moved it so it's in the class. Now I'm getting this error:

c:\Users\cntdr\Documents\My Games\Terraria\ModLoader\Mod Sources\MyCustomRecipes\MyCustomRecipes.cs(8,24) : error CS0234: The type or namespace name 'Items' does not exist in the namespace 'MyCustomRecipes' (are you missing an assembly reference?)

EDIT: Nevermind, I discovered this isn't needed because I don't have custom items: using MyCustomRecipes.Items;

I also was using ItemID.Dirt when I should of used ItemID.DirtBlock
 
Last edited:
Okay I am going to need some expert assistance on this one, I am trying to give a weapon of mine a recoil knockback effect while keeping its shotgun burst, but I got this error and I am too much of a newb to figure it out.

Code:
c:\Users\Drew Welch\Documents\My Games\Terraria\ModLoader\Mod Sources\GmodTowerWeps\Items\Weapons\SuperShotty.cs(45,43) : warning CS0162: Unreachable code detected

c:\Users\Drew Welch\Documents\My Games\Terraria\ModLoader\Mod Sources\GmodTowerWeps\Items\Weapons\SuperShotty.cs(42,24) : error CS0161: 'GmodTowerWeps.Items.Weapons.SuperShotty.Shoot(Terraria.Player, ref Microsoft.Xna.Framework.Vector2, ref float, ref float, ref int, ref int, ref float)': not all code paths return a value

And heres the cs file for the weapon.

Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using GmodTowerWeps.Items;

namespace GmodTowerWeps.Items.Weapons
{
   public class SuperShotty : ModItem
   {
     public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
   {
     texture = "GmodTowerWeps/Items/Weapons/SuperShotty";
     return true;
   }
     public override void SetDefaults()
     {
       item.name = "Super Shotty";
       item.damage = 135;
       item.ranged = true;
       item.width = 40;
       item.height = 20;
       item.toolTip = "Fires a massive spread of bullets that causes recoil";
       item.toolTip2 = "Who needs legendary weapons when you have a shotgun?";
       item.useTime = 48;
       item.useAnimation = 48;
       item.useStyle = 5;
       item.noMelee = true;
       item.knockBack = 5;
       item.value = 12000000;
       item.rare = 9;
       item.useSound = 36;
       item.autoReuse = false;
       item.shoot = 10;
       item.shootSpeed = 16f;
       item.useAmmo = ProjectileID.Bullet;
       item.expert = true;
     }
     public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
     {
       int numberProjectiles = 30 + Main.rand.Next(5);
       for (int i = 0; i < numberProjectiles; i++)
       {
         Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(40));
         Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI);
       {
         if (player.direction > 0)
       {
       player.velocity.X -= 15f;
       return false;
       }
       if (player.direction < 0)
       {
       player.velocity.X += 15f;
  return false;
  }
  return false;
     }}}

     public override void AddRecipes()
     {
       ModRecipe recipe = new ModRecipe(mod);
       recipe.AddIngredient(ItemID.Shotgun, 1);
       recipe.AddIngredient(ItemID.IllegalGunParts, 1);
       recipe.AddIngredient(ItemID.LunarBar, 25);
       recipe.AddIngredient(ItemID.FragmentVortex, 35);
       recipe.AddIngredient(ItemID.GravityGlobe, 1);
       recipe.AddTile(TileID.LunarCraftingStation);
       recipe.SetResult(this);
       recipe.AddRecipe();
     }
   }
}
 
My issue:
2nd day of modding terraria i wanted to make a buff that works on NPC hit
I used the one everybody uses, it works.... on melee weapons.
When I use it on magic weapons the buff just doesn't appear.
Is it a new method that I need to use?
 
My issue:
2nd day of modding terraria i wanted to make a buff that works on NPC hit
I used the one everybody uses, it works.... on melee weapons.
When I use it on magic weapons the buff just doesn't appear.
Is it a new method that I need to use?
I'm guessing you're shooting a projectile with your magic item? If so, you want to apply the (de)buff via the projectile you shoot, not the item that shoots it.
 
I want to make a couple of alternate water candles (so that when your near a the vanilla water candle and the 2 alternate water candles, the enemy spawn rate will get an increase from all 3).

I looked at the example mod and I don't see an example of a furniture item that gives a buff. So, if I had AlternateWaterCandle.cs in the Tiles folder, would I add something to it, to do so?
 
I want to make a couple of alternate water candles (so that when your near a the vanilla water candle and the 2 alternate water candles, the enemy spawn rate will get an increase from all 3).

I looked at the example mod and I don't see an example of a furniture item that gives a buff. So, if I had AlternateWaterCandle.cs in the Tiles folder, would I add something to it, to do so?
You would probably want to use this method. You could utilize it as follows:
Code:
public override void NearbyEffects(int i, int j, bool closer)
{
    if(closer)
    {
        Main.player[Main.myPlayer].AddBuff(mod.BuffType("MyCandleBuff"), 10);
    }
}
 
You would probably want to use this method. You could utilize it as follows:
Code:
public override void NearbyEffects(int i, int j, bool closer)
{
    if(closer)
    {
        Main.player[Main.myPlayer].AddBuff(mod.BuffType("MyCandleBuff"), 10);
    }
}
I haven't made the buff yet, but I tested using an example buff and it worked. Thanks.

EDIT: I think I have the buff figured out, but I tried testing my mod and I got this error:

An error occurred while loading CorruptionCandles
This mod has automatically been disabled.

Items/Placeable/CursedCandle
at Terraria.ModLoader.Mod.GetTexture(String name)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
 
Last edited:
Back
Top Bottom