tModLoader Official tModLoader Help Thread

Now there is another problem after i added it to the weapon(i eliminated it from the projectile)
View attachment 329464

this is the code of the weapon
C#:
using System;
using Terraria;
using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
namespace MySword.Items
{
    public class TrueFomalhautEx : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("True Fomalhaut");
            Tooltip.SetDefault("7200% Fire DMG (Magic). Increases own DMG by 50% for 2s.");
        }

        public override void SetDefaults()
        {
            item.buffType = 159;
            item.buffTime = 120;
            item.magic = true;
            item.noMelee = true;
            item.damage = 250;
            item.useStyle = 5;
            item.useTime = 5;
            item.useAnimation = 5;
            item.knockBack = 2;
            item.value = 5000;
            item.rare = -12;
            item.UseSound = SoundID.Item1;
            item.autoReuse = true;
            item.width = 64;
            item.height = 64;
            item.mana = 15;
            item.scale = 0.33f;

            item.shoot = item.shoot = mod.ProjectileType("ExProcyonBlast");
            item.shootSpeed = 1f;
        }

        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Projectile.NewProjectile(position.x + velocity.x * multiplier, position.y + velocity.y * multiplier, speedX, speedY, type, damage, knockBack, player.whoAmI);
            return false;
        }

        public override void AddRecipes()
        {
            ModRecipe TrueFomalhautExrecipe = new ModRecipe(mod);
            TrueFomalhautExrecipe.AddIngredient(2, 1);
            TrueFomalhautExrecipe.AddIngredient(29, 1);
            TrueFomalhautExrecipe.AddIngredient(22, 10);
            TrueFomalhautExrecipe.AddIngredient(65, 3);
            TrueFomalhautExrecipe.AddIngredient(19, 5);

            TrueFomalhautExrecipe.AddTile(17);
            TrueFomalhautExrecipe.SetResult(this);
            TrueFomalhautExrecipe.AddRecipe();
        }
    }
}[/CODE=csharp]
Set it to "position.X" and "velocity.X" and "position.Y" and "velocity.Y" instead of ".x" and ".y"

my mistake, sorry
 
Hey everyone, I'm fairly new to Terraria modding and today I ran into an issue I couldn't find a forum or answer for. The issue was not a visible code error, but it occured when I clicked "build and reload" on my mod.

C#:
[Thread Pool Worker/ERROR] [tML]: Value cannot be null.
Parameter name: document
System.ArgumentNullException: Value cannot be null.
Parameter name: document
  at Mono.Cecil.Cil.SequencePoint..ctor (Int32 offset, Document document) [0x00009] in data-0x7fa7d235e000
  at Mono.Cecil.SignatureReader.ReadSequencePoints (Document document) [0x000f9] in data-0x7fa7d235e000
  at Mono.Cecil.MetadataReader.ReadSequencePoints (MethodDefinition method) [0x0004e] in data-0x7fa7d235e000
  at Mono.Cecil.Cil.PortablePdbReader.ReadSequencePoints (MethodDebugInformation method_info) [0x00000] in data-0x7fa7d235e000
  at Mono.Cecil.Cil.PortablePdbReader.Read (MethodDefinition method) [0x00007] in data-0x7fa7d235e000
  at Mono.Cecil.ImmediateModuleReader.ReadMethodsSymbols (TypeDefinition type, ISymbolReader symbol_reader) [0x0003d] in data-0x7fa7d235e000
  at Mono.Cecil.ImmediateModuleReader.ReadTypesSymbols (Collection[T] types, ISymbolReader symbol_reader) [0x00029] in data-0x7fa7d235e000
  at Mono.Cecil.ImmediateModuleReader.ReadTypesSymbols (Collection[T] types, ISymbolReader symbol_reader) [0x0001b] in data-0x7fa7d235e000
  at Mono.Cecil.ImmediateModuleReader.ReadSymbols (ModuleDefinition module) [0x00010] in data-0x7fa7d235e000
  at Mono.Cecil.ModuleWriter.Write (ModuleDefinition module, Disposable[T] stream, WriterParameters parameters) [0x00039] in data-0x7fa7d235e000
  at Mono.Cecil.ModuleWriter.WriteModule (ModuleDefinition module, Disposable[T] stream, WriterParameters parameters) [0x00002] in data-0x7fa7d235e000
  at Mono.Cecil.ModuleDefinition.Write (String fileName, WriterParameters parameters) [0x00017] in data-0x7fa7d235e000
  at Mono.Cecil.AssemblyDefinition.Write (String fileName, WriterParameters parameters) [0x00000] in data-0x7fa7d235e000
  at Terraria.ModLoader.Core.ModCompile.BuildModForPlatform (BuildingMod mod, Boolean xna) [0x0025d] in tModLoader.exe
  at Terraria.ModLoader.Core.ModCompile.Build (BuildingMod mod) [0x000d0] in tModLoader.exe
  at Terraria.ModLoader.Core.ModCompile.Build (String modFolder) [0x00008] in tModLoader.exe
  at Terraria.ModLoader.UI.UIBuildMod+<>c__DisplayClass5_0.<Build>b__0 (ModCompile mc) [0x00000] in tModLoader.exe
  at Terraria.ModLoader.UI.UIBuildMod.BuildMod (Action[T] buildAction, Boolean reload) [0x0003a] in tModLoader.exe

