First mod and kinda need help

KiNG_Rustt

Terrarian
so i wanted to try and make a mod but im having problems with the projectile only two errors but still. could anybody help and see whats wrong with my code thanks a bunch.

Sword:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace RampageMod.Items
{
public class Swordofsparking : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sword of sparking"); // By default, capitalization in classnames will add spaces to the display name. You can customize the display name here by uncommenting this line.
Tooltip.SetDefault("Shoots sparks when swung.");
}

public override void SetDefaults()
{
Item.damage = 17;
Item.DamageType = DamageClass.Melee;
Item.width = 40;
Item.height = 40;
Item.useTime = 24;
Item.useAnimation = 24;
Item.useStyle = 1;
Item.knockBack = 6;
Item.value = 1200;
Item.rare = 1;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.shoot = Mod.ProjectileType("Sword of sparking beam");
Item.shootSpeed = 12f;
}

public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.IronBroadsword, 1); recipe.AddIngredient(ItemID.WandofSparking, 1);
recipe.AddTile(TileID.Anvils);
recipe.Register();

}
}
}


Projectile for it:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

namespace RampageMod.Items

{

public class Swordofsparkingbeam : ModProjectile
{
public override void SetDefaults()
{
Projectile.Name = "Sword of sparking beam";
Projectile.width = 30;
Projectile.height = 58;
Projectile.friendly = true;
Projectile.melee = true;
Projectile.tileCollide = true;
Projectile.penetrate = 30;
Projectile.timeLeft = 200;
Projectile.light = 0.75f;
Projectile.extraUpdates = 1;
Projectile.ignoreWater = true;
}
public override void AI()
{
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f;
}
}
}
 

Esther

Stardust Pillar
Projectile.Name = "Sword of sparking beam";
Projectile.name hasn't been a thing since 2017. Remove it and instead add the same DisplayName code that is in your sword code (The SetStaticDefaults part before the SetDefaults, but without the Tooltip line)
 

KiNG_Rustt

Terrarian
Projectile.name hasn't been a thing since 2017. Remove it and instead add the same DisplayName code that is in your sword code (The SetStaticDefaults part before the SetDefaults, but without the Tooltip line)
ok thank you very much but now theres two errors. 1 'SetDefault' because it is a 'method group' and 2 'Projectile' does not contain a definition for 'melee' and no accessible extension method 'melee' accepting a first argument of type 'Projectile' could be found (are you missing a using directive or an assembly reference?)
 

Esther

Stardust Pillar
I didn't even notice Projectile.melee, that one was also removed in 1.4. Just replace that one with the Item.DamageType (and change Item to Projectile) line from your sword.
As for the SetDefault problem, what I meant with my previous post was to remove Projectile.name, and then add this just above public override void SetDefaults():
C#:
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sword of sparking beam");
}
 
Top Bottom