oAbsol
Terrarian
So I've been trying to find out how to recreate the burst effect of the clockwork assault rifle, but I'm a little lost. I was able to recreate it by setting the usetime and useanimation to make it shoot 3 bullets every time the item is used, but once you enable auto fire or even just click fast, it doesn't have that delay that the clockwork has between shots. The public override bool used was based on a thread I found that was made in 2015, but I don't get how or why it works, and even then I get an error because of It, so if there's another way to make this work/if someone could explain how it works and what I'm doing wrong, that would be wonderful.
--------------------------------------------------------------
Code is listed below:
--------------------------------------------------------------
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CodingPractice.Items
{
public class SuperCommandoRifle : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Super Commando Rifle"); // 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("Scavanged from a backyard battlefield");
}
public override void SetDefaults()
{
Item.damage = 42;
Item.DamageType = DamageClass.Ranged;
Item.width = 35;
Item.height = 24;
Item.useTime = 4;
Item.useAnimation = 11;
Item.useStyle = 5;
Item.knockBack = 2;
Item.value = 230000;
Item.rare = 7;
Item.UseSound = SoundID.Item31;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<projectiles.SuperCommandoRifleProjectile>();
Item.shootSpeed = 20f;
}
public override bool UseItem(Player p)
{
if (p.itemAnimation < p.inventory[p.selectedItem].useAnimation - 8)
{
return true;
}
else
{
return false;
}
}
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.ClockworkAssaultRifle, 1);
recipe.AddIngredient(ItemID.ChlorophyteBar, 10);
recipe.AddTile(TileID.MythrilAnvil);
recipe.Register();
}
}
}
--------------------------------------------------------------
Code is listed below:
--------------------------------------------------------------
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CodingPractice.Items
{
public class SuperCommandoRifle : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Super Commando Rifle"); // 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("Scavanged from a backyard battlefield");
}
public override void SetDefaults()
{
Item.damage = 42;
Item.DamageType = DamageClass.Ranged;
Item.width = 35;
Item.height = 24;
Item.useTime = 4;
Item.useAnimation = 11;
Item.useStyle = 5;
Item.knockBack = 2;
Item.value = 230000;
Item.rare = 7;
Item.UseSound = SoundID.Item31;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<projectiles.SuperCommandoRifleProjectile>();
Item.shootSpeed = 20f;
}
public override bool UseItem(Player p)
{
if (p.itemAnimation < p.inventory[p.selectedItem].useAnimation - 8)
{
return true;
}
else
{
return false;
}
}
public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.ClockworkAssaultRifle, 1);
recipe.AddIngredient(ItemID.ChlorophyteBar, 10);
recipe.AddTile(TileID.MythrilAnvil);
recipe.Register();
}
}
}