The code itself is:

C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.World.Generation;
using Terraria.GameContent.Generation;

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

using System.Collections.Generic;
using System.IO;

namespace HollowKnightContent
{

    public class HallownestWorld : ModWorld
    {

        #region Generation

        public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
        {
            int shiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
            if(shiniesIndex != -1)
            {
                tasks.Insert(shiniesIndex + 1, new PassLegacy("Pale Ore Spawn", GeneratePaleOre));
            }
        }

        private void GeneratePaleOre(GenerationProgress progress)
        {
            progress.Message = "Conjuring Pale Ore";
            for (var i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); i++)
            {
                int x = WorldGen.genRand.Next(200, Main.maxTilesX - 200);
                int y = WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY - 500);

                WorldGen.TileRunner(x, y, WorldGen.genRand.Next(1, 3), WorldGen.genRand.Next(3, 6),
                    ModContent.TileType<Tiles.PaleOre.PaleOre>());
            }
        }

        #endregion
    }
}

Thanks in advance :D
 
Hi Terraria forums,

After hours of trying to self-diagnose to no avail, I'm coming here with a couple glaring issues running tModLoader:

1. tModLoader suffers from abnormally low framerates.

I run a GTX 1070 and an i5-11400. Running Terraria 1.4 at 1440p fullscreen, I don't dip below 144 fps. However, running tModLoader at 1440p fullscreen, I'm sitting around 60-70 fps without ANY mods. These numbers are coming after a fresh reinstall of Windows so I don't believe there's any external conflict there.

The one significant difference between the two is that running Task Manager in the background, I've noticed that Terraria utilizes only 20% of my GPU / 15 - 20% CPU while in-game and tModLoader utilizes 80% of the GPU / <10% CPU. If I had to guess this is very much related to the framerate issue, but I don't have the expertise to figure out how or why. I've tried changing the priority of the executable in Task Manager with no change in performance. The framerate in tModLoader increases when switching to 1080p but it still does not reach 144hz in any scene, so framerate does scale based on resolution as it should. If I had to make any guesses it has something to do with the tModLoader code and *potentially* compatibility with my brand new 11400 CPU, but that's all I can think of. Any help there?

2. tModLoader running with Calamity - No Music, Calamity - Music, Cataclysm, Magic Storage, and Boss Checklist (all to-date) CTDs at random at every stage of the game:

I've supplied the client.log from the most recent crash. I crashed three times in short succession just after joining my friend's server.

