tModLoader Official tModLoader Help Thread

it might actually be the world, but i havent confirmed this yet, and it's probably not however after doing this i didn't get the glitch once, enabling each mod one by one from no mods at all seemed to do the trick even tho i didnt end up disabling any of the mods, so whatever, hopefully this will work for however long, and then ill just disable them all and re enable them when the glitch comes back or not
[doublepost=1535166744,1535166480][/doublepost]nevermind it didn't work at all im just freakin deleting this character or world or something i cant take this stupid glitch, the problem litaretely only reappered after all the mods were enabled, but if i..... i dont know i just give up this playthrough
 
I got this error while playing multiplayer with the Terraria Overhaul mod.

It appears in-game, and nothing seems to be wrong when it does, but it's obnoxious for both me and my friends. It pops up constantly and we'd like to fix it.

My log.txt: https://pastebin.com/RZLcBrjg Most of it is an error with connection, but there's one about Unicorn AI in there as well. Could anyone help me get rid of this?
 

Attachments

  • Error.PNG
    Error.PNG
    20.8 KB · Views: 180
Okay. I am at my wits end. I can no longer use Tmodloader.
IT literally violently explodes and claims Out of Memory when It's about to finish adding recipes.
I really need to know why the coding makes itneeds 32 GBs of RAM just to load the modloader program itself.
IT is insanely unstable, andi t makes no sense.
It out of memory fails while loading anything now. Can't even launch it.
I physically can't even launch it now because it violently explodes as soon as it tries to do anything!
This makes no sense! I have 8 GB of Ram. THAT should make this program run fine.
Why is it so impossible to run it?
I just want to play with Mods! I shouldn't need a Quantum Computer to run Tmodloader. And I most certainly shouldn't need 32 GB of RAM!

Please, someone help me figure out why it cannot work with any kind of mod collection at all because it needs infinite amount of memory?
Why can't it take up less memory?
Why?!

I'm going crazy because it seems like it just is completely unstable and refuses to work for me and me alone, of all the people in the whole world!
That's how insane this is!
Pleae help me!

I can't fathom why it needs so much ram just to load mod information? Is the program limited in such a major way that it eats all Memory? No matter how much you have? Because it should not violently explode when it reaches 3.4 GB usage on the Task Manager. Heck, it shouldn't even reach that much, but maybe Terraria did that when generating larger worlds.
 
I need help. I dont know whats not ok with my data the error codes are in german so I think it would be better if someone that can write german would respond. here iare the error codes:

Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei ExampleMod.Mounts.BuckysMotorcycle.SetDefaults() in c:\Users\sofia\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod\Mounts\Buckysmotorcycle.cs:Zeile 57.
bei Terraria.ModLoader.ModMountData.SetupMount(MountData mountData)
bei Terraria.ModLoader.MountLoader.SetupMount(MountData mount)
bei Terraria.ModLoader.Mod.SetupContent()
bei Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

And here is my mount file for my mod:

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

