tModLoader Official tModLoader Help Thread

Hi! i was having the same issue ,first,you should go to the tmodloader mods folder in your documents directory, look for the files who end in .enabled extension,delete those files, then start your modded terraria, go to the mod menu, enable the mods you want , and dont press "reload mods", just clic "back" and then exit the game normally, and just open the client again , if none of these works , try installing .net framework 4.6.2 or 4.7

Sorry ,but english isn't my native language ><
Thank you very very much. Deleting the files worked out well for me.
 
So I'm trying to compile a mod I've made. It's supposed to be a bullet that does no damage, but heals the player and inflicts quite a few debuffs. Every time I try to compile it, I get this:

c:\Users\[CLASSIFIED]\Documents\My Games\Terraria\ModLoader\Mod Sources\VampiricAmmo\Projectiles\Bullet.cs(36,17) : error CS1518: Expected class, delegate, enum, interface, or struct

Here's my code:

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using Terraria;
using Terraria.ModLoader;

namespace VampiricAmmo.Projectiles //We need this to basically indicate the folder where it is to be read from, so you the texture will load correctly
{
public class VampiricAmmo : ModProjectile
{
public override void SetDefaults()
{
projectile.name = "Vampiric Bullet"; //Name of the projectile, only shows this if you get killed by it
projectile.width = 36; //Set the hitbox width
projectile.height = 36; //Set the hitbox height
projectile.timeLeft = 60; //The amount of time the projectile is alive for
projectile.penetrate = 100; //Tells the game how many enemies it can hit before being destroyed
projectile.friendly = true; //Tells the game whether it is friendly to players/friendly npcs or not
projectile.hostile = false; //Tells the game whether it is hostile to players or not
projectile.tileCollide = false; //Tells the game whether or not it can collide with a tile
projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
projectile.ranged = true; //Tells the game whether it is a ranged projectile or not
projectile.aiStyle = 1; //How the projectile works, this is no AI, it just goes a straight path
projectile.aiType = ProjectileID.ChlorophyteBullet
}

public override void AI()
{
Player owner = Main.player[projectile.owner]; //Makes a player variable of owner set as the player using the projectile
projectile.light = 0.9f; //Lights up the whole room
projectile.alpha = 128; //Semi Transparent

}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(mod.BuffType("Bleeding"), 180);
target.AddBuff(mod.BuffType("Poisoned"), 180);
target.AddBuff(mod.BuffType("On Fire!"), 180);
target.AddBuff(mod.BuffType("Venom"), 180);
target.AddBuff(mod.BuffType("Cursed"), 180);
target.AddBuff(mod.BuffType("Cursed Inferno"), 180);
target.AddBuff(mod.BuffType("Burning"), 180);
target.AddBuff(mod.BuffType("Frostburn"), 180);
target.AddBuff(mod.BuffType("Electrified"), 180);
owner.statLife += 15;
owner.healEffect(15, true);
}

}

You have an extra bracket, delete it.
 
I have 2 ideas:

1. Replace item. with projectile.
or
2. Delete the line of code that says item.name

Copy the file just in case neither work.

nothing worked, i have tried a "tutorial mod" made by al0n37, and nothing was working, every single script had an issue, and the code than i ask for help was made by her, do you have any .cs of any sentry rod? or at least could you tell me where to find one?
 
nothing worked, i have tried a "tutorial mod" made by al0n37, and nothing was working, every single script had an issue, and the code than i ask for help was made by her, do you have any .cs of any sentry rod? or at least could you tell me where to find one?

I don't have a .cs file or a clue where you could find one. If what I'm about to tell you doesn't work, then ask a "professional". You could try to replace

using Terraria;
using Terraria.ID;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;

with


using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameInput;
 
Can anyone help me? Out of nowhere, whenever I tried to launch Terraria with TML, it keep saying "Please launch your game from the Steam client". I know I'm not giving info on anything else, it's just I don't know how to or what to show.
 
