Hello, Recently been trying to make a mod with scythes that can be thrown and tried to make a scythe that works as a boomerang, the scythe should be being thrown, hit multiple times dealing a lot of damage (like the zenith does) and then come back, my problem is that my projectile isn't penetraing the enemy a lot, it deals damage but some of the scythes doesn't and I was wanting to see if someone could help me with it
Code of weapon:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Microsoft.Xna.Framework;
using ScythesEVrywhere.Content.Projectiles;
namespace ScythesEVrywhere.Content.Items
{
// This is a basic item template.
// Please see tModLoader's ExampleMod for every other example:
// tModLoader/ExampleMod at stable · tModLoader/tModLoader
public class GhostReaper : ModItem
{
// The Display Name and Tooltip of this item can be edited in the 'Localization/en-US_Mods.ScythesEVrywhere.hjson' file.
public override void SetDefaults()
{
Item.damage = 200;
Item.DamageType = DamageClass.Melee;
Item.width = 72;
Item.height = 102;
Item.useTime = 8;
Item.useAnimation = 8;
Item.useStyle = ItemUseStyleID.Swing;
Item.knockBack = 5;
Item.value = Item.buyPrice(gold: 10);
Item.rare = ItemRarityID.Red;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<GhostReaperProjectile>();
Item.shootSpeed = 15;
Item.crit = 15;
Item.noUseGraphic = true;
Item.noMelee = true;
}
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.Register();
}
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code of the Proj:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ScythesEVrywhere.Content.Projectiles
{
public class GhostReaperProjectile : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 72;
Projectile.height = 102;
Projectile.aiStyle = ProjAIStyleID.Boomerang;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Melee;
Projectile.damage = 180;
Projectile.timeLeft = 100;
Projectile.light = 1f;
Projectile.extraUpdates = 0;
Projectile.ignoreWater = true;
Projectile.ownerHitCheck = true;
}
public override void AI()
{
for(int i = 0; i < 100; i++)
{
NPC target = Main.npc;
//If the npc is hostile
if(target.friendly)
{
//Get the shoot trajectory from the projectile and target
float shootToX = target.position.X + (float)target.width * 0.5f - Projectile.Center.X;
float shootToY = target.position.Y - Projectile.Center.Y;
float distance = (float)System.Math.Sqrt((double)(shootToX * shootToX + shootToY * shootToY));
//If the distance between the live targeted npc and the projectile is less than 480 pixels
if(distance < 480f && !target.friendly && target.active)
{
//Divide the factor, 3f, which is the desired velocity
distance = 3f / distance;
//Multiply the distance by a multiplier if you wish the projectile to have go faster
shootToX *= distance * 5;
shootToY *= distance * 5;
//Set the velocities to the shoot values
Projectile.velocity.X = shootToX;
Projectile.velocity.Y = shootToY;
}
}
}
}
}
}
Code of weapon:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Microsoft.Xna.Framework;
using ScythesEVrywhere.Content.Projectiles;
namespace ScythesEVrywhere.Content.Items
{
// This is a basic item template.
// Please see tModLoader's ExampleMod for every other example:
// tModLoader/ExampleMod at stable · tModLoader/tModLoader
public class GhostReaper : ModItem
{
// The Display Name and Tooltip of this item can be edited in the 'Localization/en-US_Mods.ScythesEVrywhere.hjson' file.
public override void SetDefaults()
{
Item.damage = 200;
Item.DamageType = DamageClass.Melee;
Item.width = 72;
Item.height = 102;
Item.useTime = 8;
Item.useAnimation = 8;
Item.useStyle = ItemUseStyleID.Swing;
Item.knockBack = 5;
Item.value = Item.buyPrice(gold: 10);
Item.rare = ItemRarityID.Red;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<GhostReaperProjectile>();
Item.shootSpeed = 15;
Item.crit = 15;
Item.noUseGraphic = true;
Item.noMelee = true;
}
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.Register();
}
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code of the Proj:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace ScythesEVrywhere.Content.Projectiles
{
public class GhostReaperProjectile : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 72;
Projectile.height = 102;
Projectile.aiStyle = ProjAIStyleID.Boomerang;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Melee;
Projectile.damage = 180;
Projectile.timeLeft = 100;
Projectile.light = 1f;
Projectile.extraUpdates = 0;
Projectile.ignoreWater = true;
Projectile.ownerHitCheck = true;
}
public override void AI()
{
for(int i = 0; i < 100; i++)
{
NPC target = Main.npc;
//If the npc is hostile
if(target.friendly)
{
//Get the shoot trajectory from the projectile and target
float shootToX = target.position.X + (float)target.width * 0.5f - Projectile.Center.X;
float shootToY = target.position.Y - Projectile.Center.Y;
float distance = (float)System.Math.Sqrt((double)(shootToX * shootToX + shootToY * shootToY));
//If the distance between the live targeted npc and the projectile is less than 480 pixels
if(distance < 480f && !target.friendly && target.active)
{
//Divide the factor, 3f, which is the desired velocity
distance = 3f / distance;
//Multiply the distance by a multiplier if you wish the projectile to have go faster
shootToX *= distance * 5;
shootToY *= distance * 5;
//Set the velocities to the shoot values
Projectile.velocity.X = shootToX;
Projectile.velocity.Y = shootToY;
}
}
}
}
}
}