NEED HELP WITH MY TERRARIA MOD

TastyVibe

Terrarian
so for pointers this was my first attempt at ai and it well went badly as i have came here... below is the script and on the line

" Projectile projectile = Projectile.NewProjectileDirect(NPC.Center, projectileVelocity, ProjectileID.Fireball, 20, 50, Main.myPlayer);"

im getting 2 errors one being argument 1 cannon convert from mirosoft.Xna.FrameWork.Vector2 and argument 3 not working bc it cannot convert from 'short' to microsoft.XnaFrameWork.Vector2
so with that said if anyone can help me fix this issue it would mean alot as im quite lost being in the modding community for around 3 days now.

using Terraria.ModLoader;
using Terraria;
using Terraria.ID;
using Microsoft.Xna.Framework;
using Terraria.ModLoader.Utilities;
using TastysFunTestModThingy.Items;

namespace TastysFunTestModThingy.Enemies
{
public class image_6 : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Image_6");
Main.npcFrameCount[NPC.type] = Main.npcFrameCount[2];
}

public override void SetDefaults()
{
NPC.width = 32;
NPC.height = 15;
NPC.damage = 12;
NPC.defense = 6;
NPC.lifeMax = 15;
NPC.value = 50f;
NPC.aiStyle = -1; // We're using a custom AI, so we set this to -1
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
AnimationType = NPCID.GreenSlime;
}

public override void FindFrame(int frameHeight)
{
NPC.frameCounter++;
if (NPC.frameCounter >= 20)
{
NPC.frameCounter = 0;
}
NPC.frame.Y = (int)NPC.frameCounter / 10 * frameHeight;
}

public override void OnKill()
{
Item.NewItem(NPC.GetSource_Death(), NPC.getRect(), ItemID.Gel, Main.rand.Next(0, 2));
}

public override void AI()
{
NPC.TargetClosest();

if (NPC.ai[0] == 0f)
{
// In the first state, the boss charges at the player.
NPC.velocity = NPC.DirectionTo(Main.player[NPC.target].position) * 8f;
NPC.ai[1]++;

if (NPC.ai[1] >= 60f) // After 1 second, the boss transitions to the second state.
{
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
NPC.velocity = Vector2.Zero;
}
}
else if (NPC.ai[0] == 1f)
{
// In the second state, the boss flies around and shoots fireballs.
NPC.velocity = NPC.DirectionTo(Main.player[NPC.target].position) * 6f;

if (NPC.ai[1] == 0f)
{
// Every 10 seconds, the boss unleashes a barrage of fireballs.
// Every 10 seconds, the boss unleashes a barrage of fireballs.
// Every 10 seconds, the boss unleashes a barrage of fireballs.
for (int i = 0; i < 20; i++)
{
int projectileXVelocity = 10;
Vector2 projectileVelocity = new Vector2(projectileXVelocity, 0f);
Projectile projectile = Projectile.NewProjectileDirect(NPC.Center, projectileVelocity, ProjectileID.Fireball, 20, 50, Main.myPlayer);
}


}

NPC.ai[1]++;

if (NPC.ai[1] >= 600f) // After 10 seconds, the boss transitions back to the first state.
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.velocity = Vector2.Zero;
}
}
}
}
}
 

Attachments

  • Capture.PNG
    Capture.PNG
    34.9 KB · Views: 26
Back
Top Bottom