tModLoader I need help with recreating onyx blaster (1.4.4 version)

sandraj

Terrarian
i am currently making a shotgun expansion for terraria 1.4.4 and i want to make a starfury shotgun that shoots a star like onyx blaster. if you know how to make a weapon like this please help (code and explaination would be nice).
 
i found out already but im leaving an example here just in case someone has the same problem as i had
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;

namespace Example.Items.Weapons
{
public class Example : ModItem
{
public override void SetDefaults() {

Item.width = 48;
Item.height = 22;
Item.scale = 1.1f;
Item.rare = ItemRarityID.Blue;
Item.value = Item.sellPrice(silver: 27);
Item.useTime = 45;
Item.useAnimation = 45;
Item.useStyle = ItemUseStyleID.Shoot;
Item.autoReuse = true;
Item.UseSound = SoundID.Item36;
Item.DamageType = DamageClass.Ranged;
Item.damage = 7;
Item.knockBack = 4.5f;
Item.noMelee = true;
Item.shoot = ProjectileID.PurificationPowder;
Item.shootSpeed = 7f;
Item.useAmmo = AmmoID.Bullet;
}

public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) {
const int NumProjectiles = 3;

for (int i = 0; i < NumProjectiles; i++) {
.
Vector2 newVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(15));

newVelocity *= 1f - Main.rand.NextFloat(0.3f);

Projectile.NewProjectileDirect(source, position, newVelocity, type, damage, knockback, player.whoAmI);

// Here is the projectile you want to shoot, you can replace star cannon star with whatever you want, you can also modify its damage, velocity and other parameters
Projectile.NewProjectile(source, position, velocity * 2, ProjectileID.StarCannonStar, damage + 4, knockback, player.whoAmI);

}

return false;
}

public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.FallenStar, 20);
recipe.AddTile(TileID.Anvils);
recipe.Register();
}

public override Vector2? HoldoutOffset() {
return new Vector2(-6f, 4f);
}
}
}
 
Back
Top Bottom