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();
}


}
}
 
im a idiot but is this how u do it or am i doing something wrong?
 
Seems right to me
 
since im getting some random errors for some reason i might restart the code
 
its

getting the error at "EntitySource_ItemUse_WithAmmo"
Oh, right. Just add this with the other using statements.
using Terraria.DataStructures;
 
is it cuz im using a melee weapon or xd
 
Oh, right. Just add this with the other using statements.
using Terraria.DataStructures;
alright ill try that, thanks again
 
Oh, right. Just add this with the other using statements.
using Terraria.DataStructures;
down to 3 errors , im wasting ur time rn but now error about "Vector2" namespace could not be found , are u missing a assembly reference
 
and again sorry for wasting ur time
 
down to 3 errors , im wasting ur time rn but now error about "Vector2" namespace could not be found , are u missing a assembly reference
using Microsoft.Xna.Framework;
and again sorry for wasting ur time
I have a lot of free time, don't worry about it
 
using Microsoft.Xna.Framework;

I have a lot of free time, don't worry about it
last thing , its saying that "Item.shoot" does not exist in the namespace , it did work before
 
last thing , its saying that "Item.shoot" does not exist in the namespace , it did work before
Odd... I haven't run into that error before, sadly, so I can't really help with that
 
fixed it, i put Items. instead of item now i gotta fix the terraria id projectiles xd
 
f
Odd... I haven't run into that error before, sadly, so I can't really help with that
found it out , i have to use the id of the projectiles now not the name.
 
Odd... I haven't run into that error before, sadly, so I can't really help with that
small minor error with the code. it spawns and then instantly dissapears and doesnt fly down...
 
Back
Top Bottom