int timer2 = <Insert timer2's start value here>;
if (timer2 <= 0) //Please add another timer for projectile, if you don't want ur game to eventually explode
{
float Speed = 30f; //Speed of which projectile is fired. For all values that are 'floats', put an f after the value.
int damage = 36; //damage of the projectile
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); //Find the center position of the NPC
int type = <Insert projectile type or ID here>;
float KB = 0f; //Knockback. 0f means no knockback for projectile. I think theres a maximum knockback amount but idk
float rotation = (float) Math.Atan2(vector8.Y-(Main.player[npc.target].position.Y+(Main.player[npc.target].height * 0.5f)), vector8.X-(Main.player[npc.target].position.X+(Main.player[npc.target].width * 0.5f))); //You don't really need to know about this, just, it works.
Projectile.NewProjectile(vector8.X, vector8.Y,(float)((Math.Cos(rotation) * Speed)*-1),(float)((Math.Sin(rotation) * Speed)*-1), type, damage, KB, 0); //Finally shoot a projectile
timer2 = <Insert timer2's start value here>; //Reset timer2
}
else timer2--;