Standalone [1.3] tModLoader - A Modding API

any ideas why this doesnt work? i get the whole spritesheet as the texture, and only interact with the bottom one, if i add in Main.npcFrameCount[npc.type] = 5; then everything else breaks

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

namespace LordBozo.NPCs.Boss
{
    public class Spider : ModNPC
    {
        public override void SetDefaults()
        {
            npc.CloneDefaults(NPCID.WallCreeper);
            npc.name = "Spider";
            npc.displayName = "Shelob";
            npc.lifeMax = 5000;  
            npc.damage = 200;
            npc.defense = 10; 
            npc.knockBackResist = 100f;   
            npc.value = Item.buyPrice(0, 40, 75, 45);
            npc.npcSlots = 1f;
            npc.boss = true; 
            npc.lavaImmune = true;
            npc.noGravity = false;
            npc.noTileCollide = false;
            npc.soundHit = 8;
            npc.soundKilled = 14;
            npc.buffImmune[24] = true;
            music = MusicID.Boss2;
            npc.netAlways = true;
        }
        public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
        {
            bossHeadTexture = "LordBozo/NPCs/Boss/Spider_Head_Boss";
        }
        public override void BossLoot(ref string name, ref int potionType)
        {
            potionType = ItemID.LesserHealingPotion;  
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Chloroform"), Main.rand.Next(5, 11));
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Poison"), Main.rand.Next(5, 11));
        }
        public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
        {
            npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale); 
            npc.damage = (int)(npc.damage * 0.6f); 
        }
        public override void AI()
        {
            npc.ai[0]++;
            Player P = Main.player[npc.target];
            if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
            {
                npc.TargetClosest(true);
            }
            npc.netUpdate = true;

            npc.ai[1]++;
            if (npc.ai[1] >= 230)
            {
                float Speed = 20f; 
                Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
                int damage = 10;
                int type = mod.ProjectileType("ProBoss");
                Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
                float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
                int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
                npc.ai[1] = 0;
            }
            if (npc.ai[0] % 1800 == 3) 

            {
                NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, 164);
            }
            npc.ai[1] += 0;
        }
    }
}
 
Um, what do I replace the shield/wing spot so it dosnt ask for a on player sprite?
 
Last edited:
I have a problem with this minion I am making. Every time it hits an enemy, the minion just disappears for no reason. the animation also seems to be broken. The minion has this weird gray vertical bar that appears randomly in between frames. Here is the (one and only)code for the minion and the sprite of the summon
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace BMod.Projectiles.Minions
{
    public class MeteorHeadSummon : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.netImportant = true;
            projectile.name = "Meteor Head Summon";
            projectile.width = 16;
            projectile.height = 24;
            Main.projFrames[projectile.type] = 2;
            projectile.minion = true;
            projectile.minionSlots = 1f;
            projectile.penetrate = 1;
            projectile.timeLeft *= 5;
            projectile.tileCollide = true;
            projectile.ignoreWater = true;
            ProjectileID.Sets.MinionSacrificable[projectile.type] = true;       
            projectile.aiStyle = 54;
        }
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 100); //because it's a meteor, fire seems to be a good effect for it ;)
        }
    }
}
View attachment 118448
EDIT:That gray bar also appears when the minion itself is chasing down an enemy. It actually replaces the entire sprite with that gray bar while its chasing an enemy
Can someone help me here please? :(

Is there something wrong with the sprite? The code? Both?
 
"
error CS0006: Metadata file 'C:\Games\Steam\steamapps\common\Terraria\Ionic.Zip.Reduced.dll' could not be found
"
"
error CS1703: An assembly with the same identity 'Ionic.Zip.Reduced, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c' has already been imported. Try removing one of the duplicate references.
"

I've been getting these two errors in response to each other.
The first one says that ionic.zip isn't existent, so I fix that by putting the .dll there.
The second one says it's completely redundant, so delete it.
Any help with a fix?
 
Go to your terraria in steam, find name that maches one in your sentence, delete it. Or go into your mods and it may have the mod with same name in already. delete it.

Ionic.Zip.Reduced.dll

Delete this.
 
When I load my boss into my mod. When I spawn him he stays at the same level were he spawns.
Also his animation flashes.
And when you touch/shoot him he disappears instantly
I can find no way to fix this and I tried everything.

Here is the code of the boss:
Code:
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

namespace GunPulse.NPCs.Boss
{
    public class DragonSlime : ModNPC
    {
        public override void SetDefaults()
        {
            npc.name = "Dragon Slime";
            npc.displayName = "Dragon Slime";
            npc.aiStyle = 3;
            npc.lifeMax = 1000;
            npc.damage = 20;
            npc.defense = 200;
            npc.knockBackResist = 1000;
            npc.width = 162;
            npc.height = 126;
            animationType = NPCID.Zombie;
            Main.npcFrameCount[npc.type] = 2;
            npc.value = Item.buyPrice(0, 40, 75, 42);
            aiType = NPCID.Bunny;
            npc.npcSlots = 1f;
            npc.boss = true;
            npc.lavaImmune = true;
            npc.noGravity = true;
            npc.noTileCollide = false;
            npc.soundHit = 8;
            npc.soundKilled = 14;
            npc.netAlways = true;
        }
        public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
        {
            bossHeadTexture = "GunPulse/NPCs/Boss/DragonSlime_Head_Boss";
        }
        public override void BossLoot(ref string name, ref int potionType)
        {
            potionType = ItemID.GreaterHealingPotion;
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DragonBar"), 23);
        }
        public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
        {
            npc.lifeMax += (int)(npc.lifeMax * 0.579f * bossLifeScale);
            npc.damage += (int)(npc.damage * 0.6f);
        }
    }
}
And here is the sprite of it:
DragonSlime.png

Can someone please help me and tell me whats wrong here?
 
EDIT:
It turns out, the way to fix it was to remove it from the folder and then restart terraria.
Unfortunately on the start screen there is a flashing texture. Dunno how to fix that but I can live with it.

However, I got another error spat out.
"
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad)
"
----------
That's the problem, whenever I do that, I get the first error.
"
error CS0006: Metadata file 'C:\Games\Steam\steamapps\common\Terraria\Ionic.Zip.Reduced.dll' could not be found
"
I know it's not needed, but the compiler says otherwise.
I've identified all the "ionic.zip.reduced.dll" items on my computer, and have tried to compile with/without them, and found no success.
yWSyiOe.png

