Can you post your testmod.cs code and your testmoditem.? Also for a magic weapon(like the gem weapons currently in game, heres an example of what it should look like)
Thanks! Here is the codes: This is the test weapon I made:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace TestMod.Items {
public class TestWeapon : ModItem
{
public override void SetDefaults()
{
item.name = "Elemental Blade";
item.damage = 300;
item.melee = true;
item.width = 50;
item.height = 50;
item.toolTip = "It is an item! Maybe!"
item.useTime = 1;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 10;
item value = 1000
item.rare = 10;
item.useSound = 1;
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "Wood", 10);
recipe.AddTile(null, "Workbench");
recipe.SetResult(this);
recipe.Addrecipe();
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if(Main.rand.Next(3) == 0)
{
int dust = ModDust.NewDust(new Vector2(hitbox.X, hotbox.Y), hitbox.Width, hitbox.Height, mod, "Sparkle");
}
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(10,24,20,72)
}
}}
This is the test mod.cs:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using TestMod.Items;
namespace TestMod {
public class ExampleMod : Mod
{
public override void SetModInfo(out string name, ref ModProperties properties)
{
name = "TestMod";
properties.Autoload = true;
}
public override void Load()
{
SetGlobalItem(new TestModItem());
SetGlobalNPC(new ExampleModNPC());
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(null, ItemID.Wood);
recipe.SetResult("TestWeapon")
}
}}