tModLoader Official tModLoader Help Thread

So I've came back after maybe 2-3 months and Previously in tmodloader V 0.9.2.3 my mod worked just fine. But i've came back trying to fix it and I'm not very good at coding and just can't find it out. If someone could help that would be greatly appreciated.

Errors:
c:\Users\(user)\Documents\My Games\Terraria\ModLoader\Mod Sources\CrazyItems\Items\Armor\Volron_Breastplate.cs(10,30) : error CS0115: 'CrazyItems.Items.Armor.Volron_Breastplate.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override

c:\Users\(user\Documents\My Games\Terraria\ModLoader\Mod Sources\CrazyItems\Items\Armor\Volron_Helmet.cs(10,30) : error CS0115: 'CrazyItems.Items.Armor.Volron_Helmet.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override

c:\Users\(user)\Documents\My Games\Terraria\ModLoader\Mod Sources\CrazyItems\Items\Armor\Volron_Leggings.cs(10,30) : error CS0115: 'CrazyItems.Items.Armor.Volron_Leggings.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override


Code:
(Volron_Breastplate)
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System.Collections.Generic;

namespace CrazyItems.Items.Armor
{
public class Volron_Breastplate : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Body);
return true;
}

public override void SetDefaults()
{
item.name = "Volron Breastplate";
item.width = 18;
item.height = 18;
AddTooltip("Durable Breastplate of Volron.");
AddTooltip2("5% increased movement speed");
item.value = 10;
item.rare = 2;
item.defense = 10;
}

public override void UpdateEquip(Player player)
{
player.moveSpeed += 0.05f;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}




If you need the code to the other 2 pieces of armor just ask for it. I'll send it
Thank you very much.
 
So I've came back after maybe 2-3 months and Previously in tmodloader V 0.9.2.3 my mod worked just fine. But i've came back trying to fix it and I'm not very good at coding and just can't find it out. If someone could help that would be greatly appreciated.

Errors:
c:\Users\(user)\Documents\My Games\Terraria\ModLoader\Mod Sources\CrazyItems\Items\Armor\Volron_Breastplate.cs(10,30) : error CS0115: 'CrazyItems.Items.Armor.Volron_Breastplate.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override

c:\Users\(user\Documents\My Games\Terraria\ModLoader\Mod Sources\CrazyItems\Items\Armor\Volron_Helmet.cs(10,30) : error CS0115: 'CrazyItems.Items.Armor.Volron_Helmet.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override

c:\Users\(user)\Documents\My Games\Terraria\ModLoader\Mod Sources\CrazyItems\Items\Armor\Volron_Leggings.cs(10,30) : error CS0115: 'CrazyItems.Items.Armor.Volron_Leggings.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override


Code:
(Volron_Breastplate)
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System.Collections.Generic;

namespace CrazyItems.Items.Armor
{
public class Volron_Breastplate : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Body);
return true;
}

public override void SetDefaults()
{
item.name = "Volron Breastplate";
item.width = 18;
item.height = 18;
AddTooltip("Durable Breastplate of Volron.");
AddTooltip2("5% increased movement speed");
item.value = 10;
item.rare = 2;
item.defense = 10;
}

public override void UpdateEquip(Player player)
{
player.moveSpeed += 0.05f;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}




If you need the code to the other 2 pieces of armor just ask for it. I'll send it
Thank you very much.
https://docs.google.com/document/d/1GY6Jyj0IkqfvQlXJUwXg60d2V8tIzumoNVgh5OWzGIc/edit?usp=sharing
 
I need help with this


It looks like this mod doesn't have a class extending Mod. Mods need a Mod class to function.
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad)

Inner Exception:
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad)
 
so i did the last one, but now i face this:
error CS1519: Invalid token '(' in class, struct, or interface member declaration

here's my code(even though no one will answer)

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

namespace PewPewMod.Items
{
public class OPUrbanShoes : ModItem
{
DisplayName.SetDefault("Over-powered Urban Shoes ");
Tooltip.SetDefault("These are NOT for basketball. this also gives you a great speed buff");
}
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Legs);
return true;
}

public override void SetDefaults()
{

item.width = 18;
item.height = 18;
item.value = 10;
item.rare = 2;
item.defense = 80;
}

public override void UpdateEquip(Player player)
{
player.moveSpeed += 4f; //player movement speed incresed 0.05f = 5%
}

public override void AddRecipes() //How to craft this item
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Wood, 10); //you need 10 Wood
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 
so i did the last one, but now i face this:
error CS1519: Invalid token '(' in class, struct, or interface member declaration

here's my code(even though no one will answer)

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

namespace PewPewMod.Items
{
public class OPUrbanShoes : ModItem
{
DisplayName.SetDefault("Over-powered Urban Shoes ");
Tooltip.SetDefault("These are NOT for basketball. this also gives you a great speed buff");
}
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Legs);
return true;
}

public override void SetDefaults()
{

item.width = 18;
item.height = 18;
item.value = 10;
item.rare = 2;
item.defense = 80;
}

public override void UpdateEquip(Player player)
{
player.moveSpeed += 4f; //player movement speed incresed 0.05f = 5%
}

public override void AddRecipes() //How to craft this item
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Wood, 10); //you need 10 Wood
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
I think if you properly formatted this code and compared to something similar in example mod you would see the problems. What I see right away is you have SetStaticDefaults code not inside a method and also that you are using 0.9 AutoLoad methods instead of 0.10 Autoload method signatures.
 
