• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Begin your search for Journey's End information here and here. Please report bugs and issues for Journey's End here.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

tModLoader Official tModLoader Help Thread

MrBlackNT66rus

Terrarian
Hello. I downloaded Steam Terraria, installed tmodloader 0.11.6.2 and this error crashes on startup. who knows how to solve?
всем привет. скачал в стиме террарию, установил tmodloader 0.11.6.2 и при запуске вылетает эта ошибка. кто знает как решить?

View attachment 233924
I launch Terraria through Terraria Tweaker 2. Previously it started normally until it reinstalled Windows
 

CrimsHallowHero

Terrarian
It seems to be a bug in tModLoader.

When a player is on the unicorn mount and is wearing wings he still takes fall damage. While he doesn't in vanilla Terraria 1.3.5.3.
Tested on tModLoader 0.11.6.2 with all mods disabled.
 

Xlsfd

Terrarian
I've recently tried to create my first custom projectiles. After reading these forums, I managed to code them so that they work in-game. However, the textures don't look right.
This
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

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

namespace BiomeProjectiles.Projectiles
{
    public class BiomeArrow : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.width = 14;
            projectile.height = 32;
            projectile.timeLeft = 600;
            projectile.penetrate = 1;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.tileCollide = true;
            projectile.ignoreWater = true;
            projectile.ranged = true;
            projectile.aiStyle = 0;
            aiType = ProjectileID.WoodenArrowFriendly;
        }
    }
}
fires a 14x32 px, downward-facing arrow, no matter in which direction the bow/repeater is held. The projectile does fly towards the cursor, but it's not automatically rotated in the right direction like the vanilla arrows are.

And this
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

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

namespace BiomeProjectiles.Projectiles
{
    public class BiomeBullet : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.width = 20;
            projectile.height = 2;
            projectile.timeLeft = 600;
            projectile.penetrate = 1;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.tileCollide = true;
            projectile.ignoreWater = true;
            projectile.ranged = true;
            projectile.aiStyle = 0;
            aiType = ProjectileID.Bullet;
        }
    }
}
fires a 20x2 px horizontal box (like vanilla Musket Balls) that is also not rotated towards the cursor.

Any hints on how to fix this?

EDIT: Figured it out on my own. I just had to change the aiStyle of both projectiles to 1 and rotate the texture pictures manually by 180 degrees (arrow)/90 degrees (bullet). I'm leaving this post here as a hint to anyone who has the same problem.
 
Last edited:

Proxiehunter

Terrarian
It's been a while since I played Terraria, I kept waiting for the upcoming update. Decided today that it's been too long since I played Terraria and booted the game up. It started normally and told me that Tmodloader had updated to 11.6. I installed the update and restarted but now when I try to start the game I get an error that says No suitable graphics card found. Could not find a Direct3d device that supports the XNA Framework Reach Profile. Going to try a rollback but it seems odd that TModLoader would suddenly require a better graphics card than the base game. One of the good things about Terraria is that you can play it on a potato.

Edit: I should not have had lower than Tmodloader 11.2.2 so something is clearly screwy here. I'm going to try a clean reinstall of Terraria to see what's up.

edit 2: Clean install of core game works fine. Trying to mod again.

Edit 3: Tmodloader 10.1.5 is the last version that does not cause an error message.
 
Last edited:

Steckty

Terrarian
New to the forum, so I'll try posting here first. I tried making my first mod. This item I tried to add is a vanity item, but when trying to build and reload I get this error. Any tips?
code1.PNG
code2.PNG
 

Ordinary Orange α

Skeletron Prime
Simple problem: When I try to use the .jar installer it just opens a Notepad file with a bunch of unintelligible symbols instead of actually downloading TModLoader.
 

RTGGames

Skeletron Prime
New to the forum, I had taken the code from examplemod to create a boss, but now I get this.


error CS1061: 'NPC' does not contain a definition for 'ModNPC' and no accessible extension method 'ModNPC' accepting a first argument of type 'NPC' could be found (are you missing a using directive or an assembly reference?)

error CS0120: An object reference is required for the non-static field, method, or property 'ModNPC.npc'