and
YbRfD9W.png
 
Last edited:
When I load my boss into my mod. When I spawn him he stays at the same level were he spawns.
Also his animation flashes.
And when you touch/shoot him he disappears instantly
I can find no way to fix this and I tried everything.

Here is the code of the boss:
Code:
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

namespace GunPulse.NPCs.Boss
{
    public class DragonSlime : ModNPC
    {
        public override void SetDefaults()
        {
            npc.name = "Dragon Slime";
            npc.displayName = "Dragon Slime";
            npc.aiStyle = 3;
            npc.lifeMax = 1000;
            npc.damage = 20;
            npc.defense = 200;
            npc.knockBackResist = 1000;
            npc.width = 162;
            npc.height = 126;
            animationType = NPCID.Zombie;
            Main.npcFrameCount[npc.type] = 2;
            npc.value = Item.buyPrice(0, 40, 75, 42);
            aiType = NPCID.Bunny;
            npc.npcSlots = 1f;
            npc.boss = true;
            npc.lavaImmune = true;
            npc.noGravity = true;
            npc.noTileCollide = false;
            npc.soundHit = 8;
            npc.soundKilled = 14;
            npc.netAlways = true;
        }
        public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
        {
            bossHeadTexture = "GunPulse/NPCs/Boss/DragonSlime_Head_Boss";
        }
        public override void BossLoot(ref string name, ref int potionType)
        {
            potionType = ItemID.GreaterHealingPotion;
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DragonBar"), 23);
        }
        public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
        {
            npc.lifeMax += (int)(npc.lifeMax * 0.579f * bossLifeScale);
            npc.damage += (int)(npc.damage * 0.6f);
        }
    }
}
And here is the sprite of it:
View attachment 118616
Can someone please help me and tell me whats wrong here?
okay new fix for ya, as for the sprite, add in a 3rd frame, that should help, set knockback resistance to 0, and set nogravity to false
for knockback, its out of 1 and is the exact opposite of what you would expect
 
okay new fix for ya, as for the sprite, add in a 3rd frame, that should help, set knockback resistance to 0, and set nogravity to false
for knockback, its out of 1 and is the exact opposite of what you would expect
for the sprite, is a third frame really necessary? or can I make something that only has 2 frames? Also, is there a certain number of pixels determining how far apart each frame should be from one another?
 
for the sprite, is a third frame really necessary? or can I make something that only has 2 frames? Also, is there a certain number of pixels determining how far apart each frame should be from one another?
all frames should be 2 pixels apart, the reason for 3 frames is because you are using a zombie for an animation style the third frame can be the same as another
 
all frames should be 2 pixels apart, the reason for 3 frames is because you are using a zombie for an animation style the third frame can be the same as another
I am making a minion that is a meteor head and every time I summon it, there is this gray bar that appears in between frames. It was set to the raven AI so should I add more frames? or should I fix something in the code?
 
Back
Top Bottom