Playing with two friends in a multiplayer server hosted by one of them, since we have started playing I have crashed at random with increasing frequency especially after entering Hardmode. It happens no matter what I'm doing but is especially problematic during boss battles. When tModLoader crashes like this it's always 1. the screen freezes, 2. the audio cuts out/glitches and repeats, 3. the entire screen turns black (even if I'm playing in a small window), and 4. the screen returns and the executable has either closed or continues functioning, only to eventually CTD, returning no crash log. If a YouTube video is playing in the background I've noticed that the video there sometimes turns a blank green, like my entire computer briefly crashes. To note, neither of my friends have crashed a single time, leading me to believe that my issue is entirely unique to my computer and could possibly be related to the framerate issue.

I've supplied all the info I can think of but if requested I can try to supply more. If anyone out there can help me out that would be greatly appreciated!
 

Attachments

  • client.log
    15.6 KB · Views: 67
Last edited:
Hello. I am currently creating an NPC for the first time using code from the ExampleMod. I am receiving multiple errors in my code, which is as follows:

using PogMod.Items.Banners;
using PogMod.Projectiles;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace PogMod.NPCs
{
//ported from my tAPI mod because I'm lazy
public class YouthTwinklefish : ModNPC
{
public YouthTwinklefish() {
speed = 1f;
speedY = 1f;
acceleration = 0.05f;
accelerationY = 0.05f;
idleSpeed = 0.5f;
bounces = false;
}

public override void SetStaticDefaults() {
DisplayName.SetDefault("Youth Twinklefish");
}
public override void SetDefaults() {
npc.lifeMax = 200;
npc.damage = 90;
npc.defense = 0;
npc.knockBackResist = -0.1f;
npc.width = 26;
npc.height = 26;
npc.aiStyle = 14;
npc.noGravity = true;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
npc.value = Item.buyPrice(0, 0, 15, 0);
npc.hide = true;
banner = npc.type;
bannerItem = ModContent.ItemType<YouthTwinklefishBanner>();
}
public override void FindFrame(int frameHeight) {
npc.frame.Y = 0;
npc.rotation = 0f;
}


public override float SpawnChance(NPCSpawnInfo spawnInfo) {
return !spawnInfo.playerSafe ? SpawnCondition.HardmodeOceanMonster.Chance * 0.5f : 0f;
}
}
}

The area in my code with the issues is colored yellow. The issues are all the same; the names of all the variables do not exist in the current context. Here are the error messages:

[11:33:36] [Thread Pool Worker/ERROR] [tML]: /Users/patrickpowers/Library/Application Support/Terraria/ModLoader/Mod Sources/PogMod/NPCs/YouthTwinklefish.cs(15,3) : error CS0103: The name 'speed' does not exist in the current context
[11:33:36] [Thread Pool Worker/ERROR] [tML]: /Users/patrickpowers/Library/Application Support/Terraria/ModLoader/Mod Sources/PogMod/NPCs/YouthTwinklefish.cs(16,12) : error CS0103: The name 'speedY' does not exist in the current context
[11:33:36] [Thread Pool Worker/ERROR] [tML]: /Users/patrickpowers/Library/Application Support/Terraria/ModLoader/Mod Sources/PogMod/NPCs/YouthTwinklefish.cs(17,3) : error CS0103: The name 'acceleration' does not exist in the current context
[11:33:36] [Thread Pool Worker/ERROR] [tML]: /Users/patrickpowers/Library/Application Support/Terraria/ModLoader/Mod Sources/PogMod/NPCs/YouthTwinklefish.cs(18,12) : error CS0103: The name 'accelerationY' does not exist in the current context
[11:33:36] [Thread Pool Worker/ERROR] [tML]: /Users/patrickpowers/Library/Application Support/Terraria/ModLoader/Mod Sources/PogMod/NPCs/YouthTwinklefish.cs(19,3) : error CS0103: The name 'idleSpeed' does not exist in the current context
[11:33:36] [Thread Pool Worker/ERROR] [tML]: /Users/patrickpowers/Library/Application Support/Terraria/ModLoader/Mod Sources/PogMod/NPCs/YouthTwinklefish.cs(20,3) : error CS0103: The name 'bounces' does not exist in the current context

Thank you for reading my issue. I hope you will be able to assist me in fixing my code.
 
Hello. I am currently creating an NPC for the first time using code from the ExampleMod. I am receiving multiple errors in my code, which is as follows:...
It says speed, speedY, acceleration, accelerationY, and idleSpeed do not exist.
You'll have to add either bool, int, float, ect when setting the variables, since they do not exist outside the NPC.
Like this:
Code:
public YouthTwinklefish()
{
    float speed = 1f;
    float speedY = 1f;
    float acceleration = 0.05f;
    float accelerationY = 0.05f;
    float idleSpeed = 0.5f;
    bool bounces = false;


It should also be mentioned, I don't think the YouthTwinklefish() function will ever be called, assuming no external files call on it.
For the variable setting, I'd recommend just removing it. (Unless I'm wrong, in that case just ignore this part)
Code:
namespace PogMod.NPCs
{
    float speed = 1f;
    float speedY = 1f;
    float acceleration = 0.05f;
    float accelerationY = 0.05f;
    float idleSpeed = 0.5f;
    bool bounces = false;
    public override void SetStaticDefaults() 
    {
       DisplayName.SetDefault("Youth Twinklefish");
    }
     //ect
 
It says speed, speedY, acceleration, accelerationY, and idleSpeed do not exist.
You'll have to add either bool, int, float, ect when setting the variables, since they do not exist outside the NPC.
Like this:
Code:
public YouthTwinklefish()
{
    float speed = 1f;
    float speedY = 1f;
    float acceleration = 0.05f;
    float accelerationY = 0.05f;
    float idleSpeed = 0.5f;
    bool bounces = false;


It should also be mentioned, I don't think the YouthTwinklefish() function will ever be called, assuming no external files call on it.
For the variable setting, I'd recommend just removing it. (Unless I'm wrong, in that case just ignore this part)
Code:
namespace PogMod.NPCs
{
    float speed = 1f;
    float speedY = 1f;
    float acceleration = 0.05f;
    float accelerationY = 0.05f;
    float idleSpeed = 0.5f;
    bool bounces = false;
    public override void SetStaticDefaults()
    {
       DisplayName.SetDefault("Youth Twinklefish");
    }
     //ect
Thanks for the assistance! My code now works.
 
Collision.SolidCollision is a function. I don't know exactly what you mean by get a variable from one method and use it in another, but what I was suggesting you do is something like the following.
C#:
if (Collision.SolidCollision(npc.position, npc.width, npc.height))
{
    //do the thing
}
That should return true if your NPC is colliding with anything.
Apologies, I mistakenly thought that it was a separate method/function/hook by itself. I will take your advice, thanks!
EDIT: It actually worked, thank you for the advice!
 
Last edited:
Say that I wanted to create a throwing weapon, a bomb, that when it explodes, would rain down a few projectiles to it's position. Does anyone know how to do this?

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using NexusMod.Projectiles;

namespace NexusMod.Items.Weapons.Assassin
{
internal class CometDecimator : ModItem
{
public override void SetStaticDefaults()
{
base.SetStaticDefaults();
DisplayName.SetDefault("Comet Decimator");
ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[item.type] = true;
}

public override void SetDefaults()
{
item.useStyle = ItemUseStyleID.SwingThrow;
item.shootSpeed = 12f;
item.shoot = ModContent.ProjectileType<Projectiles.CometDecimator>();
item.width = 32;
item.height = 32;
item.maxStack = 1;
item.consumable = true;
item.UseSound = SoundID.Item1;
item.useAnimation = 40;
item.useTime = 40;
item.noUseGraphic = true;
item.noMelee = true;
item.value = Item.sellPrice(0, 0, 20, 0);
item.rare = ItemRarityID.Red;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<CometFragment>());
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using NexusMod.Items;

namespace NexusMod.Projectiles
{
// to investigate: Projectile.Damage, (8843)
internal class CometDecimator : ModProjectile
{
public override void SetDefaults() {
// while the sprite is actually bigger than 15x15, we use 15x15 since it lets the projectile clip into tiles as it bounces. It looks better.
projectile.width = 15;
projectile.height = 15;
projectile.friendly = true;
projectile.penetrate = -1;

projectile.timeLeft = 300;

drawOffsetX = 5;
drawOriginOffsetY = 5;
}

public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) {
// Vanilla explosions do less damage to Eater of Worlds in expert mode, so we will too.
if (Main.expertMode) {
if (target.type >= NPCID.EaterofWorldsHead && target.type <= NPCID.EaterofWorldsTail) {
damage /= 5;
}
}
}


public override void AI() {
if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) {
projectile.tileCollide = false;
// Set to transparent. This projectile technically lives as transparent for about 3 frames
projectile.alpha = 255;
// change the hitbox size, centered about the original projectile center. This makes the projectile damage enemies during the explosion.
projectile.position = projectile.Center;
//projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
//projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
projectile.width = 250;
projectile.height = 250;
projectile.Center = projectile.position;
//projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
//projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
projectile.damage = 250;
projectile.knockBack = 10f;
}
else {
// Smoke and fuse dust spawn.
if (Main.rand.NextBool()) {
int dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f);
Main.dust[dustIndex].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[dustIndex].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f;
dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f);
Main.dust[dustIndex].scale = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f;
}
}
projectile.ai[0] += 1f;
if (projectile.ai[0] > 5f) {
projectile.ai[0] = 10f;
// Roll speed dampening.
if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) {
projectile.velocity.X = projectile.velocity.X * 0.97f;
//if (projectile.type == 29 || projectile.type == 470 || projectile.type == 637)
{
projectile.velocity.X = projectile.velocity.X * 0.99f;
}
if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) {
projectile.velocity.X = 0f;
projectile.netUpdate = true;
}
}
projectile.velocity.Y = projectile.velocity.Y + 0.2f;
}
// Rotation increased by velocity.X
projectile.rotation += projectile.velocity.X * 0.1f;
return;
}

}
}

