tModLoader Official tModLoader Help Thread

ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ID.3467,99);
recipe.AddTile(mod, "Workbench");
recipe.SetResult(this);
recipe.AddRecipe();
This is wrong. For Vanilla items and tiles, you would use:
Code:
recipe.AddIngredient(3467, 99);
//or
recipe.AddIngredient(ItemID.LunarBar, 99);
and for the tile:
Code:
recipe.AddTile(TileID.WorkBenches);
//or
recipe.AddTile(18);
 
This is wrong. For Vanilla items and tiles, you would use:
Code:
recipe.AddIngredient(3467, 99);
//or
recipe.AddIngredient(ItemID.LunarBar, 99);
and for the tile:
Code:
recipe.AddTile(TileID.WorkBenches);
//or
recipe.AddTile(18);
ty
 
How do i make a weapon Fire like starwrath most like Blizzard Staff because im making a magic weapon
 
Is there any way I can prevent tmodloader from disabling my mods for being made for a different modloader version? Whenever I launch the modloader, rarely it's fine, most of the time it disables one or more mods for being a different TML version.
Vanilla hair dye, capitalism, shaderlib, build planner, imksushidatapacks, DAlib, goregalore, instant respawn, and boss checklist have all been disabled at one point or another for being a different mod loader version. I can't seem to find a configuration for ignoring version inconsistencies, please help.

Load order:
https://pastebin.com/sEKGrB5F
 
Last edited:
How do i make a weapon Fire like starwrath most like Blizzard Staff because im making a magic weapon
From this guide I made:
Code:
int numberProjectiles = 6; // shoots 6 projectiles
            for (int index = 0; index < numberProjectiles; ++index)
            {
                Vector2 vector2_1 = new Vector2((float)((double)player.position.X + (double)player.width * 0.5 + (double)(Main.rand.Next(201) * -player.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)player.position.X)), (float)((double)player.position.Y + (double)player.height * 0.5 - 600.0));   //this defines the projectile width, direction and position
                vector2_1.X = (float)(((double)vector2_1.X + (double)player.Center.X) / 2.0) + (float)Main.rand.Next(-200, 201); //change the Main.rand.Next here to, for example, (-10, 11) to reduce the spread. Change this to 0 to remove it altogether
                vector2_1.Y -= (float)(100 * index);
                float num12 = (float)Main.mouseX + Main.screenPosition.X - vector2_1.X;
                float num13 = (float)Main.mouseY + Main.screenPosition.Y - vector2_1.Y;
                if ((double)num13 < 0.0) num13 *= -1f;
                if ((double)num13 < 20.0) num13 = 20f;
                float num14 = (float)Math.Sqrt((double)num12 * (double)num12 + (double)num13 * (double)num13);
                float num15 = item.shootSpeed / num14;
                float num16 = num12 * num15;
                float num17 = num13 * num15;
                float SpeedX = num16 + (float)Main.rand.Next(-40, 41) * 0.02f; //change the Main.rand.Next here to, for example, (-10, 11) to reduce the spread. Change this to 0 to remove it altogether
                float SpeedY = num17 + (float)Main.rand.Next(-40, 41) * 0.02f; 
                Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, type, damage, knockBack, Main.myPlayer, 0.0f, (float)Main.rand.Next(5));
            }
            return false;
If you need any more help, let me know.
 
I found the answer to my old question but unfortunately I have new one. Basically I was creating a debuff for my mod and when I tried to compile it, it gave me this error.

error:
c:\Users\acer\Documents\My Games\Terraria\ModLoader\Mod Sources\something\NPCs\NPCsINFO.cs(5,29) : error CS0246: The type or namespace name 'NPCInfo' could not be found (are you missing a using directive or an assembly reference?)

code:
using Terraria.ModLoader;

namespace something.NPCs
{
public class NPCsINFO : NPCInfo
{
public bool customdebuff = false;
}
}


Please help and thanks in advance.
Use GlobalNPC instead of NPCInfo.
You would also need to add (inside of the class):
Code:
public override void ResetEffects(NPC npc)
        {
                       customdebuff = false;
                }
 
