tModLoader Projectile.NewProjectile problems

Broskie

Terrarian
Im trying to make a weapon that spawns projectiles a couple blocks out from he cursor, and then slowly come in, but for some reason it's just spawning on the cursor, and I think it's because I can't get Projetile.NewProjectile to work.

Code:

Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using ItemsUpgraded.Items.Weapons;

namespace ItemsUpgraded.Projectiles
{
    public class SolarFragment : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Solar Fragment");
        }

        public override void SetDefaults()
        {
            projectile.damage = 13;
            projectile.width = 19;
            projectile.height = 19;
            projectile.friendly = true;
            projectile.tileCollide = false;
            projectile.ignoreWater = true;
            projectile.alpha = 50;
        }

        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 60);
        }

        public override void AI()
        {

            Vector2 mousePosition = Main.MouseWorld;

            float posX = mousePosition.X + Main.rand.Next(-4, 5) * 16; // We multiply by 16 because a tile is 16 x 16 pixels.
            float posY = mousePosition.Y + Main.rand.Next(-4, 5) * 16;

            Vector2 direction = Main.MouseWorld - projectile.Center;

            projectile.velocity = direction * 1f;

            Projectile.NewProjectile(posX, posY, 0, 0, type, damage, knockBack);

            if (Main.rand.NextBool(3))
            {
                Dust dust;
                // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle.
                Vector2 position = Main.LocalPlayer.Center;
                dust = Main.dust[Terraria.Dust.NewDust(projectile.position, projectile.height, projectile.width, 6, 0f, 0f, 46, new Color(255, 255, 255), 2.105263f)];
                dust.noGravity = true;
                dust.fadeIn = 1.5f;
            }

            Lighting.AddLight(projectile.position, 0.75f, 0.25f, 0f);
        }
    }
}

Error:

error CS0103: The name 'type' does not exist in the current context

If I change type to a number, the error moves onto damage, and if I change damage, it moves onto knockback, but when they're all changed I get the error:

Projectile.NewProjectile(float, float, float, float, int, int, float, int, float, float)' cannot be accessed with an instance reference; qualify it with a type name instead

I'm completely dumbfounded as to what to do.
 
Last edited:
Back
Top Bottom