However, the popup below appears when I attempt to build and reload the mod. Any ideas why this is happening?
 

Attachments

  • Screenshot 2021-08-03 184245.png
    Screenshot 2021-08-03 184245.png
    230.2 KB · Views: 90
Say that I wanted to create a throwing weapon, a bomb, that when it explodes, would rain down a few projectiles to it's position. Does anyone know how to do this?

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using NexusMod.Projectiles;

namespace NexusMod.Items.Weapons.Assassin
{
internal class CometDecimator : ModItem
{
public override void SetStaticDefaults()
{
base.SetStaticDefaults();
DisplayName.SetDefault("Comet Decimator");
ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[item.type] = true;
}

public override void SetDefaults()
{
item.useStyle = ItemUseStyleID.SwingThrow;
item.shootSpeed = 12f;
item.shoot = ModContent.ProjectileType<Projectiles.CometDecimator>();
item.width = 32;
item.height = 32;
item.maxStack = 1;
item.consumable = true;
item.UseSound = SoundID.Item1;
item.useAnimation = 40;
item.useTime = 40;
item.noUseGraphic = true;
item.noMelee = true;
item.value = Item.sellPrice(0, 0, 20, 0);
item.rare = ItemRarityID.Red;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<CometFragment>());
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using NexusMod.Items;

namespace NexusMod.Projectiles
{
// to investigate: Projectile.Damage, (8843)
internal class CometDecimator : ModProjectile
{
public override void SetDefaults() {
// while the sprite is actually bigger than 15x15, we use 15x15 since it lets the projectile clip into tiles as it bounces. It looks better.
projectile.width = 15;
projectile.height = 15;
projectile.friendly = true;
projectile.penetrate = -1;

projectile.timeLeft = 300;

drawOffsetX = 5;
drawOriginOffsetY = 5;
}

public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) {
// Vanilla explosions do less damage to Eater of Worlds in expert mode, so we will too.
if (Main.expertMode) {
if (target.type >= NPCID.EaterofWorldsHead && target.type <= NPCID.EaterofWorldsTail) {
damage /= 5;
}
}
}


public override void AI() {
if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) {
projectile.tileCollide = false;
// Set to transparent. This projectile technically lives as transparent for about 3 frames
projectile.alpha = 255;
// change the hitbox size, centered about the original projectile center. This makes the projectile damage enemies during the explosion.
projectile.position = projectile.Center;
//projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
//projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
projectile.width = 250;
projectile.height = 250;
projectile.Center = projectile.position;
//projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
//projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
projectile.damage = 250;
projectile.knockBack = 10f;
}
else {
// Smoke and fuse dust spawn.
if (Main.rand.NextBool()) {
int dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1f);
Main.dust[dustIndex].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[dustIndex].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f;
dustIndex = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1f);
Main.dust[dustIndex].scale = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default(Vector2)) * 1.1f;
}
}
projectile.ai[0] += 1f;
if (projectile.ai[0] > 5f) {
projectile.ai[0] = 10f;
// Roll speed dampening.
if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) {
projectile.velocity.X = projectile.velocity.X * 0.97f;
//if (projectile.type == 29 || projectile.type == 470 || projectile.type == 637)
{
projectile.velocity.X = projectile.velocity.X * 0.99f;
}
if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) {
projectile.velocity.X = 0f;
projectile.netUpdate = true;
}
}
projectile.velocity.Y = projectile.velocity.Y + 0.2f;
}
// Rotation increased by velocity.X
projectile.rotation += projectile.velocity.X * 0.1f;
return;
}

}
}

