Attempted to divide by zero - Terraria crashing when I try to load my players. (Caused by VanityPet)

CrazieLP

Terrarian
I just made my first little mod for me and my friends to have a custom vanity-pet.
Now whenever I try to click on "single-player", when it is supposed to show my characters, the TMod loader is crashing.

It says it's because it attempted to divide by zero, but I've figured out it's only happening when I have equipped the pet item. So how can I either let the mod show the pet item in the character screen, or don't show it but let it still work?
 
That's something you'd want to report to the mod author. The only workaround I can think of is unequipping your pet every time you are gonna quit the game so it's never shown in the menu.
 
That's something you'd want to report to the mod author. The only workaround I can think of is unequipping your pet every time you are gonna quit the game so it's never shown in the menu.
I am the mod author, it is a small mod I tried to make for me and my friends.
Yes, unequipping it works, but thats annoying, thats why I came here to see if anyone had the same problem and knows the answer. Thanks tho :)
 
Oh in that case, can you post the pet code?
 
Oh in that case, can you post the pet code?
Aah I figured it out. So basically I mostly copied a code I found online since it's my first time making a mod and I don't know what a lot of this stuff does. Here's the part that caused my problem (green):


public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 1;
Main.projPet[Projectile.type] = true;

/*
ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, Main.projFrames[Projectile.type], 0)
.WithOffset(-10, -20f)
.WithSpriteDirection(-1)
.WithCode(DelegateMethods.CharacterPreview.Float);
*/

}

What could have caused this? Is it because I only have one frame for my vanity pet?
 
I'm not familiar with that method, but that would most likely be the issue. It seems like it was trying to set an animation loop, but since there was only 1 frame, there must be an issue with the min / max value being the same.
 
I'm not familiar with that method, but that would most likely be the issue. It seems like it was trying to set an animation loop, but since there was only 1 frame, there must be an issue with the min / max value being the same.
Yeah, thanks anyway!
 
Back
Top Bottom