Standalone [1.3] tModLoader - A Modding API

Mr. @bluemagic123, I have a question, how to change gun position in the hand?

And how to change the size of an item in coding?
The item.width and item.height for your second question, change that a little bit and you can find a size that works for your item. As for the first question, I think it would be vectors, I haven't done that type of coding yet, so I'm not sure.
 
The item.width and item.height for your second question, change that a little bit and you can find a size that works for your item. As for the first question, I think it would be vectors, I haven't done that type of coding yet, so I'm not sure.

Thanks for you quickly reply, but I know change size item for 'item.width' and 'item.height'

If the item is 112 width x 56 height, even if you change the size in half (56x28) it will not change in the game.

And I don't know how to change the position of the weapon in the hand, that's why I call Mr. @bluemagic123, maybe he can help me.
 
Thanks for you quickly reply, but I know change size item for 'item.width' and 'item.height'

If the item is 112 width x 56 height, even if you change the size in half (56x28) it will not change in the game.

And I don't know how to change the position of the weapon in the hand, that's why I call Mr. @bluemagic123, maybe he can help me.
You'll probably want to use this method. Just return a Vector2 containing your offset variables and you're good to go.
 
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.
 
When I made a projectile create a new projectile upon impact with a tile or npc the new projectile just keeps going down...

Here is the 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 PoisonSpell : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Poison Spell";
            projectile.width = 8;
            projectile.height = 21;
            projectile.aiStyle = 1;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.ranged = false;
            projectile.melee = false;
            projectile.magic = true;
            projectile.penetrate = 1;
            projectile.timeLeft = 600000;
            projectile.light = 0.5f;
            projectile.tileCollide = true;
            projectile.extraUpdates = 1;
            ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
            ProjectileID.Sets.TrailingMode[projectile.type] = 0;
        }
        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            for (int i = 0; i < 5; i++)
            {
                int a = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(1, 1), Main.rand.Next(1, 1), mod.ProjectileType ("PoisonRing"), (int)(projectile.damage * .5f), projectile.owner);
            }
            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PoisonSpell"), projectile.position);
            return true;
        }
    }
}
 
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.
 
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;
}
 
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?
 
Back
Top Bottom