PC Compiling my mod doesn't work because of an error in a bosses' code!

BlueBolt22

Official Terrarian
This is the error:
error.PNG

This is the code:
Code:
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace BluesSwords.NPCs.Boss
{
public class CursedEyeOfCthulhu : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Cursed Eye Of Cthulhu");
}
public override void SetDefaults()
{
npc.aiStyle = 5; //5 is the flying AI
npc.lifeMax = 900690069000; //boss life
npc.damage = 140; //boss damage
npc.defense = 70; //boss defense
npc.knockBackResist = 10000f;
npc.width = 100;
npc.height = 100;
animationType = NPCID.EyeofCthulhu; //this boss will behavior like the DemonEye
npc.value = Item.buyPrice(0, 40, 75, 45);
npc.npcSlots = 1f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = true;
npc.noTileCollide = true;
npc.buffImmune[24] = true;
music = MusicID.Boss2;
npc.netAlways = true;
}
public override void AutoloadBossHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "BluesSwords/NPCs/CursedEye"; //the boss head texture
}

public override void BossLoot(ref string name, ref int potionType)
{
potionType = ItemID.SuperHealingPotion; //boss drops
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale); //boss life scale in expertmode
npc.damage = (int)(npc.damage * 0.6f); //boss damage increase in expermode
}
}
}
The bossHeadTexture ("CursedEye") exists. Also, I don't know what it's trying to "override" so I can't make a file or whatever it wants me to do.
 
By using the "override" Keyword you are trying to override a virtual Method in ModNPC that doesn't exist. I recommend reading up on C# Inheritance and using Visual Studio so you can find these Errors before Compiling.
 
I was using Visual Studio, and I just copied code I found online to make a boss with the EoC AI. It doesn't show the errors. Do you mean to remove the override keyword? How do you show the boss head without that code? Should I replace "Override" with something, and if I should, what? I know what to edit to change the stats, but I'm not good at editing C# code.
 
I was using Visual Studio, and I just copied code I found online to make a boss with the EoC AI. It doesn't show the errors. Do you mean to remove the override keyword? How do you show the boss head without that code? Should I replace "Override" with something, and if I should, what? I know what to edit to change the stats, but I'm not good at editing C# code.
Hmm, when I copy it into my Visual Studio, I get an Error Message. I'm not very knowledgeable when it comes to making Bosses, maybe this works :
Code:
        public override bool Autoload(ref string name)
        {
            mod.AddBossHeadTexture("BluesSwords/NPCs/CursedEye");
            return base.Autoload(ref name);
        }
 
Now it gets stuck on the "Loading (mod).XNA.DLL", then eventually loads and gives me Error CS1513. The only 2 things I put in my mod are a swortshord and the boss (with the head picture, too. I'll make a summon item later).
1591135001506.png
 
Now it gets stuck on the "Loading (mod).XNA.DLL", then eventually loads and gives me Error CS1513. The only 2 things I put in my mod are a swortshord and the boss (with the head picture, too. I'll make a summon item later).View attachment 275939
Now you are missing a } somewhere. You definitely have to get Visual Studio to highlight Errors. I don't know why it doesn't.
 
There aren't any red lines.
Capture3.PNG
It says "No issues found". When I press the Build button in tModLoader, it says the error was "expected".
 
There aren't any red lines. View attachment 275943It says "No issues found". When I press the Build button in tModLoader, it says the error was "expected".
That's really weird. I can see that there are curly Brackets missing. One after "npc.netAlways = true", the Other in Line 21 according to the Error. You'll have to find a way for Visual Studio to highlight Errors.
 
Ok, I think I know what the Issue is. You only have CursedEyeOfCthulhu.cs opened, right? Open your Mods .csproj File and edit CursedEyeOfCthulhu.cs from there.
 
I don't see it. Also, they aren't in the same folder. They need to be in the folder named what type of content was created. CursedEyeOfCthulhu.cs is in NPCs and the .csproj is in the main mod folder where the other folders are.
1591142707889.png
 
I still don't see it. What menu (like the File button) is it under? If it's not in one, where should it be? I have the latest version (Microsoft Visual Studio Community 2019).
 
I still don't see it. What menu (like the File button) is it under? If it's not in one, where should it be? I have the latest version (Microsoft Visual Studio Community 2019).
open the .csproj file and then in the Solution Explorer find the file and click on it. Mind attaching your Mod?
 
Back
Top Bottom