What can you put into ModItem.UpdateAccessory() to add a chance not to consume thrown items, like the set bonuses for fossil and ninja armor?
 
What can you put into ModItem.UpdateAccessory() to add a chance not to consume thrown items, like the set bonuses for fossil and ninja armor?
Are you trying to make it exactly like Ninja/Fossil Armor with a 33% / 50% chance to not consume items or a different percent?
 
Are you trying to make it exactly like Ninja/Fossil Armor with a 33% / 50% chance to not consume items or a different percent?
I would like it to be 33% like the ninja armor.
 
I would like it to be 33% like the ninja armor.
I believe you would add player.thrownChance33; to UpdateAccessory (or whatever updating the player is). It might be a a bit different, but I don’t know for sure.
 
Tmod is giving me an unknown error when I try to download mods. I check the logs and... Nothing. Does anyone know why this is happening?
 
I believe you would add player.thrownChance33; to UpdateAccessory (or whatever updating the player is). It might be a a bit different, but I don’t know for sure.
It actually turned out to be "player.thrownCost33", but it worked! Thank you!
 
Tmod is giving me an unknown error when I try to download mods. I check the logs and... Nothing. Does anyone know why this is happening?
Post the error?
It actually turned out to be "player.thrownCost33", but it worked! Thank you!
I knew I couldn't have gotten it right from mobile. Either way, you're welcome.
 
"Unknown Mod Browser Error. Try again later."

That's literally all it says.
Try reinstalling tModLoader? What mod are you trying to install?
 
Zoaklen and ImkSushi's mods don't download.
 
How do you make it so that an custom enemy that you create spawns only in the forest/purity biome? because i already tried ZonePurity but that wouldnt work
help would be appreciated
 
How do you make it so that an custom enemy that you create spawns only in the forest/purity biome? because i already tried ZonePurity but that wouldnt work
help would be appreciated
You have to eliminate every possible biome that could be in place of the purity.
tileY < Main.worldSurface && !inSky && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneJungle && !player.ZoneSnow && !player.ZoneDesert && !player.ZoneGlowshroom && !player.ZoneMeteor && !player.ZoneTowerSolar && !player.ZoneTowerVortex && !player.ZoneTowerNebula && !player.ZoneTowerStardust
 
I am trying to make a projectile that explodes in contact with tiles but I noticed that tutorial I followed made a projectile that would destroy every block even lihzahrd bricks.How can I make it so that it will only destroy the same type of bricks a regular bomb would?

code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace something.Projectiles
{
public class TerraDragoonBeam2 : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Brick Smash");
Main.projFrames[projectile.type] = 1;
}
public override void SetDefaults()
{
projectile.width = 52;
projectile.height = 48;

projectile.timeLeft = 180;
projectile.friendly = false;
projectile.hostile = true;
projectile.tileCollide = true;
projectile.penetrate = 1;
projectile.melee = true;

}
public override Color? GetAlpha(Color lightColor)
{
return Color.White;
}
public override void AI() //this make that the projectile will face the corect way
{ // |
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
}

public override void Kill(int timeLeft)
{

Vector2 position = projectile.Center;
Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);
int radius = 5; //this is the explosion radius, the highter is the value the bigger is the explosion

for (int x = -radius; x <= radius; x++)
{
for (int y = -radius; y <= radius; y++)
{
int xPosition = (int)(x + position.X / 16.0f);
int yPosition = (int)(y + position.Y / 16.0f);

if (Math.Sqrt(x * x + y * y) <= radius + 0.5) //this make so the explosion radius is a circle
{
WorldGen.KillTile(xPosition, yPosition, false, false, false); //this make the explosion destroy tiles

Dust.NewDust(position, 22, 22, DustID.Smoke, 0.0f, 0.0f, 120, new Color(), 1f); //this is the dust that will spawn after the explosion
}
}
}
}

}
}
 
Back
Top Bottom