tModLoader Creating a pet. Solid errors

Sapphireus

Official Terrarian
Please, help me!
I've been fighting this for two days. Creating something for the first time. Did on guides and on ExampleMod files. Still, this is it.
20200112173619_1.jpg

using Terraria;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;

namespace Pets.Buffs
{
public class CrimsonMimic : ModBuff
{
public override void SetDefaults() {
// DisplayName and Description are automatically set from the .lang files, but below is how it is done normally.
// DisplayName.SetDefault("Meat chest");
// Description.SetDefault("\"Is it alive?!\"");
Main.buffNoTimeDisplay[Type] = true;
Main.vanityPet[Type] = true;
}

public override void Update(Player player, ref int buffIndex) {
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<MyPlayer>().CrimsonMimic = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[ProjectileType<Projectiles.CrimsonMimic>()] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) {
Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, ProjectileType<Projectiles.CrimsonMimic>(), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
}

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;

namespace Pets.Items
{
public class CrimsonMimic : ModItem
{
public override void SetStaticDefaults() {
// DisplayName and Tooltip are automatically set from the .lang files, but below is how it is done normally.
// DisplayName.SetDefault("Staff of Skulls");
// Tooltip.SetDefault("This subject is very dangerous. But what?");
}

public override void SetDefaults() {
item.CloneDefaults(ItemID.ZephyrFish);
item.shoot = ProjectileType<Projectiles.CrimsonMimic>();
item.buffType = BuffType<Buffs.CrimsonMimic>();
}

public override void AddRecipes() {
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.CrimstoneBlock, 100);
recipe.AddTile(TileID.MeatGrinder);
recipe.SetResult(this);
recipe.AddRecipe();
}

public override void UseStyle(Player player) {
if (player.whoAmI == Main.myPlayer && player.itemTime == 0) {
player.AddBuff(item.buffType, 3600, true);
}
}
}
}

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Pets.Projectiles
{
public class CrimsonMimic : ModProjectile
{
public override void SetStaticDefaults() {
// DisplayName.SetDefault("Meat chest"); // Automatic from .lang files
Main.projFrames[projectile.type] = 4;
Main.projPet[projectile.type] = true;
}

public override void SetDefaults() {
projectile.CloneDefaults(ProjectileID.ZephyrFish);
aiType = ProjectileID.ZephyrFish;
}

public override bool PreAI() {
Player player = Main.player[projectile.owner];
player.zephyrfish = false; // Relic from aiType
return true;
}

public override void AI() {
Player player = Main.player[projectile.owner];
MyPlayer modPlayer = player.GetModPlayer<MyPlayer>();
if (player.dead) {
modPlayer.CrimsonMimic = false;
}
if (modPlayer.CrimsonMimic) {
projectile.timeLeft = 2;
}
}
}
}

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

namespace Pets
{
public class MyPlayer : ModPlayer
{
private const int saveVersion = 0;
public bool CrimsonMimic;
public static bool hasProjectile;

public override void ResetEffects()
{;
CrimsonMimic = false;
}
}
}

Безымянный.jpg
Безымянный.jpg
Безымянный.jpg
Безымянный.jpg

Help who can, please...

P.S. And please explain how to make it move like a normal mimic, and not fly like a fish
 
Last edited:
My English is bad, my programming is bad... So if someone thinks that what I presented is easily fixable(or the situation itself is ridiculous), I will understand. But I really, really need help. I have already searched the entire Internet in search of a solution to this problem. Nothing. It's like I'm missing something. Or am I just a fool.
P.S. Plus... I know it's not an excuse, but I'm a girl. Maybe that's also why it's stupidly difficult for me...`:sigh:
 
Try retyping all of your namespaces and folder names. Even if nothing looks wrong, it might just work and/or reveal some mistake.
If that doesn't work, try slowly rebuilding the mod from the ground up. Move the Pets folder out of your Mod Sources folder and slowly add things back to a new Pets folder, rebuilding the mod every time until either the error returns or it works.
 
Try retyping all of your namespaces and folder names. Even if nothing looks wrong, it might just work and/or reveal some mistake.
If that doesn't work, try slowly rebuilding the mod from the ground up. Move the Pets folder out of your Mod Sources folder and slowly add things back to a new Pets folder, rebuilding the mod every time until either the error returns or it works.
Okay, I'll try. There will be results, I will subscribe.
 
Try retyping all of your namespaces and folder names. Even if nothing looks wrong, it might just work and/or reveal some mistake.
If that doesn't work, try slowly rebuilding the mod from the ground up. Move the Pets folder out of your Mod Sources folder and slowly add things back to a new Pets folder, rebuilding the mod every time until either the error returns or it works.
No result. Still the same.
 
Back
Top Bottom