namespace ExampleMod.Mounts
{
public class BuckysMotorcycle : ModMountData
{
public override void SetDefaults ()
{
mountData.spawnDust = mod.DustType("AdvancedDust");
mountData.buff = mod.BuffType("WintersoldiersMadness");
mountData.heightBoost = 20; //how high is the mount from the ground
mountData.fallDamage = 0.5f;
mountData.runSpeed = 16f;
mountData.dashSpeed = 11f;
mountData.flightTimeMax = 50;
mountData.fatigueMax = 0;
mountData.jumpHeight = 6;
mountData.acceleration = 0.27f;
mountData.jumpSpeed = 5f;
mountData.blockExtraJumps = true;
mountData.totalFrames = 4; //mount frame/animation
mountData.constantJump = false;
int[] array = new int[mountData.totalFrames];
for (int l = 0; l < array.Length; l++)
{
array[l] = 1;
}
mountData.playerYOffsets = array;
mountData.xOffset = 13;
mountData.yOffset = -3; //how high is the mount from the player
mountData.bodyFrame = 1; //player frame when it's on the mount
mountData.playerHeadOffset = 22;
mountData.standingFrameCount = 4;
mountData.standingFrameDelay = 12;
mountData.standingFrameStart = 1;
mountData.runningFrameCount = 4;
mountData.runningFrameDelay = 12;
mountData.runningFrameStart = 1;
mountData.flyingFrameCount = 0;
mountData.flyingFrameDelay = 0;
mountData.flyingFrameStart = 0;
mountData.inAirFrameCount = 1;
mountData.inAirFrameDelay = 12;
mountData.inAirFrameStart = 1;
mountData.idleFrameCount = 4;
mountData.idleFrameDelay = 12;
mountData.idleFrameStart = 0;
mountData.idleFrameLoop = true;
mountData.swimFrameCount = mountData.inAirFrameCount;
mountData.swimFrameDelay = mountData.inAirFrameDelay;
mountData.swimFrameStart = mountData.inAirFrameStart;
if (Main.netMode != 2)
{
mountData.textureWidth = mountData.frontTexture.Width + 20;
mountData.textureHeight = mountData.frontTexture.Height +20;
}
}

public override void UpdateEffects(Player player)
{
if (Math.Abs(player.velocity.X) > 4f)
{
Rectangle rect = player.getRect();
Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, mod.DustType("AdvancedDust"));
}
}
}
}
 
I am currently trying to make a modded armor set that has a set bonus which lets you shoot projectiles when taking damage, but I don't know how to make the set bonus do that.
In one of the pieces of armour:
Code:
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Shoots projectiles");
                        player.GetModPlayer<ModPlayerFile>(mod).onHitProj= true;
                 }
In your ModPlayer file:
Code:
               public bool onHitProj = false;

               public override void ResetEffects()
               {
                         onHitProj= false;
               }
               public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            if(onHitProj == true)
            {
                Projectile.NewProjectile(...);
            }
            return base.PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource);
        }
Hope that helps :)
[doublepost=1535911288,1535910850][/doublepost]
Alright, so I am making a mod, and I need to know if this... works? The problem is that at the bottom, it says vector two, and I need that fixed.
Can anyone help me? (Yes I'm a nub at this kind of stuff)
Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace FuryMod.Projectiles
{
    public class FireBolt : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("FireBolt");     //The English name of the projectile
            ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;    //The length of old position to be recorded
            ProjectileID.Sets.TrailingMode[projectile.type] = 0;        //The recording mode
        }

        public override void SetDefaults()
        {
            projectile.width = 8;               //The width of projectile hitbox
            projectile.height = 8;              //The height of projectile hitbox
            projectile.aiStyle = 1;             //The ai style of the projectile, please reference the source code of Terraria
            projectile.friendly = true;         //Can the projectile deal damage to enemies?
            projectile.hostile = false;         //Can the projectile deal damage to the player?
            projectile.magic = true;           //Is the projectile shoot by a ranged weapon?
            projectile.penetrate = 5;           //How many monsters the projectile can penetrate. (OnTileCollide below also decrements penetrate for bounces as well)
            projectile.timeLeft = 6000;          //The live time for the projectile (60 = 1 second, so 600 is 10 seconds)
            projectile.alpha = 255;             //The transparency of the projectile, 255 for completely transparent. (aiStyle 1 quickly fades the projectile in)
            projectile.light = 0.5f;            //How much light emit around the projectile
            projectile.ignoreWater = false;          //Does the projectile's speed be influenced by water?
            projectile.tileCollide = true;          //Can the projectile collide with tiles?
            projectile.extraUpdates = 20;            //Set to above 0 if you want the projectile to update multiple time in a frame
            aiType = ProjectileID.WaterBolt;           //Act exactly like default Bullet
        }

        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            //If collide with tile, reduce the penetrate.
            //So the projectile can reflect at most 5 times
            projectile.penetrate--;
            if (projectile.penetrate <= 0)
            {
                projectile.Kill();
            }
            else
            {
                if (projectile.velocity.X != oldVelocity.X)
                {
                    projectile.velocity.X = -oldVelocity.X;
                }
                if (projectile.velocity.Y != oldVelocity.Y)
                {
                    projectile.velocity.Y = -oldVelocity.Y;
                }
                Main.PlaySound(SoundID.Item10, projectile.position);
            }
            return false;
        }
    }
}
[doublepost=1534989664,1534989600][/doublepost]
Oh yeah, also this is the last thing, please somebody help me (I really need it)

