tModLoader Fix My Boss Code

PewPewTrash

Steampunker
I get error CS0115 at the AutoLoad Head texture with Ref string refstring, so here's the error:

c:\Users\HP\Documents\My games\Terraria\ModLoader\Mod Sources\OreGuns\NPCs\Boss\MegaEye.cs(37,24) : error CS0115: 'OreGuns.NPCs.Boss.MegaEye.AutoloadHead(ref string, ref string)': no suitable method found to override

And heres the Code:

using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace OreGuns.NPCs.Boss
{
public class MegaEye : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mega Eye");
}
public override void SetDefaults()
{
npc.aiStyle = 4; //5 is the flying AI
npc.lifeMax = 240000; //boss life
npc.damage = 140; //boss damage
npc.defense = 50; //boss defense
npc.knockBackResist = 10000f;
npc.width = 100;
npc.height = 100;
animationType = NPCID.Unicorn; //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 AutoloadHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "OreGuns/NPCs/MegaEye_Head_Boss"; //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
}
}
}
 
I get error CS0115 at the AutoLoad Head texture with Ref string refstring, so here's the error:

c:\Users\HP\Documents\My games\Terraria\ModLoader\Mod Sources\OreGuns\NPCs\Boss\MegaEye.cs(37,24) : error CS0115: 'OreGuns.NPCs.Boss.MegaEye.AutoloadHead(ref string, ref string)': no suitable method found to override

And heres the Code:

using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace OreGuns.NPCs.Boss
{
public class MegaEye : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mega Eye");
}
public override void SetDefaults()
{
npc.aiStyle = 4; //5 is the flying AI
npc.lifeMax = 240000; //boss life
npc.damage = 140; //boss damage
npc.defense = 50; //boss defense
npc.knockBackResist = 10000f;
npc.width = 100;
npc.height = 100;
animationType = NPCID.Unicorn; //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 AutoloadHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "OreGuns/NPCs/MegaEye_Head_Boss"; //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
}
}
}



Hi, Im trying to make a boss for my custom mod but I keep getting this error

c:\Users\user\Documents\My Games\Terraria\ModLoader\Mod Sources\ShaanGuns\Items\Summon\Suspicious looking face.cs(12,29) : error CS1514: { expected

Heres the code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria;

namespace ShaanGuns.Items.Summon
{
    public class Suspicious looking face : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Suspicious looking face");
            Tooltip.SetDefault("Maybe you should try using it! You'll get a new friend.");
        }

        public override void SetDefaults()
        {
            item.width = 20;
            item.height = 20;
            item.maxStack = 20;
            item.value = 100;
            item.rare = 1;
            item.useAnimation = 40;
            item.useTime = 45;
            item.consumable = true;

            item.useStyle = 4; // Holds up like a summon item.
        }

        public override bool CanUseItem(Player player)
        {
            // Main Bosses
            bool queenBee = NPC.downedQueenBee; // Downed Queen Bee

            bool bossOne = NPC.downedBoss1; // Downed EoC
            bool bossTwo = NPC.downedBoss2; // Downed EoW or BoC
            bool bossThree = NPC.downedBoss3; // Downed Skeletron

            bool isHardmode = Main.hardMode; // Downed WoF

            bool mechOne = NPC.downedMechBoss1; // Downed The Twins
            bool mechTwo = NPC.downedMechBoss2; // Downed The Destroyer
            bool mechThree = NPC.downedMechBoss3; // Downed Skeletron Prim

            bool plantera = NPC.downedPlantBoss; // Downed Plantera
            bool golem = NPC.downedGolemBoss; // Downed Golem;
            bool cultist = NPC.downedAncientCultist; // Downed Cultist
            bool moonLord = NPC.downedMoonlord; // Downed MoonLord

            // Does NPC Exist
            bool alreadySpawned = NPC.AnyNPCs(mod.NPCType("TutorialBoss"));

            // return NPC.downedQueenBee && Main.hardMode && !NPC.AnyNPCs(mod.NPCType("TutorialBoss")); // NPC will spawn if No existing Tutorial Boss, Queen Bee is downed and it is hardmode
            return !alreadySpawned;
        }

        public override bool UseItem(Player player)
        {
            NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("TutorialBoss")); // Spawn the boss within a range of the player.
            Main.PlaySound(SoundID.Roar, player.position, 0);
            return true;
        }
    }
}
 
Back
Top Bottom