tmod loader help

futility

Terrarian
i just got into tmodloader programming and im trying to find out how to drop projectiles out of the sky like star fury , star wrath etc can anyone help me with the code?
 
i just got into tmodloader programming and im trying to find out how to drop projectiles out of the sky like star fury , star wrath etc can anyone help me with the code?
I'll post my (very scuffed) code that does this once I'm on my laptop.
 
This would go in the item code, note that this only spawns one projectile because I only needed a single one for this item. The 0f and 1f parameters are for velocity, in this case it only shoots straight down, so feel free to mess around with those numbers until it works as intended.
C#:
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
        {
            float PosX = Main.MouseWorld.X; //Makes the projectile always spawn above the cursor
            float PosY = player.position.Y - 600f; //makes the projectile spawn in the sky so it can shoot down
            Projectile.NewProjectile(source, PosX, PosY, 0f, 1f, type, damage, knockback, player.whoAmI);
            return false;
        }
 
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
public class TutorialSword : ModItem
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("TutorialSword"); // 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("Really? Just for this? seems Angel statues really had a use!");
}

public override void SetDefaults()
{
Item.damage = 396;
Item.DamageType = DamageClass.Melee;
Item.width = 6;
Item.height = 6;
Item.useTime = 23;
Item.useAnimation = 23; Item.useStyle = 1;
Item.knockBack = 600;
Item.value = 1000000;
Item.rare = 8;
Item.UseSound = SoundID.Item120;
Item.autoReuse = true;
Item.shoot = ProjectileID.FairyQueenRangedItemShot;
Item.shootSpeed = 15;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float PosX = Main.MouseWorld.X; //Makes the projectile always spawn above the cursor
float PosY = player.position.Y - 600f; //makes the projectile spawn in the sky so it can shoot down
Projectile.NewProjectile(source, PosX, PosY, 0f, 1f, type, damage, knockback, player.whoAmI);
return false;
}
}

public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.AngelStatue, 1000);
recipe.AddTile(TileID.HeavyWorkBench);
recipe.Register();
}


}
}
 
Back
Top Bottom