tModLoader Official tModLoader Help Thread

hmmm, my pocket demon altar is lagging my game when near other crafting stations :/ anyone know a better way of doing this than setting player.adjTile[26] = true; in UpdateInventory? or a way to make that less laggy? actually doesn't work at all. don't know why it compiles.
 
Last edited:
Is it possible to clone the StaticDefaults of an item
Yes. For example:

using Terraria.ModLoader;

namespace ThunderRain.Items
{
public class Thunderingorer : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("Used to craft suspicious thunder god.");
}

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

using Terraria.ModLoader;

namespace ThunderRain.Items
{
public class Thunderingorer : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("Used to craft suspicious thunder god.");
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
were is the clone code in this example
 
also, the code for how makeStrongBee in the Player code is replacing bee projectiles is kinda confusing, there anyone who's done something along those lines who can provide insight into that confusing pile of code?
 
hä this is a normal tootltip i want a code like item.CloneDefaults(ItemID.CactusPickaxe); but for static defaults
idk. I only know this.
namespace GrandLife.Items
{
public class AdamantiteBattlePickaxe : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Adamantite Battle Pickaxe");
}

public override void SetDefaults()
{
item.CloneDefaults(ItemID.AdamantitePickaxe);
item.damage = 55;
}
Maybe, you ask in Discord? Because in Discord more activity, than here.
 
Could I get some guidance on how to change the indexing of mod recipes in game? So that for example "X" armor set appears in this order in the crafting menu: X Helmet, X Breastplate, X Greaves. It is done alphabetically by default, so it's a little inconvenient.
 
can someone help me this ?
Field not found: 'Terraria.Item.toolTip'.
at ExampleMod.Items.BorealWoodFence.SetDefaults(Item item)
at Terraria.ModLoader.ItemLoader.SetDefaults(Item item, Boolean createModItem)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
 
Hello, I just have a simple question.

I updated now to new tmodloader version and I don´t want to wait for the mods to update (some of them haven´t been updated in months).

So I was wondering how and how hard it is to update them myself not knowing alot of coding and so on.
 
Hello, I just have a simple question.

I updated now to new tmodloader version and I don´t want to wait for the mods to update (some of them haven´t been updated in months).

So I was wondering how and how hard it is to update them myself not knowing alot of coding and so on.
Depending on what mods you use, it's probably pretty close to impossible.
 
Hello, I just have a simple question.

I updated now to new tmodloader version and I don´t want to wait for the mods to update (some of them haven´t been updated in months).

So I was wondering how and how hard it is to update them myself not knowing alot of coding and so on.
Depends on which mods
 
I guess I can start with some small ones like maxstackplus and then work my way up the list hehe, I just need to know how to do it.
 
I guess I can start with some small ones like maxstackplus and then work my way up the list hehe, I just need to know how to do it.
If the mod is tModReader compatible, you could extract it, use the migration guide to fix the problems, and then rebuild the mod.
It won't be easy, but I guess you can give it a try, at least.
 
Hello modding community, this is my first time posting on modding with Terraria, and I'm hitting quite a few snags. As of this post, I've only attempted modding for one day, and I literally never touched any kind of real coding, so I'm still far below a novice at this sort of thing. I've a few things I'd like help and clarification on, as well as a couple of general questions I could not find the answer to by searching Google, the forums, or asking on other sites. Sprite work is not an issue, especially with how simple it is to mimic the art style in the game (though I wonder why sprites are drawn tiny and upscaled 2x), but coding is something I've never been good with. I spent a good chunk of the day trying to learn how to do this, since I had a lot of free time, and I might've missed stuff in my searching. If I ask something that was answered that I missed, I apologize and would be greatly appreciative if I could be pointed to the post with the answer if that happened.

I also apologize for the wall of text that I'm about to drop. I wanted to be thorough on what I wanted to explain, and it got a bit winded. It's also 4:30 AM when I posted this, so I'm tired when I posted it.

I. Accessories
First, I've been trying to make a few accessories. The first issue is the most obnoxious of the bunch, being that I get this error every time I try to build the mod in the game;
"accessory01.cs(11,30) : error CS0115: 'My_Mod.Items.CustomShield.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override"
The code for it is as follows;
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

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

  public override void SetDefaults()
  {
  item.name = "Mythic Bulwark";
  item.width = 24;
  item.height = 28;
  item.toolTip = "Grants immunity to knockback.";
  item.value = Item.buyPrice(0, 2, 0, 0);
  item.rare = 4;
  item.accessory = true;
  item.defense = 4;

  }
  public override void UpdateAccessory(Player player, bool hideVisual)  // Does this actually hide the shield? I don't want that, how would I remove this safely?
  {
  player.noKnockback = true;  
  }


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

  }
}

