tModLoader Official tModLoader Help Thread

thank you!!
[doublepost=1514831392,1514830971][/doublepost]
and how would you insert insanely fast speed for a gun like the minishark?
If you download Example Mod, it's the uncompiled version, with all the folders, files, images, right there to see and resue freely. For this sort of question, I'd suggest you check out Example Gun. Example Gun has a lot of VERY useful commentary and ideas to explore. Then again, the mod in general does.

Again, I'd suggest having Visual Studio (VS does a lot of neat things that help you figure out problems and understand just what can go where), but, even if you just use something like Notepad++ to look through the mod's files, you'll find a TON of stuff to learn from! And I've put a link to TModLoader Wiki in my signature... it has both useful tools and a BUNCH of current tutorials!
 
Hello, we have some problems with our TMod server. Sometimes items disappear when I click on them in my inventory and the game performance is really bad, mostly under 20 FPS.

Our mods (all mods are up-to-date): https://my.mixtape.moe/cygbea.png

We are playing on the newest TMod version and newest Terraria version.

Graphics Card: GTX 1060
CPU: AMD FX-8320E (8 cores)
 
If you download Example Mod, it's the uncompiled version, with all the folders, files, images, right there to see and resue freely. For this sort of question, I'd suggest you check out Example Gun. Example Gun has a lot of VERY useful commentary and ideas to explore. Then again, the mod in general does.

Again, I'd suggest having Visual Studio (VS does a lot of neat things that help you figure out problems and understand just what can go where), but, even if you just use something like Notepad++ to look through the mod's files, you'll find a TON of stuff to learn from! And I've put a link to TModLoader Wiki in my signature... it has both useful tools and a BUNCH of current tutorials!
thank you, but within the example mod folder i didnt quite see a section for accessory equipables..
 
thank you, but within the example mod folder i didnt quite see a section for accessory equipables..
Not all of it is within more detailed folders, some of it is in the parent folder. If you just look in the Items folder, you can see documentation for a shield and some wings, for example.

Edit: Really, just take some time to explore Example Mod overall. Spending a while digging around in it can be VERY educational!
 
upload_2018-1-2_14-25-36.png


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

namespace MilitaryMod.Mounts
{
public class Tank : ModMountData
{
public override void SetDefaults()
{
mountData.spawnDust = mod.DustType("Smoke");
mountData.buff = mod.BuffType("TankMount");
mountData.heightBoost = 20;
mountData.fallDamage = 0f;
mountData.runSpeed = 5f;
mountData.dashSpeed = 3f;
mountData.flightTimeMax = 0;
mountData.fatigueMax = 0;
mountData.jumpHeight = 5;
mountData.acceleration = 0.05f;
mountData.jumpSpeed = 4f;
mountData.blockExtraJumps = false;
mountData.totalFrames = 4;
mountData.constantJump = false;
int[] array = new int[mountData.totalFrames];
for (int l = 0; l < array.Length; l++)
{
array[l] = 20;
}
mountData.playerYOffsets = array;
mountData.xOffset = 13;
mountData.bodyFrame = 6;
mountData.yOffset = -12;
mountData.playerHeadOffset = 12;
mountData.standingFrameCount = 4;
mountData.standingFrameDelay = 12;
mountData.standingFrameStart = 0;
mountData.runningFrameCount = 4;
mountData.runningFrameDelay = 12;
mountData.runningFrameStart = 0;
mountData.flyingFrameCount = 0;
mountData.flyingFrameDelay = 0;
mountData.flyingFrameStart = 0;
mountData.inAirFrameCount = 1;
mountData.inAirFrameDelay = 12;
mountData.inAirFrameStart = 0;
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.backTexture.Width + 20;
mountData.textureHeight = mountData.backTexture.Height;
}
}

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("Smoke"));
}
}
}
}


how can i change the position of the tank?
 
View attachment 190858

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

