tModLoader Official tModLoader Help Thread

Give the code for than we help you, the code of your weapon.
You have fail your postdraw/predraw or autoload, this is write here.
With that, also the name of your picture .

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

namespace MOD.Items.Weapons
{
    public class Greatswordofartorias : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Greatsword of Artorias";
            item.damage = 205;
            item.melee = true;
            item.width = 90;
            item.height = 90;
            item.toolTip = "This sword, which was used by knight Artorias, has lost it's evil banishing powers, but it's physical strenght still remains.";
            item.useTime = 25;
            item.useAnimation = 25;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 5;
            item.useSound = 1;
            item.autoReuse = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
this is the code of my sword
and I named both the .png and the .cs files "Greatswordofartorias"
 
Hey a got a problem how to show more player bonus
like
player.setBonus = "5% increased melee damage";
player.setBonus = "5% increased melee speed";
player.setBonus = "If you stand on Graas 5% increased melee and movement";
but it show only one
You can only put one "setbonus", for pass a line, you use \n .
In code:
player.setBonus = "5% increased melee damage.\nIf you stand on Graas 5% increased melee and movement";
In game:
5% increased melee damage.
If you stand on Graas 5% increased melee and movement
[doublepost=1468318447,1468318338][/doublepost]
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MOD.Items.Weapons
{
    public class Greatswordofartorias : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Greatsword of Artorias";
            item.damage = 205;
            item.melee = true;
            item.width = 90;
            item.height = 90;
            item.toolTip = "This sword, which was used by knight Artorias, has lost it's evil banishing powers, but it's physical strenght still remains.";
            item.useTime = 25;
            item.useAnimation = 25;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 5;
            item.useSound = 1;
            item.autoReuse = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
this is the code of my sword
and I named both the .png and the .cs files "Greatswordofartorias"

The problem is than you have forgot your MOD:
Code:
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.ModLoader;

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

}
This is the file named ExampleMod in the examplemod ^^
 
the data you made worked thank you :)

Edit: seems like ive got it because of the sprite because i tried it with your data and my sprite and ive got this error again
 
Last edited:
1) Keep this name, this is maybe better shorcut Artorias of the abyss =>AoA
2) Your PNJ is corrupt, he cannot open the png. This is that, your problem, you want build with a false image PNJ. You have probably change a .jpg => .png without use a logiciel or another thing.
 
Last edited:
I'm currently making my mod multiplayer friendly and i got into a problem.

I need to use coordinates specific to the Viewport of the player, for now i've only used Main.MouseScreen

But it has no reference to any player.
 
How can I make a projectile that starts off slow, then speeds up? Is this a certain AI style I have to use? Or is it with the projectile's velocity?
 
I'm currently making my mod multiplayer friendly and i got into a problem.

I need to use coordinates specific to the Viewport of the player, for now i've only used Main.MouseScreen

But it has no reference to any player.
I have not idea how, sorry ^^.

How can I make a projectile that starts off slow, then speeds up? Is this a certain AI style I have to use? Or is it with the projectile's velocity?
This is simple, when you create the projectile with your weapon, you have speedX and speedY, you normalize that like that:
Vector2 vector45 = new Vector2(speedX,speedY);
vector45.Normalize();
Then put the vector45.X and vector45.Y in the velocity of the newProjectile.(or just replace speedX and speedY)

In the AI projectile, this is very simple:
projectile.velocity*=1.01f;
After 60 frames, so 1 seconde, if your velocity is (1f,1f), this is now (1.82,1.82), so not too fast :p, but he increase.

If you want than your projectile have a low velocity alone: (But, you use a ai[] so...)
if(projectile.ai[0] == 0f)
{
projectile.ai[0] =1f;
projectile.velocity.Normalize();
}
 
I'm currently making my mod multiplayer friendly and i got into a problem.

I need to use coordinates specific to the Viewport of the player, for now i've only used Main.MouseScreen

But it has no reference to any player.
Well, that depends on what you are trying to do. Generally, you'll want to have the code execute on one client, then use a net message to update that information across the server and all other clients.
 
im back here with questions for two things
1. can I make it, that a weapon makes more damage on the third succsesive hit?
2. can I make it, that a weapon hurts the player whenever you hit an enemy?
 
Back
Top Bottom