I Fight SCal For The Lore
Terrarian
trying to make a mod, every weapon I try to make doesn't work with the error "The name 'item' does not exist in the current context" I do not know what I'm doing wrong
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent.Creative;
using Terraria.ID;
using Terraria.ModLoader;
namespace PixMod.Items.Weapons.Other
{
public class EvilDualUseWeapon : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("this better work");//Sets item name
Tooltip.SetDefault("I'm gonna hurt somebody'");//Sets tooltip when hovering in inventory
}
public override void SetDefaults() {
item.damage = 50;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = ItemUseStyleID.SwingThrow;
item.knockBack = 6;
item.value = 10000;
item.rare = ItemRarityID.Green;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.shoot = ProjectileID.Bee;
item.shootSpeed = 5f;
}
public override bool AltFunctionUse(Player player) {
return true;
}
public override bool CanUseItem(Player player) {
if (player.altFunctionUse == 2) {
item.useStyle = ItemUseStyleID.Stabbing;
item.useTime = 20;
item.useAnimation = 20;
item.damage = 50;
item.shoot = ProjectileID.Bee;
}
else {
item.useStyle = ItemUseStyleID.SwingThrow;
item.useTime = 40;
item.useAnimation = 40;
item.damage = 100;
item.shoot = ProjectileID.None;
}
return base.CanUseItem(player);
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) {
if (player.altFunctionUse == 2) {
target.AddBuff(BuffID.Ichor, 60);
}
else {
target.AddBuff(BuffID.OnFire, 60);
}
}
public override void MeleeEffects(Player player, Rectangle hitbox) {
if (Main.rand.NextBool(3)) {
if (player.altFunctionUse == 2) {
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 169, 0f, 0f, 100, default(Color), 2f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity.X += player.direction * 2f;
Main.dust[dust].velocity.Y += 0.2f;
}
else {
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Fire, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 2.5f);
Main.dust[dust].noGravity = true;
}
}
}
}
}