Wanted to know if I get some help with regards to loading mods. I keep getting a Loading error and don't know how to fix it.
---
Failed to resolve assembly: 'Terraria, Version=1.3.5.1, Culture=neutral, PublicKeyToken=null'
at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
at Mono.Cecil.TypeReference.Resolve()
at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
at Mono.Cecil.SignatureReader.ReadCustomAttributeEnum(TypeReference enum_type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArrayArgument(ArrayType type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
at Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
at Mono.Cecil.CustomAttribute.<Resolve>b__34_0(CustomAttribute attribute, MetadataReader reader)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.CustomAttribute.Resolve()
at Mono.Cecil.CustomAttribute.get_ConstructorArguments()
at Mono.Cecil.ImmediateModuleReader.ReadCustomAttributes(ICustomAttributeProvider provider)
at Mono.Cecil.ImmediateModuleReader.ReadType(TypeDefinition type)
at Mono.Cecil.ImmediateModuleReader.ReadTypes(Collection`1 types)
at Mono.Cecil.ImmediateModuleReader.ReadModule(ModuleDefinition module)
at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
at Terraria.ModLoader.AssemblyManager.LoadedMod.EncapsulateReferences(Byte[] code)
at Terraria.ModLoader.AssemblyManager.LoadedMod.LoadAssemblies()
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad) ----


I would take any advice anyone has to offer
 
Hello! I need help making my projectiles emit amber light instead of the basic white light, similar to the light emitted from bullets or fire arrows, since the projectile that is in question is a bullet that sets NPCs on fire. I have the projectile working fine, just this small detail has been bugging me.
 
I am having a problem with tmod loader 10.0.2 in which every time i try to reload my mods, i keep getting an error that certain textures or musics wont load. here is one log i got from it
trelamium
The texture file at Items/Weapons/WallOfFlesh/AwakenProj.png failed to load
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Inner Exception:
Insufficient memory to continue the execution of the program.
at Microsoft.Xna.Framework.Helpers.GetExceptionFromResult(UInt32 result)
at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
at Microsoft.Xna.Framework.Graphics.Texture2D.FromStream(GraphicsDevice graphicsDevice, Stream stream)
at Terraria.ModLoader.Mod.Autoload()
 
Hi, I' trying to make an accessory that, when a players health drops below a certain level, increase a players damage output but I keep getting the error message that Terraria.player doesn't contain a definition for 'life' so what should I be using?

My code looks like this::

public override void UpdateAccessory(Player player, bool hideVisual)
{
if (player.life < 60 && player.life > 51)
{
item.damage = item.damage * 0.1;
}

Thanks
 
Hi, I' trying to make an accessory that, when a players health drops below a certain level, increase a players damage output but I keep getting the error message that Terraria.player doesn't contain a definition for 'life' so what should I be using?

My code looks like this::

public override void UpdateAccessory(Player player, bool hideVisual)
{
if (player.life < 60 && player.life > 51)
{
item.damage = item.damage * 0.1;
}

Thanks
statLife
 
Hey, does someone know how to send item data between clients? I triend it with NetMessage but that doesn't seem to work. Maybe I am doing something wrong?

Just in case, here is my code:
Code:
int loopPlayerItemID = loopPlayerItem.netID;
if (Main.netMode == 1)
{
     NetMessage.SendData(Terraria.ID.MessageID.SyncItem, -1, -1, "", loopPlayerItemID);
}
Note that this is my first time working with server/client syncing
 
Last edited:
Thanks for the guide, its been really helpful. I'm trying to make a mount that attacks when you left click, but I can't find anything on how to do that. Can you help?
 
Can someone help me with this error when i want to publish my mod:

Your Mod Browser Credentials are invalid. Please fix the ModBrowserPassphrase property in My Games\Terraria\ModLoader\config.json by visiting http://javid.ddns.net/tModLoader/register.php

I bought Terraria and my passphrase is never correct.

EDIT: If there is no solution, can someone be kind to publish my mod.
 
Hey, does someone know how to send item data between clients? I triend it with NetMessage but that doesn't seem to work. Maybe I am doing something wrong?

Just in case, here is my code:
Code:
int loopPlayerItemID = loopPlayerItem.netID;
if (Main.netMode == 1)
{
     NetMessage.SendData(Terraria.ID.MessageID.SyncItem, -1, -1, "", loopPlayerItemID);
}
Note that this is my first time working with server/client syncing
The recent change to Terraria replaced the string in SendData with NetworkText. If you aren't sending text, just replace "" with null.
 
With Ikw's problem of not being able to play calamity or spirit mod because custom music and textures fail to load, can you tell me how to fix this issue.
here is the log i have of my issue
trelamium
The texture file at Items/Weapons/WallOfFlesh/AwakenProj.png failed to load
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Inner Exception:
Insufficient memory to continue the execution of the program.
at Microsoft.Xna.Framework.Helpers.GetExceptionFromResult(UInt32 result)
at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
at Microsoft.Xna.Framework.Graphics.Texture2D.FromStream(GraphicsDevice graphicsDevice, Stream stream)
at Terraria.ModLoader.Mod.Autoload()
 
Hi, I'm trying to make my first mod, but I don't know anything about C#. All I want to do is an accessory that reduces the damage taken by 30% (and stacks with worm scarf), and reduces my damage by 7%. As I don't know nothing about it, could someone help me?
 
I am trying to make a modded sword, but there are errors.

Missing mod: TutorialMOD/Items/CustomSword
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.ModItem.AutoStaticDefaults()
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

The .png is named CustomSword, same as the .cs file and the Public Class

Here's my project files:

Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMOD.Items
{
    public class CustomSword : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("CustomSword");
            Tooltip.SetDefault("This is a modded sword.");
        }
        public override void SetDefaults()
        {
            item.damage = 50;
            item.melee = true;
            item.width = 40;
            item.height = 40;
            item.useTime = 20;
            item.useAnimation = 20;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 2;
            item.UseSound = SoundID.Item1;
            item.autoReuse = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

What do I do? Thanks in advance!
 
Back
Top Bottom