Sin Costan
Eye of Cthulhu
You have an extra bracket somewhereerror: in class declaration, structure or member interface exist incorrect token if
what I did wrongCode:using System; using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace KahanMod.NPCs.Bosses { public class Yama : ModNPC { public override void SetDefaults() { npc.name = "Yama"; npc.displayName = "Yama"; npc.aiStyle = 0; npc.lifeMax = 9000; npc.damage = 40; npc.defense = 25; npc.knockBackResist = 0f; npc.width = 60; npc.height = 30; animationType = NPCID.BoundGoblin; Main.npcFrameCount[npc.type] = 2; npc.value = Item.buyPrice(0, 0, 10, 0); npc.npcSlots = 1f; npc.boss = true; npc.lavaImmune = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath17; npc.buffImmune[24] = false; music = MusicID.Boss2; npc.netAlways = true; } public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture) { bossHeadTexture = "KahanMod/NPCs/Bosses/Yama_Head_Boss"; } public override void BossLoot(ref string name, ref int potionType) { potionType = ItemID.HealingPotion; if (Main.expertMode) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YamaTreasureBag")); } else { int choice = Main.rand.Next(3); if (choice == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YoyoMold")); } if (choice == 1) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FlailMold")); } if (choice == 2) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("KatanaMold")); } Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RedFragment"), Main.rand.Next(5, 10)); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.6f); } public override void AI() { Player player = Main.player[npc.target]; Vector2 moveTo = player.Center + new Vector2(0f, -200f); float speed = 3f; Vector2 move = moveTo - npc.Center; float magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y); move *= speed / magnitude; npc.velocity = move; npc.ai[0] += 1; if(npc.ai[0] %(60 * 10) == 0) { for(int i = 0; i < 5; i++) { if (npc.ai[0] % 600 == 0) { NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("TorturedSoul")); //NPC name } } } } if (npc.life <= npc.lifeMax * 0.5f) { for(int i = 0; i < 1; i++) { if (npc.ai[0] % 600 == 0) { NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("HorseFace")); //NPC name } } } } } }
I seriously don't know what you are trying to do here, and here is an example on how to use a counter.Or maybe this?
Code:npc.ai[0] += 1; if (npc.ai[1] >= 100) // 230 is projectile fire rate { for(int i = 0; i < 255; i++) { } } int rand = Main.rand.Next(5); int num = mod.ProjectileType("Gust"); } } } }
Code:
public override void AI()
{
//Increment counter
projectile.ai[0] += 1f
//If the counter divided by 60 has a remainder of 0 do the thing NOTE: 60 ticks = 1 sec
if(projectile.ai[0] % 60 == 0)
{
//Produces projectile and gets the index of projectile
int projectileIndex = Projectile.NewProjectile(/*NewProjectile stuff because of laziness*/);
Main.projectile[projectileIndex].hostile = true; //Set the projectile in the array to hostile
Main.projectile[projectileIndex].friendly = false; //Set the projectile in the array to be not friendly
}
}