I followed a guide on youtube to creating a shield, which was my first accessory choice. I was able to get a proper melee weapon added in, which was surprisingly simple, but accessories seem to be much harder. The error tells me that the item.name line is the problem, but I cannot figure out why as the videos I watch on making mods for tmodloader clearly use the same code with different text. What am I doing wrong with the code that causes the error?

II. Visual Studio Question
The shortest question I have is related to Visual Studio. In the guide on how to set up MVS to work with Terraria, I followed everything step by step. Thankfully, everything does work, and I've had little to no trouble at all getting used to it. Unfortunately, the IntelliSense stated in the opening post of this thread doesn't happen. It'll fill in stuff like "Items" when I try to type "item", but it doesn't fill in anything like I've seen in the opening post or in the tutorials I've watched and read. Is there some small detail I somehow missed?

III. Monsters
On the next topic, I'm also making sprites for monsters. I figured out how to implement basic zombies and slimes, but I only know how to make them spawn at night since the zombie was the first thing I managed to make. I want to make more monsters, specifically things similar to a Wyvern since I want to make bigger monster sprites without going into boss territory (that's biting way too much for a beginner, most likely). I found how to make the zombie as it was the first tutorial I found, but I can't find ANYTHING on how to make a Wyvern. I mainly just want to make variants spawn, much like there's a bunch of zombies, slimes, and skeletons. I just want to have different skins on default Wyvern stats, and I've got a few already sprited. I just can't find the details on a Wyvern. I have access to decompiled data, thanks to Google, but even then I can't find anything at all. Would someone be capable of posting a modded wyvern's code? This is one of my more ambitious goals, even if it's not much.

On two similar notes, how would I increase the movement speed and jump height of the other mentioned enemies, and what are the codes to allow monsters to spawn at certain times and biomes? I want mad hopping skeletons in the purity, zombies running at mach four in the desert, and slimes jumping into space like the dolphins from the Hitchhiker's Guide movie.

IV. Weapons
Next on my questions, and hearkening back to the weapon I mentioned, I don't know how to make them fire projectiles. I'm not aiming to make something absurd like Meowmere and Starwrath, but I just want to make a melee weapon that you upgrade over time that is useful in every tier. I understand how to do the crafting and recipes, since that's incredibly simple, but I've had a hard time finding anything that's not a basic melee weapon. No yoyos, no thrown items, but a normal sword/hammer/axe/fish that has a projectile that progressively gets better as the weapon upgrades. How would I go about making a melee weapon that sends out a projectile?

V. Buffs on Items
My last question can probably be lumped together with the above questions, but I kept it separate because it's also a bit off topic from the above parts. As is evident from the above code, I don't have anything in the way of buffs on the accessory other than knockback resistance. I found a single, incredibly lacking wiki with a few possible things, but half of them didn't work and provided a similar error as stated above. Is there a list with all the buffs that can be applied to accessories and armor?


I'm using Notepad ++ and MSV 2017. I've downloaded the files from the various threads on setting up tmodloader and MSV for Terraria, so I've prepared as best as I could for actually doing this. I just lack the resources and know how to make the very things I want to make.
 
Hello modding community, this is my first time posting on modding with Terraria, and I'm hitting quite a few snags. As of this post, I've only attempted modding for one day, and I literally never touched any kind of real coding, so I'm still far below a novice at this sort of thing. I've a few things I'd like help and clarification on, as well as a couple of general questions I could not find the answer to by searching Google, the forums, or asking on other sites. Sprite work is not an issue, especially with how simple it is to mimic the art style in the game (though I wonder why sprites are drawn tiny and upscaled 2x), but coding is something I've never been good with. I spent a good chunk of the day trying to learn how to do this, since I had a lot of free time, and I might've missed stuff in my searching. If I ask something that was answered that I missed, I apologize and would be greatly appreciative if I could be pointed to the post with the answer if that happened.

I also apologize for the wall of text that I'm about to drop. I wanted to be thorough on what I wanted to explain, and it got a bit winded. It's also 4:30 AM when I posted this, so I'm tired when I posted it.