However, the popup below appears when I attempt to build and reload the mod. Any ideas why this is happening?
I think that means that it can't find the image for your projectile.
 
I am trying to check if the WoF is defeated or if the game is the Hardmode, if anyone knows please reply!
The field is Main.hardMode.
I dont think there is a vanilla field for if the WoF was defeated other than just if the world is in hardmode (since they usually serve the same purpose anyway).

So for example,
Code:
if(Main.hardMode == true)
            {
                //code
            }
 
Developer mode isn't active yet there's no button to activate it
1628802621605.png

(how the game looks (no devmode in bottom right))
1628802690781.png

(what I see on mod sources page)
I've already tried multiple times updating the mod compile but no dice. Open to any suggestions.
 
Begin has been called before calling end after the last call to begin terriria error / XNA Framework error
Prehistory: we decided to play with a friend in a terraria with mods (there were a lot of mods), about 20 mods - 4 of them are large. As a result, the game started to crash, we decided all this by installing the 64-bit version of tmodloader. Played more than 30 hours and a new error appeared - begin has been called before calling end after the last call to begin terriria error. There were many ways to solve the problem on the Internet, but none of them helped. I reinstalled xna framework, net framework, installed the same versions as a friend's, whose game did not crash, despite the fact that his computer is much weaker. I deleted config.json, input profiles.json, reinstalled the game 2 times, turned off cloud saving, turned off mods - there was no point in this, the game still crashed. Computer configuration: ryzen 5 1600, radeon rx 570 series, 8 gb RAM (Yes, this is not enough, but a friend's game did not crash with the same amount of memory.) The drivers are new. Help me please.
Screenshot_7.png
unknown.png
 