namespace MilitaryMod.Mounts
{
    public class Tank : ModMountData
    {
        public override void SetDefaults()
        {
            mountData.spawnDust = mod.DustType("Smoke");
            mountData.buff = mod.BuffType("TankMount");
            mountData.heightBoost = 20;
            mountData.fallDamage = 0f;
            mountData.runSpeed = 5f;
            mountData.dashSpeed = 3f;
            mountData.flightTimeMax = 0;
            mountData.fatigueMax = 0;
            mountData.jumpHeight = 5;
            mountData.acceleration = 0.05f;
            mountData.jumpSpeed = 4f;
            mountData.blockExtraJumps = false;
            mountData.totalFrames = 4;
            mountData.constantJump = false;
            int[] array = new int[mountData.totalFrames];
            for (int l = 0; l < array.Length; l++)
            {
                array[l] = 20;
            }
            mountData.playerYOffsets = array;
            mountData.xOffset = 13;
            mountData.bodyFrame = 6;
            mountData.yOffset = -12;
            mountData.playerHeadOffset = 12;
            mountData.standingFrameCount = 4;
            mountData.standingFrameDelay = 12;
            mountData.standingFrameStart = 0;
            mountData.runningFrameCount = 4;
            mountData.runningFrameDelay = 12;
            mountData.runningFrameStart = 0;
            mountData.flyingFrameCount = 0;
            mountData.flyingFrameDelay = 0;
            mountData.flyingFrameStart = 0;
            mountData.inAirFrameCount = 1;
            mountData.inAirFrameDelay = 12;
            mountData.inAirFrameStart = 0;
            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.backTexture.Width + 20;
                mountData.textureHeight = mountData.backTexture.Height;
            }
        }

        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("Smoke"));
            }
        }
    }
}


how can i change the position of the tank?
Maybe change the mountData.yOffset?
 
upload_2018-1-3_7-41-25.png

using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MilitaryMod.Items.Accessory
{
public class InfantryPatch : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("Infantry Mastery Patch");
}

public override void SetDefaults()
{
item.name = "InfantryPatch";
item.width = 10;
item.height = 14;
item.value = 10;
item.rare = 3;
item.accessory = true;
}
public override void AddRecipes() //How to craft this item
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Wood, 10); //you need 10 Wood
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}

public override void UpdateAccessory(Player player, bool hideVisual)
{

player.noFallDmg = true;
player.canRocket = true;
player.rocketTime = 1200;
player.rocketBoots = 1;
player.rocketTimeMax = 1200;
player.aggro += 300;
player.meleeCrit += 17;
player.meleeDamage += 0.22f;
player.meleeSpeed += 0.15f;
player.moveSpeed += 2.15f;
player.rangedCrit += 7;
player.rangedDamage += 0.16f;
player.maxMinions++;
player.minionDamage += 0.22f;
player.statManaMax2 += 60;
player.manaCost -= 0.15f;
player.magicCrit += 7;
player.magicDamage += 1.07f;
}
}
}

any ideas?
 
View attachment 190899
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MilitaryMod.Items.Accessory
{
    public class InfantryPatch : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("Infantry Mastery Patch");
        }

        public override void SetDefaults()
        {
            item.name = "InfantryPatch";
            item.width = 10;
            item.height = 14;
            item.value = 10;
            item.rare = 3;
            item.accessory = true;
        }
        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 10);   //you need 10 Wood
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
          
            player.noFallDmg = true;
            player.canRocket = true;
            player.rocketTime = 1200;
            player.rocketBoots = 1;
            player.rocketTimeMax = 1200;
            player.aggro += 300;
            player.meleeCrit += 17;
            player.meleeDamage += 0.22f;
            player.meleeSpeed += 0.15f;
            player.moveSpeed += 2.15f;
            player.rangedCrit += 7;
            player.rangedDamage += 0.16f;
            player.maxMinions++;
            player.minionDamage += 0.22f;
            player.statManaMax2 += 60;
            player.manaCost -= 0.15f;
            player.magicCrit += 7;
            player.magicDamage += 1.07f;
        }
    }
}