You'll need to add:
using Terraria;
using Microsoft.Xna.Framework;

Hope that helps :)
 
1. How do i make a jackhammer that copies a hammer's perfomance? Please make and paste the code here. (i dont know NOTHING in C)
2. How to make a glowmask for a tool?
 
In one of the pieces of armour:
Code:
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Shoots projectiles");
                        player.GetModPlayer<ModPlayerFile>(mod).onHitProj= true;
                 }
In your ModPlayer file:
Code:
               public bool onHitProj = false;

               public override void ResetEffects()
               {
                         onHitProj= false;
               }
               public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            if(onHitProj == true)
            {
                Projectile.NewProjectile(...);
            }
            return base.PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource);
        }
Hope that helps :)
[doublepost=1535911288,1535910850][/doublepost]

You'll need to add:
using Terraria;
using Microsoft.Xna.Framework;

Hope that helps :)
Thanks, adding that now (It is taking a long time I have a slow computer lol)
 
Well, my first mod and already I feel like I'm biting off more than I can chew.
I'm wanting to create a set of accessories for my mod, which so far I'm doing alright with, but I have a few questions related to debuffs that they'd apply.
How would I make it so that an accessory would slow down the player by a set amount when equipped (like being over-encumbered in skyrim)? And, is it possible to make the accessory apply knockback to the player, the amount applied being determined by the damage taken in a hit?
My issue is really that, once again, this is my first mod, and really my first experience in c#.
 
I am currently making a mod called 'Draconian Mod', but when I try to build the latest version, an error pops up saying "c:\Users\User\Documents\My Games\Terraria\ModLoader\Mod Sources\DraconianMod\VanillaItemRecipes.cs(10,11) : error CS0101: The namespace 'DraconianMod' already contains a definition for 'DraconianMod'

Here is the code for the location of the error:
using System;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace DraconianMod
{
class DraconianMod : Mod
{
public DraconianMod()
{
Properties = new ModProperties()
{
Autoload = true,
AutoloadGores = true,
AutoloadSounds = true
};
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.IronBar, 5);
recipe.AddIngredient(ItemID.Silk, 10);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(ItemID.RocketBoots);
recipe.AddRecipe();

recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.ChlorophyteBar, 18);
recipe.AddIngredient(ItemID.BeetleHusk, 6);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(ItemID.Picksaw);
recipe.AddRecipe();
}
}
}
Check all your files; There might be another file with public DraconianMod() in it that’s causing the issue.
 
Well, my first mod and already I feel like I'm biting off more than I can chew.
I'm wanting to create a set of accessories for my mod, which so far I'm doing alright with, but I have a few questions related to debuffs that they'd apply.
How would I make it so that an accessory would slow down the player by a set amount when equipped (like being over-encumbered in skyrim)? And, is it possible to make the accessory apply knockback to the player, the amount applied being determined by the damage taken in a hit?
My issue is really that, once again, this is my first mod, and really my first experience in c#.

For slowing the player, I think you would just do player.velocity * 0.5 (that would half it, replace with whatever) in your UpdateAccessory(...) hook. As for the knockback, I can't really help with that, sorry. Good concept idea, though.
Hope that helps, anyway :)
 