Can anyone help me? Out of nowhere, whenever I tried to launch Terraria with TML, it keep saying "Please launch your game from the Steam client". I know I'm not giving info on anything else, it's just I don't know how to or what to show.

Open Steam, and then open your Tmodloader shortcut on your desktop (don't do anything on Steam). Then close Steam.
 
Guys,

Error CS0101: O namespace 'NetsurMod.Items' já contém uma definição para 'FirstSword?

What I do? Obs: its written in Portuguese
 
Open Steam, and then open your Tmodloader shortcut on your desktop (don't do anything on Steam). Then close Steam.

It still has the same message. Just to make sure you mean the Terraria.exe from the TModLoader folder that you download right.

After typing the original message, it said something like Terraria.exe is try to launch from something. I clicked OK and nothing happened I can't get the message to pop up anymore.
 
It still has the same message. Just to make sure you mean the Terraria.exe from the TModLoader folder that you download right.

After typing the original message, it said something like Terraria.exe is try to launch from something. I clicked OK and nothing happened I can't get the message to pop up anymore.

Idk what to do, because my method always works for me.
 
I don't have a .cs file or a clue where you could find one. If what I'm about to tell you doesn't work, then ask a "professional". You could try to replace

using Terraria;
using Terraria.ID;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;

with


using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameInput;

now there is something with "addtooltip". these are rotten codes
 
Hello !
Im new to modding and I need some help.
So i'm trying to make an unnerf rod of discord (When you had no CD on TP) and i have 2 problems.
Since i started like 1h ago I have my sprite, my animation and part of the tp.

- I need to get the tile type under my mouse position (Or maybe more like "around" my mouse position) to see if I can TP or not. And I can't find anything about "world" related tiles - something like a huge array of all the tiles of the map. Sorry if a similar questions has been asked before. 187 pages are a lot of pages to check :sigh:

- And less importantly, when you use the actual rod of discord you have a little "fade to black" effect. I wonder if you can do something similar with tmodloader :)
 
Does anyone know how to add more gender opinions to the character creation screen?



All I know is that pets are internally known as projectiles.
Thanks Super Phanto , but I need preAI names (like player.penguin) to make pets independent from the other vanilla pet that shares same AI.
 
I need a bit of help again. Since my last post, I've gotten everything fixed and working almost perfectly. I made a sprite for my custom ammo, but instead of firing horizontally, it fires vertically. How would I go about fixing this problem?

Also, how would I make a weapon convert ammo to ammo from a mod? I was looking through the Example Gun scripts, and it gives the code for converting ammo to a vanilla round like the Uzi but not for a modded round.
 
Does anyone know how to add more gender opinions to the character creation screen?



All I know is that pets are internally known as projectiles.
Then add this:

public override void SetStaticDefaults()
{
Tooltip.SetDefault("Insert Tooltip Here");
}
everything worked properly, but when i wanted to reload my mod this happend

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


this is the actual sentry code

using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameInput;

namespace customsentry.Items
{
public class customsentry : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("customsentry");
Tooltip.SetDefault("This is a modded sword.");
}
public override void SetDefaults()
{
item.damage = 60; //The damage stat for the Weapon.
item.mana = 20; //this defines how many mana this weapon use
item.width = 56; //The size of the width of the hitbox in pixels.
item.height = 56; //The size of the height of the hitbox in pixels.
item.useTime = 25; //How fast the Weapon is used.
item.useAnimation = 25; //How long the Weapon is used for.
item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing for example
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 2.5f; //The knockback stat of your Weapon.
item.value = Item.buyPrice(0, 10, 0, 0); // How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 10gold)
item.rare = 8; //The color the title of your Weapon when hovering over it ingame
item.UseSound = SoundID.Item44; //The sound played when using your Weapon
item.autoReuse = true; //Weather your Weapon will be used again after use while holding down, if false you will need to click again after use to use it again.
item.shoot = mod.ProjectileType("CustomSentryProj"); //This defines what type of projectile this weapon will shot
item.summon = true; //This defines if it does Summon damage and if its effected by Summon increasing Armor/Accessories.
item.sentry = true; //tells the game that this is a sentry
}

public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 SPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY); //this make so the projectile will spawn at the mouse cursor position
position = SPos;
for (int l = 0; l < Main.projectile.Length; l++)
{ //this make so you can only spawn one of this projectile at the time,
Projectile proj = Main.projectile[l];
if (proj.active && proj.type == item.shoot && proj.owner == player.whoAmI)
{
proj.active = false;
}
}
return true;
}
}
}