[AutoloadBossHead]
public class CaptiveElement : ModNPC
{
public const string CaptiveElementHead = "Thovam/NPCs/eee/CaptiveElement_Head_Boss_";
public override bool Autoload(ref string name) {
// Adds boss head textures for the eee boss
for (int k = 1; k <= 4; k++) {
mod.AddBossHeadTexture(CaptiveElementHead + k);
}
return base.Autoload(ref name);
}
private int center {
get => (int)npc.ai[0];
set => npc.ai[0] = value;
}
private int captiveType {
get => (int)npc.ai[1];
set => npc.ai[1] = value;
}
private float attackCool {
get => npc.ai[2];
set => npc.ai[2] = value;
}
private int change {
get => (int)npc.ai[3];
set => npc.ai[3] = value;
}
public override void SetStaticDefaults() {
DisplayName.SetDefault("Captive Element");
Main.npcFrameCount[npc.type] = 10;
}
public override void SetDefaults() {
npc.aiStyle = -1;
npc.lifeMax = 15000;
npc.damage = 100;
npc.defense = 55;
npc.knockBackResist = 0f;
npc.dontTakeDamage = true;
npc.width = 100;
npc.height = 100;
npc.value = Item.buyPrice(0, 20, 0, 0);
npc.npcSlots = 10f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = true;
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
music = MusicID.Boss2;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) {
npc.lifeMax = (int)(npc.lifeMax * 0.6f * bossLifeScale);
npc.damage = (int)(npc.damage * 0.6f);
}
public override void AI() {
NPC eee= Main.npc
;
if (!eee.active || eee.type != NPCType<eee>()) {
if (change > 0 || NPC.AnyNPCs(NPCType<eeeRun>())) {
if (change == 0) {
npc.netUpdate = true;
}
change++;
}
else {
npc.life = -1;
npc.active = false;
return;
}
}
if (change > 0) {
Color? color = GetColor();
if (color.HasValue) {
for (int x = 0; x < 5; x++) {
int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustType<Pixel>(), 0f, 0f, 0, color.Value);
double angle = Main.rand.NextDouble() * 2.0 * Math.PI;
Main.dust[dust].velocity = 3f * new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
}
}
if (Main.netMode != 1 && change >= 100f) {
int next = NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, NPCType<CaptiveElement2>());
Main.npc[next].ai[0] = captiveType;
if (captiveType != 4) {
Main.npc[next].ai[1] = 300f + (float)Main.rand.Next(100);
}
npc.life = -1;
npc.active = false;
}
return;
}
else if (npc.timeLeft < 750) {
npc.timeLeft = 750;
}
if (npc.localAI[0] == 0f) {
if (GetDebuff() >= 0f) {
npc.buffImmune[GetDebuff()] = true;
}
if (captiveType == 3f) {
npc.buffImmune[20] = true;
}
if (captiveType == 0f) {
npc.coldDamage = true;
}
npc.localAI[0] = 1f;
}
SetPosition(npc);
attackCool -= 1f;
if (Main.netMode != 1 && attackCool <= 0f) {
attackCool = 200f + 200f * (float)111.life / (float)eee.lifeMax + (float)Main.rand.Next(200);
Vector2 delta = Main.player[npc.target].Center - npc.Center;
float magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
if (magnitude > 0) {
delta *= 5f / magnitude;
}
else {
delta = new Vector2(0f, 5f);
}
int damage = (npc.damage - 30) / 2;
if (Main.expertMode) {
damage = (int)(damage / Main.expertDamage);
}
Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta.X, delta.Y, ProjectileType<ElementBall>(), damage, 3f, Main.myPlayer, GetDebuff(), GetDebuffTime());
npc.netUpdate = true;
}
}
public static void SetPosition(NPC npc) {
CaptiveElement modNPC = npc.ModNPC as CaptiveElement;
if (modNPC != null) {
Vector2 center = Main.npc[modNPC.center].Center;
double angle = Main.npc[modNPC.center].ai[3] + 2.0 * Math.PI * modNPC.captiveType / 5.0;
npc.position = center + 300f * new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) - npc.Size / 2f;
}
}
public override void FindFrame(int frameHeight) {
npc.frame.Y = captiveType * frameHeight;
if (captiveType == 1) {
npc.alpha = 100;
}
if (attackCool < 50f) {
npc.frame.Y += 5 * frameHeight;
}
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot) {
if (captiveType == 2 && Main.expertMode) {
cooldownSlot = 1;
}
return true;
}
public override void OnHitPlayer(Player player, int dmgDealt, bool crit) {
if (Main.expertMode || Main.rand.NextBool()) {
int debuff = GetDebuff();
if (debuff >= 0) {
player.AddBuff(debuff, GetDebuffTime(), true);
}
}
}
public int GetDebuff() {
switch (captiveType) {
case 0:
return BuffID.Frostburn;
case 1:
return BuffType<Buffs.EtherealFlames>();
case 3:
return BuffID.Venom;
case 4:
return BuffID.Ichor;
default:
return -1;
}
}
public int GetDebuffTime() {
int time;
switch (captiveType) {
case 0:
time = 400;
break;
case 1:
time = 300;
break;
case 3:
time = 400;
break;
case 4:
time = 900;
break;
default:
return -1;
}
return time;
}
public Color? GetColor() {
switch (captiveType) {
case 0:
return new Color(0, 230, 230);
case 1:
return new Color(0, 153, 230);
case 3:
return new Color(0, 178, 0);
case 4:
return new Color(230, 192, 0);
default:
return null;
}
}
public override void BossHeadSlot(ref int index) {
if (captiveType > 0) {
index = ModContent.GetModBossHeadSlot(CaptiveElementHead + captiveType);
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) {
eee eee= Main.npc
.modNPC as eee;
if (Main.expertMode && eee!= null && eee.npc.active && eee.laserTimer <= 60 && (eee.laser1 == captiveType || eee.laser2 == captiveType)) {
Color? color = GetColor();
if (!color.HasValue) {
color = Color.White;
}
float rotation = eee.laserTimer / 30f;
if (eee.laser1 == captiveType) {
rotation *= -1f;
}
spriteBatch.Draw(ModContent.GetTexture("Thovam/NPCs/eee/Rune"), npc.Center - Main.screenPosition, null, color.Value, rotation, new Vector2(64, 64), 1f, SpriteEffects.None, 0f);
}
return true;
}​
 
Hello, I would like help with a mod I am working on. It's going to be a mod that adds more functional statues that summon enemies. any idea how to make a wiring component?
Thanks in advance!
 

Xablauzero

Terrarian
Ay bois, i just playing some mods like every time, but, i always ask myself: It's possible to enchant mod weapons? Because, every time that i try to put the weapon in the forge, i just can't, it's like trying to enchant an ore, you can't put him. So, if anyone have an solution for this or a mod that fix it, tell me pls.
 

ModdedTerrarian

The Destroyer
I need some help. When I try to update a mod, the bar is fully yellow but nothing else happens. The only thing I can do is cancel. Does anybody know why it’s happening and how to deal with it?
 
Top Bottom