For slowing the player, I think you would just do player.velocity * 0.5 (that would half it, replace with whatever) in your UpdateAccessory(...) hook. As for the knockback, I can't really help with that, sorry. Good concept idea, though.
Hope that helps, anyway :)
It did end up helping, it lead me to the code in the terraria game files to find the moveSpeed variable (or whatever you call it here, I'm too used to Python) :p So thanks!

I do have a string of questions now though.. The first one being, how would you create an item with damage reduction? The mod itself is for adding a whole load of shields into the game, and I've currently got them adding defense, but I do realise it's much better to have damage reduction instead. Plus, this would end up helping with finding a way to make knockback apply to the player for a mechanic I want, as it'd factor in the damage you take which I could find from a damage reduction calculation.
 
So I've been trying to download tModLoader for two days, and when I use the installer, I get this message

Installation of a provisioning package failed
Please work with the package author to diagnose the issue
Error Code 0x80070057

if I manually install it, nothing happens. It's just normal Terraria.

As far as I've looked, I've never seen this problem with anyone else.
 
To install manually you need to take EVERYTHING from the zip file into C:program Files(or Program Files x86, depends on computer(i think))/Steam/steamapps/common/Terraria/ --Side note I accedently made an emogee icon
[doublepost=1537132745,1537132532][/doublepost]MY QUESTION: How do you code a point simular to dungeon, where you find an npc there, and when he moves in, he has to live at that one spot only
 
Hewwo, I'm trying to "code" a melee projectile. The melee work, projectile pops up, the only problem is that, the projectile is just /there/.

The projectile phases through enemies, doesn't do much except fly away..
Can anyone show me a script I can reference to?

My current script:

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

namespace YinBlade.Projectiles
{

public class Lightning : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Lightning");
projectile.width = 200;
projectile.height = 200;
projectile.friendly = true;
projectile.melee = true;
projectile.tileCollide = true;
projectile.penetrate = -1;
projectile.timeLeft = 200;
projectile.light = 20f;
projectile.extraUpdates = 1;
projectile.ignoreWater = true;
}
public override void AI()
{
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 90f;
}
}
}
 
Last edited:
I need help, My friend keeps joining and when he joins his character is frozen.

Hewwo, I'm trying to "code" a melee projectile. The melee work, projectile pops up, the only problem is that, the projectile is just /there/.

The projectile phases through enemies, doesn't do much except fly away..
Can anyone show me a script I can reference to?

My current script:

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

namespace YinBlade.Projectiles
{

public class Lightning : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Lightning");
projectile.width = 200;
projectile.height = 200;
projectile.friendly = true;
projectile.melee = true;
projectile.tileCollide = true;
projectile.penetrate = -1;
projectile.timeLeft = 200;
projectile.light = 20f;
projectile.extraUpdates = 1;
projectile.ignoreWater = true;
}
public override void AI()
{
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 90f;
}
}
}
projectile.penetrate = -1;?
Try setting that to at least 1
 
projectile.penetrate = -1;?
Try setting that to at least 1
Nothing yet, it still phases through entities, tiles causes them to disappear which I pressume is normal.. although I have tried tileCollide = false but didn't work.

Here's my sword script:

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

namespace YinBlade.Items.Weapons
{
public class YinBlade : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Yin Blade");
Tooltip.SetDefault("Yin or Yang or a path of nonexistence.. or Fluffiness.");
}

public override void SetDefaults()
{
item.damage = 199;
item.melee = true;
item.width = 64;
item.height = 64;
item.useTime = 1;
item.useAnimation = 5;
item.useStyle = 1;
item.knockBack = 10;
item.value = 1000;
item.rare = 13;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.scale = 3;
item.shoot = mod.ProjectileType("Lightning");
item.shootSpeed = 10f;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(2, 999);
recipe.AddTile(18);
recipe.SetResult(this);
recipe.AddRecipe();
}

public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(3) == 0)
{
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("Sparkle"));
}
}

public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Electrified, 21600);
}
}
}
 
Back
Top Bottom