any ideas?
First, remove item.name. Secondly, add [ DisplayName.SetDeafault(“Infantry Patch”); ] (minus the brackets) to the SetStaticDefaults code. It should look like this:
Code:
[...]
  {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault(“Infantry Patch”);
            Tooltip.SetDefault("Infantry Mastery Patch");
        }
[...]
 
str=artign today one of my maps has stopped working, it says it cant load the map, so i click on load the backup, but when i do this it moves the backup map files into the recyling bin, anybody ahve any sugestions
 
I need help with my pickaxes. whats the code I put if I want it to have more range to it? like how the Laser Drill has +10 range, how do I add that?
 
Hi, sorry if this is the wrong place.

I'm trying to set up a modded server.. I tried it a few free ways... but no matter what I did my friends couldn't join when I could.. so I took the easy way out and rented a hosted server from plugpayplay.. but now I have no idea how I would get tmodloader onto the server with mods.. I tried sending a support ticket to the server hosts last night but they still haven't responded so trying here, any help would be much appreciated.
 
Hey guys, I'm really new to modding so I have a simple question here; can someone help me understand the way that a spear's speed (velocity) and distance are determined? Right now I'm trying to make a spear with a velocity of 5, and it's range is intended to be between that of The Rotted Fork and Dark Lance. Here are the lines of code that are important (at least I think), and what I THINK they do:
Code:
item.useAnimation = 24; //How long the spear appears to be out (even though this is invisible, it still holds out your character's hand)
item.useTime = 24; //How long it takes for the spear to be usable again, regardless of how much time it spent out
item.shootSpeed = 5f; //The velocity of the spear, or how fast it causes its projectile to move
And same for the projectile's .cs file:
Code:
public float movementFactor //Guessing that this is used as a factor to multiply by the velocity I wrote in the spear's .cs file?

        {
            get { return projectile.ai[0]; }
            set { projectile.ai[0] = value; }
        }

        public override void AI()
        {
            ...
            if (!projOwner.frozen)
            {
                if (movementFactor == 0f)
                {
                    movementFactor = 3f; //??? What would changing this number (and the two below as well) do? My guess is that this is initial velocity (although I thought that was specified in the actual spear's code)?
                    projectile.netUpdate = true;
                }
                if (projOwner.itemAnimation < projOwner.itemAnimationMax / 3)
                {
                    movementFactor -= 2.4f; //Velocity while the spear is moving out?
                }
                else
                {
                    movementFactor += 2.1f; //Velocity while the spear is returning?
                }
            }
            projectile.position += projectile.velocity * movementFactor;
            if (projOwner.itemAnimation == 0)
            {
                projectile.Kill();
            }
            ...
        }

In practice, my spear has a longer range than that of the Dark Lance, despite having a lower velocity. I'm assuming this is because my spear's movementFactor is higher than the Dark Lance's, but I can't see Dark Lance's value. Also, it seems like having a velocity of 3 and a movementFactor of 5 would have the same result as having those two numbers reversed. How can I make my spear have the right range that I'm looking for; which numbers should I change, and to what? Thank you in advance.
 
Im making an accessory and it combines the Master Ninja Gear and the Ninja Armor. I want it to summon a pet that flies above the player(and does nothing, this is just vanity) while it is equipped. It would be like the Hoardagron pet. How would I do this
Also how do I make wall sliding/jumping possible?
 
Last edited:
Im making an accessory and it combines the Master Ninja Gear and the Ninja Armor. I want it to summon a pet that flies above the player(and does nothing, this is just vanity) while it is equipped. It would be like the Hoardagron pet. How would I do this
Also how do I make wall sliding/jumping possible?
Pets are complex, you'll want to find a guide. As for the climbing gear, you'll just need to add player.spikedBoots += 2; to your accessories UpdateEquip hook.
 
Back
Top Bottom