change it if is necesary
 
Brand new to modding here. Iv come across a problem while loading, got the CS1514 error, pointing to 8.19. But when i look at line 8 character 19 nothing seems wrong. Heres the full code for my projectile having the issue:

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

namespace SaobiesTomesMod.Projectiles
{
public class MagicProgectile : ModProjectile
{
public override void SetDefault()
{
projectile.name = "Book Of Faults Projectile";
projectile.width = 40;
projectile.height = 40;
projectile.friendly = true;
projectile.penetrate = -1;
Main.projFrames[projectile.type] = 4;
projectile.hostile = false;
projectile.magic = true;
projectile.toleCollide = true;
projectile.ignoreWater = true;
}

public override void AI ()
{

int DistID2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 2f), projectile.width + 2, projectile.height + 2, mod.DustType("DustName"), projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 20, default(Color), 2.9f);
Main.dust[DustID2].noGravity = true;

projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, {double}projectile.velocity.X) + 1.57f;
projectile.localAI[0] += 1f;
projectile.alpha = (int)projectile.localAI[0] * 2;

if (projectile.localAI[0] > 130f)
{
projectile.Kill();
}
}
public override bool PreDraw(SpriteBatch sb, Color lightColor)
{
projectile.frameCounter++;
if (projectile.frameCounter >= 10)
{
projectile.frame++;
projectile.frameCounter = 0;
if (projectile.frame > 3)
projectile.frame = 0;
}
return true;
}
)
)
 
everything worked properly, but when i wanted to reload my mod this happend

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


this is the actual sentry code

using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameInput;

namespace customsentry.Items
{
public class customsentry : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("customsentry");
Tooltip.SetDefault("This is a modded sword.");
}
public override void SetDefaults()
{
item.damage = 60; //The damage stat for the Weapon.
item.mana = 20; //this defines how many mana this weapon use
item.width = 56; //The size of the width of the hitbox in pixels.
item.height = 56; //The size of the height of the hitbox in pixels.
item.useTime = 25; //How fast the Weapon is used.
item.useAnimation = 25; //How long the Weapon is used for.
item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing for example
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 2.5f; //The knockback stat of your Weapon.
item.value = Item.buyPrice(0, 10, 0, 0); // How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 10gold)
item.rare = 8; //The color the title of your Weapon when hovering over it ingame
item.UseSound = SoundID.Item44; //The sound played when using your Weapon
item.autoReuse = true; //Weather your Weapon will be used again after use while holding down, if false you will need to click again after use to use it again.
item.shoot = mod.ProjectileType("CustomSentryProj"); //This defines what type of projectile this weapon will shot
item.summon = true; //This defines if it does Summon damage and if its effected by Summon increasing Armor/Accessories.
item.sentry = true; //tells the game that this is a sentry
}

public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 SPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY); //this make so the projectile will spawn at the mouse cursor position
position = SPos;
for (int l = 0; l < Main.projectile.Length; l++)
{ //this make so you can only spawn one of this projectile at the time,
Projectile proj = Main.projectile[l];
if (proj.active && proj.type == item.shoot && proj.owner == player.whoAmI)
{
proj.active = false;
}
}
return true;
}
}
}

change it if is necesary

You need to name the png file customsentry, and have it in the same folder as the .cs file.
 
Back
Top Bottom