tModLoader Custom boss status message?

gaetes

Skeletron
I want to make a custom boss status message but found nothing on the internet or in ExampleMod about a status message appearing when the boss appears. Can anybody help me?
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ZombieApocalypse.NPCs
{
    [AutoloadBossHead]
    public class PatientZero : ModNPC
    {
        public override void SetStaticDefaults() {
            DisplayName.SetDefault("Patient Zero");
            Main.npcFrameCount[npc.type] = Main.npcFrameCount[NPCID.Zombie];
        }

        public override void SetDefaults() {
            npc.width = 18;
            npc.height = 40;
            npc.damage = 30;
            npc.defense = 16;
            npc.lifeMax = 1500;
            npc.HitSound = SoundID.NPCHit1;
            npc.DeathSound = SoundID.NPCDeath2;
            npc.value = 60f;
            npc.knockBackResist = 0.5f;
            npc.aiStyle = 3;
            npc.boss = true;
            aiType = NPCID.Zombie;
            animationType = NPCID.Zombie;
            banner = Item.NPCtoBanner(NPCID.Zombie);
            bannerItem = Item.BannerToItem(banner);
            music = mod.GetSoundSlot(SoundType.Music, "ZombieApocalypse/Sounds/Music/DeathEssence");
        }

        public override float SpawnChance(NPCSpawnInfo spawnInfo) {
            return SpawnCondition.OverworldNightMonster.Chance * 0.5f;
        }
        
        public override void NPCLoot()
        {
            if (Main.rand.Next(2) == 1)
            Item.NewItem(npc.getRect(), ItemID.WizardHat);
        }

        public override void HitEffect(int hitDirection, double damage)
        {
            for (int i = 0; i < 10; i++) {
                int dustType = Main.rand.Next(139, 143);
                int dustIndex = Dust.NewDust(npc.position, npc.width, npc.height, dustType);
                Dust dust = Main.dust[dustIndex];
                dust.velocity.X = dust.velocity.X + Main.rand.Next(-50, 51) * 0.01f;
                dust.velocity.Y = dust.velocity.Y + Main.rand.Next(-50, 51) * 0.01f;
                dust.scale *= 1f + Main.rand.Next(-30, 31) * 0.01f;
            }
        }
    }
}
 
I want to make a custom boss status message but found nothing on the internet or in ExampleMod about a status message appearing when the boss appears. Can anybody help me?

But there are tons of examples of that on the internet and in ExampleMod, I don't know why you keep saying that sort of thing. Check out ExampleMod boss
There's a Talk method that is called, you can see it being used in other parts of the boss code as that boss talks quite a bit. If you don't care about network play you can simply use Main.NewText() and do it that way instead of needing the method.

Code:
        private void Talk(string message) {
            if (Main.netMode != NetmodeID.Server) {
                string text = Language.GetTextValue("Mods.ExampleMod.NPCTalk", Lang.GetNPCNameValue(npc.type), message);
                Main.NewText(text, 150, 250, 150);
            }
            else {
                NetworkText text = NetworkText.FromKey("Mods.ExampleMod.NPCTalk", Lang.GetNPCNameValue(npc.type), message);
                NetMessage.BroadcastChatMessage(text, new Color(150, 250, 150));
            }
        }
 
I checked the ExampleMod boss, but I couldn't find anything that sounded like it would send off a status mesage. I guess I just didn't think of searching for the word "talk", though. Thanks!
 
Back
Top Bottom