I. Accessories
First, I've been trying to make a few accessories. The first issue is the most obnoxious of the bunch, being that I get this error every time I try to build the mod in the game;
"accessory01.cs(11,30) : error CS0115: 'My_Mod.Items.CustomShield.Autoload(ref string, ref string, System.Collections.Generic.IList<Terraria.ModLoader.EquipType>)': no suitable method found to override"
The code for it is as follows;
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

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

  public override void SetDefaults()
  {
  item.name = "Mythic Bulwark";
  item.width = 24;
  item.height = 28;
  item.toolTip = "Grants immunity to knockback.";
  item.value = Item.buyPrice(0, 2, 0, 0);
  item.rare = 4;
  item.accessory = true;
  item.defense = 4;

  }
  public override void UpdateAccessory(Player player, bool hideVisual)  // Does this actually hide the shield? I don't want that, how would I remove this safely?
  {
  player.noKnockback = true;
  }


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

  }
}

I followed a guide on youtube to creating a shield, which was my first accessory choice. I was able to get a proper melee weapon added in, which was surprisingly simple, but accessories seem to be much harder. The error tells me that the item.name line is the problem, but I cannot figure out why as the videos I watch on making mods for tmodloader clearly use the same code with different text. What am I doing wrong with the code that causes the error?

II. Visual Studio Question
The shortest question I have is related to Visual Studio. In the guide on how to set up MVS to work with Terraria, I followed everything step by step. Thankfully, everything does work, and I've had little to no trouble at all getting used to it. Unfortunately, the IntelliSense stated in the opening post of this thread doesn't happen. It'll fill in stuff like "Items" when I try to type "item", but it doesn't fill in anything like I've seen in the opening post or in the tutorials I've watched and read. Is there some small detail I somehow missed?

III. Monsters
On the next topic, I'm also making sprites for monsters. I figured out how to implement basic zombies and slimes, but I only know how to make them spawn at night since the zombie was the first thing I managed to make. I want to make more monsters, specifically things similar to a Wyvern since I want to make bigger monster sprites without going into boss territory (that's biting way too much for a beginner, most likely). I found how to make the zombie as it was the first tutorial I found, but I can't find ANYTHING on how to make a Wyvern. I mainly just want to make variants spawn, much like there's a bunch of zombies, slimes, and skeletons. I just want to have different skins on default Wyvern stats, and I've got a few already sprited. I just can't find the details on a Wyvern. I have access to decompiled data, thanks to Google, but even then I can't find anything at all. Would someone be capable of posting a modded wyvern's code? This is one of my more ambitious goals, even if it's not much.

On two similar notes, how would I increase the movement speed and jump height of the other mentioned enemies, and what are the codes to allow monsters to spawn at certain times and biomes? I want mad hopping skeletons in the purity, zombies running at mach four in the desert, and slimes jumping into space like the dolphins from the Hitchhiker's Guide movie.

IV. Weapons
Next on my questions, and hearkening back to the weapon I mentioned, I don't know how to make them fire projectiles. I'm not aiming to make something absurd like Meowmere and Starwrath, but I just want to make a melee weapon that you upgrade over time that is useful in every tier. I understand how to do the crafting and recipes, since that's incredibly simple, but I've had a hard time finding anything that's not a basic melee weapon. No yoyos, no thrown items, but a normal sword/hammer/axe/fish that has a projectile that progressively gets better as the weapon upgrades. How would I go about making a melee weapon that sends out a projectile?

V. Buffs on Items
My last question can probably be lumped together with the above questions, but I kept it separate because it's also a bit off topic from the above parts. As is evident from the above code, I don't have anything in the way of buffs on the accessory other than knockback resistance. I found a single, incredibly lacking wiki with a few possible things, but half of them didn't work and provided a similar error as stated above. Is there a list with all the buffs that can be applied to accessories and armor?


I'm using Notepad ++ and MSV 2017. I've downloaded the files from the various threads on setting up tmodloader and MSV for Terraria, so I've prepared as best as I could for actually doing this. I just lack the resources and know how to make the very things I want to make.
If you use tmodloader 0.10 you must write this
Code:
[AutoloadEquip(EquipType.Head)]
public class AbominationMask : ModItem
instead of
Code:
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
    equips.Add(EquipType.Head);
    return true;
You can see in this Guide

For Projectles with fire debuff you can extract my mod the Molten Drill and Jackhamsroom have one
 
help
tModLoader won't launch, when i open it it shows:

System.DllNotFoundException: Unable to load DLL 'CSteamworks': Nie można odnaleźć określonego modułu. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
 
help
tModLoader won't launch, when i open it it shows:

System.DllNotFoundException: Unable to load DLL 'CSteamworks': Nie można odnaleźć określonego modułu. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
Have you updayte tmodloader withou using "Dateien auf fehler überprüfen..." (I dunno what it call in english) feature of steam
 
Back
Top Bottom