• Journey's End on PC - Find info here and here. Please report bugs and issues for PC 1.4 and 1.4.1 to Re-Logic here.
  • Journey's End on Mobile - Find info here. Report bugs for Mobile 1.4 to DR Studios at this link and give as much detail as possible.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Console and Switch - The latest news can be found here. To report a bug, please use this link.

Boss texture not working.

ShivTex3

Eye of Cthulhu
(Idk if im using the correct thread thing, I hope so)
I would like to start off by telling you that you are about to see the worst code that your eyes have been forced to appreciate.
Anyway, so ill just get to the point, I am trying to make a boss with 6 frames, But it is only showing the first frame, Yeah I really don't know how to explain it. ill just give you my code and stuff
C#:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using MasterPiece;
using MasterPiece.Dusts;
using MasterPiece.Projectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;

namespace MasterPiece.NPCs.MechanicalBeast
{
    [AutoloadBossHead]
    public class MechanicalBeast : ModNPC
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Mechanical Beast");
            Main.npcFrameCount[npc.type] = 6;
        }
        public override void SetDefaults()
        {
            npc.aiStyle = 5;
            npc.lifeMax = 1000;
            npc.damage = 5;
            npc.defense = 15;
            npc.knockBackResist = 0f;
            npc.width = 100;
            npc.height = 100;
            npc.value = Item.buyPrice(0, 20, 0, 0);
            npc.npcSlots = 15f;
            npc.boss = true;
            npc.lavaImmune = true;
            npc.noGravity = true;
            npc.noTileCollide = true;
            npc.HitSound = SoundID.NPCHit1;
            npc.DeathSound = SoundID.NPCDeath1;
            npc.buffImmune[144] = true;
            music = MusicID.Boss2;
        }
        //public override void OnSpawn() //optional
        //{

        //}

        public override void AI() //this is where you program your AI
        {

        }

        //public override void HitEffect(int hitDirection, double damage, bool isDead) //This is for whenever your boss gets hit by an attack. Create dust or gore.
        //{

        //}

        //public override void SelectFrame(int frameSize) //This is for animating your boss, such as how Queen Bee changes between charging or hovering images, or how Pumpking rotates its face.
        //{

        //}

        //public override void SetupLootRules(NPC unused) //this is what makes special things happen when your boss dies, like loot or text
        //{
    }
}
Your eyes are probably bleeding after seeing my code, I am really sorry, im just bad at coding : [
Anyway here is the texture
MechanicalBeast.png

(That is DEFINETELIY not an official texture, I'm just using it for testing purposes)
If anyone knows how to fix that, please reply, that would help me a lot.
 

direwolf420

Terrarian
npc.value can stay like that, what matters is that your using an existing aiStyle, which has its own predetermined way of animating. If you want to animate something like vanilla, you need to make sure whatever ai/NPC your copying from has the same frames as your spritesheet, and then add
animationType = NPCID.Zombie;
to SetDefaults (replace Zombie with whatever npc also has the aistyle of 5 and you want its animation to use)
Example of that: tModLoader/tModLoader

If you want to control how your NPC animates yourself, use the FindFrame hook, example here: tModLoader/tModLoader
 

ShivTex3

Eye of Cthulhu
remove this:
npc.value = Item.buyPrice(0, 20, 0, 0);
Op- I didn't noticed that, Thank you so much :D
npc.value can stay like that, what matters is that your using an existing aiStyle, which has its own predetermined way of animating. If you want to animate something like vanilla, you need to make sure whatever ai/NPC your copying from has the same frames as your spritesheet, and then add
animationType = NPCID.Zombie;
to SetDefaults (replace Zombie with whatever npc also has the aistyle of 5 and you want its animation to use)
Example of that: tModLoader/tModLoader

If you want to control how your NPC animates yourself, use the FindFrame hook, example here: tModLoader/tModLoader
Bruh now I feel like an idiot, that makes so much sense, seriously thanks, I'm going to test that to see if it works.
 
Top Bottom