Hiya can somebody help me, I have trouble on coding: I want to make my custom NPC to spawn after a custom event. I have been trying to do this using the Dungeon invasion event made by Sin Costan and the example person but when I code it in it doesn't spawn. Can somebody help me, am new at this :(
 
I have a few questions/comments for tModLoader:

1) Since last year I have been using a modified version of tModLoader 0.11.7.5 that will allow it to run my legitimate GOG.com copy of Terraria 1.3.5.3 on Windows 7. This has worked fine for me without any problems at all. I need to upgrade to a newer version of tModLoader because some of the mods I use require a newer version of tModLoader in order to be compatible with the mod updates. I have tested tModLoader 0.11.8.2 and it is not working. Here are the following log outputs for the working 0.11.7.5 and the not working 0.11.8.2. Has there been some new dependency for tModLoader in the updates after 0.11.7.5 that is required? What happens when I try to start the newer version of tModLoader now is that no window opens for the game and I see it in the task manager, but it never starts the game. I have tried reinstalling the game, moving the tModLoader folder, nothing seems to work. 0.11.7.5 works fine but 0.11.8.2 won't start the game. Please assist :(

[16:27:46] [1/INFO] [tML]: Starting tModLoader v0.11.7.5 Windows client (2/27/2021)
[16:27:46] [1/INFO] [tML]: Running on NetFramework 4.7.2
[16:27:46] [1/INFO] [tML]: Executable: C:\Games\Terraria\tModLoader\tModLoader.exe
[16:27:46] [1/INFO] [tML]: Working Directory: C:\Games\Terraria\tModLoader
[16:27:46] [1/INFO] [tML]: Launch Parameters:
[16:27:46] [1/DEBUG] [tML]: Assembly Resolve: -> MonoMod.RuntimeDetour, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null
[16:27:46] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null -> MonoMod.Utils, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null
[16:27:46] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null -> Mono.Cecil, Version=0.11.2.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e
[16:27:46] [1/DEBUG] [tML]: Assembly Resolve: -> Ionic.Zip.Reduced, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c
[16:27:46] [1/DEBUG] [tML]: Assembly Resolve: -> Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
[16:27:46] [1/INFO] [tML]: Checking GOG or manual installation...
[16:27:46] [1/INFO] [tML]: GOG or manual installation OK.
[16:27:46] [1/DEBUG] [tML]: Assembly Resolve: -> Steamworks.NET, Version=9.1.0.0, Culture=neutral, PublicKeyToken=null
[16:27:47] [1/DEBUG] [Terraria]: Graphics Device: Radeon (TM) RX 470 Graphics {Width:1920 Height:1080 Format:Color AspectRatio:1.777778}
[16:27:47] [1/DEBUG] [Terraria]: Device Reset, Profile: Reach -> HiDef, Width: 800, Height: 480, Fullscreen: False, Display: \\.\DISPLAY1
[16:27:48] [1/INFO] [Terraria]: Loaded 1000 vanilla assets
[16:27:48] [1/INFO] [Terraria]: Loaded 2000 vanilla assets
[16:27:48] [1/INFO] [Terraria]: Loaded 3000 vanilla assets
[16:27:48] [1/INFO] [Terraria]: Loaded 4000 vanilla assets
[16:27:48] [1/INFO] [Terraria]: Loaded 5000 vanilla assets
[16:27:49] [1/DEBUG] [Terraria]: Device Reset, Profile: HiDef, Width: 800 -> 1280, Height: 480 -> 720, Fullscreen: False -> True, Display: \\.\DISPLAY1
[16:27:50] [1/DEBUG] [Terraria]: Device Reset, Profile: HiDef, Width: 1280 -> 1920, Height: 720 -> 1080, Fullscreen: True, Display: \\.\DISPLAY1
[16:27:50] [6/WARN] [tML]: Silently Caught Exception:
System.EntryPointNotFoundException: Unable to find an entry point named 'EventSetInformation' in DLL 'advapi32.dll'.
at Microsoft.Win32.UnsafeNativeMethods.ManifestEtw.EventSetInformation(Int64 registrationHandle, EVENT_INFO_CLASS informationClass, Void* eventInformation, Int32 informationLength)
at System.Diagnostics.Tracing.EventProvider.SetInformation(EVENT_INFO_CLASS eventInfoClass, Void* data, Int32 dataSize)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(EventSourceSettings settings, String[] traits)
at System.Linq.Parallel.PlinqEtwProvider..cctor()
at System.Linq.Parallel.QuerySettings.WithPerExecutionSettings(CancellationTokenSource topLevelCancellationTokenSource, Shared`1 topLevelDisposedFlag)
at System.Linq.Parallel.ForAllOperator`1.RunSynchronously()
at System.Linq.ParallelEnumerable.ForAll[TSource](ParallelQuery`1 source, Action`1 action)
at Terraria.Program.ForceJITOnAssembly(IEnumerable`1 types)
at Terraria.Program.ForceLoadAssembly(Assembly assembly, Boolean initializeStaticMembers)
at Terraria.Program.ForceLoadThread(Object ThreadContext)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

[16:27:52] [8/DEBUG] [tML]: Assembly Resolve: -> MP3Sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[16:27:52] [8/DEBUG] [tML]: Assembly Resolve: -> NVorbis, Version=0.8.4.0, Culture=neutral, PublicKeyToken=null
[16:27:52] [8/DEBUG] [tML]: Assembly Resolve: -> Mono.Cecil.Mdb, Version=0.11.2.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e
[16:27:52] [8/DEBUG] [tML]: Assembly Resolve: -> Mono.Cecil.Pdb, Version=0.11.2.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e
[16:27:52] [6/INFO] [Terraria]: JIT loading finished
[16:27:54] [10/INFO] [tML]: Unloading mods
[16:27:55] [10/INFO] [tML]: Finding Mods...
[16:27:55] [10/INFO] [tML]: Sandboxing: ItemChecklist
[16:27:55] [10/INFO] [tML]: Sandboxing: SpiritMod
[16:27:55] [10/INFO] [tML]: Instantiating Mods...
[16:27:56] [10/INFO] [tML]: Initializing: ModLoader v0.11.7.5
[16:27:56] [10/INFO] [tML]: Initializing: ItemChecklist v0.5.2
[16:27:56] [10/INFO] [tML]: Initializing: SpiritMod v1.4.0.4
[16:27:58] [10/DEBUG] [tML]: Assembly Resolve: SpiritMod_0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -> TerrariaHooks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
[16:27:58] [10/DEBUG] [tML]: Assembly Resolve: TerrariaHooks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -> MonoMod.RuntimeDetour, Version=19.12.19.1, Culture=neutral, PublicKeyToken=null
[16:27:58] [10/WARN] [tML]: Upgraded Reference MonoMod.RuntimeDetour -> Version=19.12.19.1 -> 20.5.14.1
[16:27:58] [10/DEBUG] [tML]: Hook On.Terraria.Main::DrawProjectiles() added by SpiritMod_0
[16:27:58] [10/DEBUG] [tML]: Hook On.Terraria.Projectile::NewProjectile(float, float, float, float, int, int, float, int, float, float) added by SpiritMod_0
[16:27:58] [10/DEBUG] [tML]: Hook On.Terraria.Player::KeyDoubleTap(int) added by SpiritMod_0
[16:27:58] [10/DEBUG] [tML]: Hook On.Terraria.Main::DrawDust() added by SpiritMod_0
[16:27:58] [10/INFO] [tML]: Setting up...
[16:27:58] [10/INFO] [tML]: Loading: ModLoader v0.11.7.5
[16:27:58] [10/INFO] [tML]: Loading: ItemChecklist v0.5.2
[16:27:59] [10/INFO] [tML]: Loading: SpiritMod v1.4.0.4
[16:27:59] [10/INFO] [tML]: Adding Recipes...

[20:04:08] [1/INFO] [tML]: Starting tModLoader v0.11.8.2 Windows client (3/30/2021)
[20:04:08] [1/INFO] [tML]: Running on NetFramework 4.7.2
[20:04:08] [1/INFO] [tML]: Executable: C:\Games\Terraria\tModLoader\tModLoader.exe
[20:04:08] [1/INFO] [tML]: Working Directory: C:\Games\Terraria\tModLoader
[20:04:08] [1/INFO] [tML]: Launch Parameters:
[20:04:08] [1/DEBUG] [tML]: Assembly Resolve: -> MonoMod.RuntimeDetour, Version=20.11.16.1, Culture=neutral, PublicKeyToken=null
[20:04:08] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=20.11.16.1, Culture=neutral, PublicKeyToken=null -> MonoMod.Utils, Version=20.11.16.1, Culture=neutral, PublicKeyToken=null
[20:04:08] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=20.11.16.1, Culture=neutral, PublicKeyToken=null -> Mono.Cecil, Version=0.11.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e
[20:04:09] [1/DEBUG] [tML]: Assembly Resolve: -> Ionic.Zip.Reduced, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c
[20:04:09] [1/DEBUG] [tML]: Assembly Resolve: -> Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
[20:04:09] [1/INFO] [tML]: Checking GOG or manual installation...
[20:04:09] [1/INFO] [tML]: GOG or manual installation OK.
[20:04:09] [1/DEBUG] [tML]: Assembly Resolve: -> Steamworks.NET, Version=9.1.0.0, Culture=neutral, PublicKeyToken=null
[20:04:10] [1/DEBUG] [Terraria]: Graphics Device: Radeon (TM) RX 470 Graphics {Width:1920 Height:1080 Format:Color AspectRatio:1.777778}
[20:04:10] [1/DEBUG] [Terraria]: Device Reset, Profile: Reach -> HiDef, Width: 800, Height: 480, Fullscreen: False, Display: \\.\DISPLAY1

2) I enjoy 1.3.5.3 and have personal preferences regarding the since changes to the game that I would like to continue using this version of the game alongside tModLoader instead of changing to 1.4 in the future. Will tModLoader continue to work with 1.3.5.3 after the 1.4 version finally arrives? I try to keep strict archives of my game versions and mods so if there is some legitimate technical reason why mods shouldn't be able to work with 1.3.5.3 after tModLoader 1.4 comes out, I suppose I will have to just stick with those versions of the mods. Unless there is some way to keep using Terraria 1.3.5.3, which would be preferable :)

3) Frankly speaking, putting DRM into a mod is incredibly hostile to legitimate users and for those without the technical skills to remove it, I feel quite bad for them, such as other GOG owners like me. tModLoader has NEVER worked for my legitimately owned copy of Terraria without the necessary hack to remove the unnecessary DRM. It would be something that would be very appreciated to have officially removed in future versions of tModLoader. DRM is the most anti-user piece of technology that has ever existed and only serves to hurt legitimate users. Food for thought.

Just bumping my question four pages ago.
 
Back
Top Bottom