Standalone [1.3] tModLoader - A Modding API

You'll probably want to use this method. Just return a Vector2 containing your offset variables and you're good to go.

You can explain me with an example?
 
You can explain me with an example?

From ExampleMod's ExampleGun
Code:
        // Help, my gun isn't being held at the handle! Adjust these 2 numbers until it looks right.
        public override Vector2? HoldoutOffset()
        {
            return new Vector2(10, 0);
        }
 
From ExampleMod's ExampleGun
Code:
        // Help, my gun isn't being held at the handle! Adjust these 2 numbers until it looks right.
        public override Vector2? HoldoutOffset()
        {
            return new Vector2(10, 0);
        }

Thanks, I'll try this method.
 
Thanks, I'll try this method.
oh, I just read your original question.

item.width and height should match the actual dimensions of the moditem texture, since they define the hitbox, not how large it will be drawn.

holdoutoffset only affects guns, if your swung weapon is wrong, you need to fix the texture.

You can mess with item.scale (= 0.7f or something), but I'd suggest fixing the texture first.
 
oh, I just read your original question.

item.width and height should match the actual dimensions of the moditem texture, since they define the hitbox, not how large it will be drawn.

holdoutoffset only affects guns, if your swung weapon is wrong, you need to fix the texture.

You can mess with item.scale (= 0.7f or something), but I'd suggest fixing the texture first.
Thanks for the quickly reply, I will try this useful tips.
 
Hi, I'm having a technical issue when playing with tModLoader 0.9.1 installed - every time that a menu or other type of UI is up on the screen (such as the Item/NPC browsers from the Cheat Sheet mod) Terraria's FPS drops to 15-20 from 45 and the game becomes incredibly laggy. The lag goes away once the menus/UI are closed and not being drawn on the screen anymore.

I can confirm that it works fine on my laptop; my desktop is the one with this issue. Desktop specs: Core i5 processor, 16 GB RAM, and Radeon 6900 2 GB video card.

Does anyone have any idea as to why this issue is occurring? Further testing showed that its caused by rendering any sort of menu on the screen; if I press F11 to turn off all UI elements, my FPS skyrockets back to 60, but turning them back on drops FPS to 15-20 again. I can confirm that this is not an issue with vanilla Terraria as I can play that without any lag or other issues. I've already uninstalled and reinstalled .NET Framework 4.5.2, XNA Framework 4.0 and my video card driver, to no avail. I need help with this as I cannot figure out why it only happens with tModLoader's Terraria.exe file.
 
Well, I need help again. Edit: It has been solved.
 

Attachments

Last edited:
I found a Major glitch. I made a new Expert Character, but when the Goblin Army came, I noticed that the progress bar was staying at 0. The Old One's army didn't even spawn.
 
I've got a bug where I can't place modded helmets on armor stands or modded weapons in weapon racks. Whenever I place an item, there's a texture glitch and when I try to mine it to get the item back, the item is destroyed. Please halp please
 
How do I get a projectile to stay still? When I shoot it it moves down.
Here is the projectile's code:
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Projectiles
{
    public class PoisonRing : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Poison Ring";
            projectile.width = 57;
            projectile.height = 50;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.ranged = false;
            projectile.melee = false;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.timeLeft = 600;
            projectile.light = 0.5f;
            projectile.tileCollide = false;
        }
    }
}
 
How do I get a projectile to stay still? When I shoot it it moves down.
Here is the projectile's code:
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Projectiles
{
    public class PoisonRing : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Poison Ring";
            projectile.width = 57;
            projectile.height = 50;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.ranged = false;
            projectile.melee = false;
            projectile.magic = true;
            projectile.penetrate = -1;
            projectile.timeLeft = 600;
            projectile.light = 0.5f;
            projectile.tileCollide = false;
        }
    }
}
You can always override an AI method and set the velocity to zero manually:
Code:
public override bool PreAI()
{
    projectile.velocity = Vector2.Zero;
    return false;
}
 
Can somebody help me with how to access the mod folder of tmod on mac.
 
I have a problem. I have the code for a weapon all set and ready. But it doesn't want to compile.

Here is the code:

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

namespace PupusyaviysMod.Items.Weapons
{
    public class DirtSword : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Dirt Sword";     
            item.damage = 1;    
            item.melee = true;   
            item.width = 40; 
            item.height = 40;    
            item.toolTip = "It's a dirt sword, what do you think?";    
            item.useTime = 70;   
            item.useAnimation = 70; 
            item.useStyle = 1; ,
            item.knockBack = 2; 
            item.value = 1;
            item.rare = 1; 
            item.UseSound = SoundID.Item1; 
            item.autoReuse = true;
        }

        public override void AddRecipes()
        {
            ModRecipie recipe = new ModRecipie(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddTiles(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipie();
        }

    }
}

And this is what I get:

Code:
Terraria\ModLoader\Mod Sources\PupusyaviysMod\Items\Weapons\DirtSword.cs(30,4) : error CS0246: The type or namespace name 'ModRecipie' could not be found (are you missing a using directive or an assembly reference?)

Terraria\ModLoader\Mod Sources\PupusyaviysMod\Items\Weapons\DirtSword.cs(30,28) : error CS0246: The type or namespace name 'ModRecipie' could not be found (are you missing a using directive or an assembly reference?)

What is the problem with the recipe assignment?
 
How can I be so dumb... thanks.
 
I have a question. is there a way to remove a specific mod from tmod without logging in terraria on mac.Or is there a way to access the mod folder on mac?
 
I have a question. is there a way to remove a specific mod from tmod without logging in terraria on mac.Or is there a way to access the mod folder on mac?
/Users/account/Library/Application Support/Terraria
 
Can we get 64 bit version too? :D I want it because it tells me about 120 times that it has no memory while I am loading mods and I have 16GB RAM, so 32 bit sucks.
 
how do you update tmodloader mines stuck in 9.0.3
 
Back
Top Bottom