Ignore this as I have solved pretty much all of the issues

FLRN1

Skeletron Prime
I noticed that all of the guns that I have coded have an annoying flash in their animation. How do I fix this?

I am also trying to add an alternate use to my gun that lifesteals like the Lifedrain. I have no knowledge on how lifesteal projectiles work.

The video gives more information on the above issues and the solutions I am looking for.

Weapon help - Create and share your videos with Clipchamp

I am also confused as to how I can make a homing projectile that behaves exactly like a VortexBeaterRocket or RocketSnowmanI/III without emitting dust or breaking. When I set my projectile to have the VortexBeaterRocket's AI, it works as intended but it emits the dust that the regular projectile does. It makes sense that it emits the dust, but it's an issue because the projectile I'm making is fire themed. When I set it to behave like RocketSnowmen, it has a stroke and dies, but it does emit the rocket fire trail, which perfectly matches the theme.

I know I am asking for a lot, but these questions don't all have to be answered at the same time. It would be nice if these could be answered soon as this would help me with coding many other things.

Here is the code for the gun if it helps:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using dmod.Projectiles;

namespace dmod.Items
{
public class HadesRifle : ModItem
{

public override void SetStaticDefaults()
{
DisplayName.SetDefault("Hades");
Tooltip.SetDefault("An ancient superweapon"
);

}


public override void SetDefaults()
{




item.rare = ItemRarityID.Red;
item.value = Item.sellPrice(platinum: 37);
item.useStyle = ItemUseStyleID.HoldingOut;
item.useTime = 1;
item.UseSound = SoundID.Item40;
item.useAnimation = 5;



item.noMelee = true;
item.ranged = true;
item.damage = 16520;
item.knockBack = 2;

item.shoot = 10;

item.shootSpeed = 300f;




}

public override Vector2? HoldoutOffset()
{
return new Vector2(-27, 5);
}



public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.LunarBar, 69);
recipe.AddIngredient(ModContent.ItemType<GaussRifle>());
recipe.AddIngredient(ModContent.ItemType<DevotionII>());
recipe.AddTile(TileID.LunarCraftingStation);
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)
{

Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY)) * 25f;
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
{
position += muzzleOffset;
}



type = Main.rand.Next(new int[] { ProjectileType<Projectiles.HadesBolt1>(), ProjectileType<Projectiles.HadesBolt2>(), ProjectileType<Projectiles.HadesBolt3>() });
return true;



}



}

}
 
Last edited:
Add in item.autoReuse = true;

Also, if that doesn't resolve the flashing by itself, you may have to tweak the usetime and useanimation values.
 
Add in item.autoReuse = true;

Also, if that doesn't resolve the flashing by itself, you may have to tweak the usetime and useanimation values.
I tested it and it worked, thank you! I didn't even realize that was missing from the code.
 
Back
Top Bottom