Give a part of the code where you have your problem.ok i look and try thanks
Edit: but it also says that the "width" and "height" factor doesn't exist in this context
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Aoa.Items.Weapons
{
public class dragonslayerspear : ModItem
{
public override void SetDefaults()
{
item.name = "Dragonslayer Spear";
item.damage = 160;
item.toolTip = "The Spear of Ornstein, one of the four knights who hunted down the dragons. It kept it's thunderous power to hunt down your foes.";
item.melee = true;
item.width = 38;
item.height = 38;
item.scale = 1.1f;
item.maxStack = 1;
item.useTime = 30;
item.useAnimation = 30;
item.knockBack = 4f;
item.useSound = 1;
item.noMelee = true;
item.noUseGraphic = true;
item.useTurn = true;
item.useStyle = 5;
item.value = Item.sellPrice(0, 1, 0, 0);
item.rare = 5;
item.shoot = mod.ProjectileType("dragonslayerspearprojectile");
item.shootSpeed = 5f;
}
public override void AddRecipes() //How to craft this item
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Wood, 10); //you need 10 Wood
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Aoa.Items.Weapons
{
public class dragonslayerspear : ModItem
{
public override void SetDefaults()
{
item.name = "Dragonslayer Spear";
item.damage = 160;
item.toolTip = "The Spear of Ornstein, one of the four knights of Gwyn who hunted down the dragons. It kept it's thunderous power to hunt down your foes.";
item.melee = true;
item.width = 38;
item.height = 38;
item.scale = 1.1f;
item.maxStack = 1;
item.useTime = 30;
item.useAnimation = 30;
item.knockBack = 4f;
item.useSound = 1;
item.noMelee = true;
item.noUseGraphic = true;
item.useTurn = true;
item.useStyle = 5;
item.value = Item.sellPrice(0, 1, 0, 0);
item.rare = 5;
item.shoot = mod.ProjectileType("dragonslayerspearprojectile");
item.shootSpeed = 5f;
}
public override void AddRecipes() //How to craft this item
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Wood, 10); //you need 10 Wood
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int idx = Projectile.NewProjectile(position.X+(float)width, position.Y+(float)height, speedX, speedY, mod.ProjectileType("thunderbolt"), damage, knockBack, item.owner, 0,0);
return true; // spear proj
}
}
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int idx = Projectile.NewProjectile(position.X+(float)item.width, position.Y+(float)item.height, speedX, speedY, mod.ProjectileType("thunderbolt"), damage, knockBack, item.owner, 0,0);
return true; // spear proj
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int idx = Projectile.NewProjectile(position.X, position.Y+, speedX, speedY, mod.ProjectileType("thunderbolt"), damage, knockBack, item.owner, 0,0);
return true; // spear proj
}
I'm using visual studio and it doesn't seem to detect a problemInstall VisualStudio, this is not a bug, you have just a variable not declared.
Send the code, so ^^.
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace TerrariaEnhanced.Projectiles
{
public class DemonKnife : ModProjectile
{
public override void SetDefaults()
{
projectile.CloneDefaults(ProjectileID.VampireKnife);
projectile.name = "Demon Knife";
}
public override void AI()
{
projectile.ai[0] += 1f;
if (projectile.ai[0] >= 30f)
{
projectile.alpha += 3;
projectile.damage = (int)((double)projectile.damage * 0.9);
projectile.knockBack = (float)((int)((double)projectile.knockBack * 0.9));
}
if (projectile.ai[0] < 30f)
{
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
}
if (projectile.velocity.Y > 16f)
{
projectile.velocity.Y = 16f;
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float num474 = 400f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1))
{
float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2);
float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2);
float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477);
if (num478 < num474)
{
num474 = num478;
num472 = num476;
num473 = num477;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 3f;
num483 = 6f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
return;
}
if (Main.rand.Next(6) == 0)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
}
public override void Kill(int timeLeft)
{
for (int num303 = 0; num303 < 3; num303++)
{
int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default(Color), 0.8f);
Main.dust[num304].noGravity = true;
Main.dust[num304].velocity *= 1.2f;
Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Main.player[Main.myPlayer].lifeSteal <= 0f)
{
return;
}
Main.player[Main.myPlayer].lifeSteal -= num;
int num2 = projectile.owner;
Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, mod.ProjectileType("DemonHeal"), 0, 0f, projectile.owner, (float)num2, num);
}
}
}
Send all the code of the item, for see better.sorry to say, but this code didn't work too
This is item.useStyle = X;As of this is working how would I change the way the Player holds the weapon?
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Aoa.Items.Weapons
{
public class dragonslayerspear : ModItem
{
public override void SetDefaults()
{
item.name = "Dragonslayer Spear";
item.damage = 160;
item.toolTip = "The Spear of Ornstein, one of the four knights of Gwyn who hunted down the dragons. It kept it's thunderous power to hunt down your foes.";
item.melee = true;
item.width = 38;
item.height = 38;
item.scale = 1.1f;
item.maxStack = 1;
item.useTime = 30;
item.useAnimation = 30;
item.knockBack = 4f;
item.useSound = 1;
item.noMelee = true;
item.noUseGraphic = true;
item.useTurn = false;
item.useStyle = 5;
item.value = Item.sellPrice(0, 1, 0, 0);
item.rare = 5;
item.shoot = mod.ProjectileType("dragonslayerspearprojectile");
item.shootSpeed = 5f;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int idx = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("thunderbolt"), damage, knockBack, item.owner, 0,0);
return true; // spear proj
}
public override void AddRecipes() //How to craft this item
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Wood, 10); //you need 10 Wood
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Aoa.Projectiles
{
public class thunderbolt : ModProjectile
{
public override void SetDefaults()
{
projectile.name = "Thunderbolt"; //projectile name
projectile.width = 20; //projectile width
projectile.height = 28; //projectile height
projectile.friendly = true; //make that the projectile will not damage you
projectile.melee = true; //
projectile.tileCollide = true; //make that the projectile will be destroed if it hits the terrain
projectile.penetrate = 0; //how many npc will penetrate
projectile.timeLeft = 200; //how many time this projectile has before disepire
projectile.light = 0.75f; // projectile light
projectile.extraUpdates = 1;
projectile.ignoreWater = true;
}
public override void AI() //this make that the projectile will face the corect way
{ // |
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
}
}
}