So what'd Id do wrong with my code?

AJSurfer

Terrarian
This might also be an issue with my file pathing, but it might not, so im just checking the code too
I get these errors

C:\Users\AJ\OneDrive\Documents\My Games\Terraria\tModLoader-preview\..\tModLoader\ModSources\KatanaZeroGenerals\KatanaZeroGenerals.cs(7,16): error CS1001: Identifier expected
C:\Users\AJ\OneDrive\Documents\My Games\Terraria\tModLoader-preview\..\tModLoader\ModSources\KatanaZeroGenerals\KatanaZeroGenerals.cs(7,16): error CS1514: { expected
C:\Users\AJ\OneDrive\Documents\My Games\Terraria\tModLoader-preview\..\tModLoader\ModSources\KatanaZeroGenerals\KatanaZeroGenerals.cs(7,16): error CS1513: } expected
C:\Users\AJ\OneDrive\Documents\My Games\Terraria\tModLoader-preview\..\tModLoader\ModSources\KatanaZeroGenerals\KatanaZeroGenerals.cs(7,23): warning CS0414: The field 'KatanaZeroGenerals.ASSET_PATH' is assigned but its value is never used






C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.GameContent.Creative;

namespace KatanaZeroGenerals.Content.Items.Weapons
{
    internal class Zero_s_Katana : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Zero's Katana");
            Tooltip.SetDefault("Zero's Katana\nHow did you get your hands on this?");
            CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
        }

        public override void SetDefaults()
        {
            Item.width = 32;
            Item.height = 32;

            Item.useStyle = ItemUseStyleID.Swing;
            Item.useTime = 20;
            Item.useAnimation = 20;
            Item.autoReuse = true;

            Item.DamageType = DamageClass.Melee;
            Item.damage = 20;
            Item.knockBack = 3.5f;
            Item.crit = 50;

            Item.value = Item.buyPrice(silver: 80, copper: 50);
            Item.rare = ItemRarityID.Blue;

            Item.UseSound = SoundID.Item1;

        }
        public override void AddRecipes()
        {
            CreateRecipe()
                .AddIngredient(ModContent.ItemType<Zero_s_Katana>(), 8)
                .AddTile(TileID.Anvils)
                .Register();
        }
    }
}


// Alright thats one piece of code there, heres another


using Terraria;
using Terraria.ModLoader;
using Terraria.GameContent.Creative;

namespace KatanaZeroGenerals.Content.Items
{
    internal class Zero_s_Katana : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Zero's Katana");
            Tooltip.SetDefault("Zero's Katana\nHow did you get your hands on this thing?");
            CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 100;
        }
        public override void SetDefaults()
        {
            Item.width = 16;
            Item.height = 16;

            Item.value = Item.buyPrice(copper: 5);
            Item.maxStack = 1;
        }
    }
}




// And another





using Terraria.ModLoader;

namespace KatanaZeroGenerals
{
    public class KatanaZeroGenerals : Mod
    {
        public class string ASSET_PATH = "KatanaZero/Assets/";
    }
}
 
Last edited:
public class string ASSET_PATH = "KatanaZero/Assets/";

This is invalid, a member can't be a class and a string at the same time. Remove the class keyword and it should fix the compile errors.
 
public class string ASSET_PATH = "KatanaZero/Assets/";

This is invalid, a member can't be a class and a string at the same time. Remove the class keyword and it should fix the compile errors.
Worked!
Fixed the code but there is another issue which I don't know how I havent forseen
I named two of my items the same name and now it wont work, so I renamed one of them and now the entire game wont get passed the sandboxing screen
Dont know what it could be though because when I chose a new name I RENAMED EVERYTHING in the code of the item
 
Worked!
Fixed the code but there is another issue which I don't know how I havent forseen
I named two of my items the same name and now it wont work, so I renamed one of them and now the entire game wont get passed the sandboxing screen
Dont know what it could be though because when I chose a new name I RENAMED EVERYTHING in the code of the item
I decided to re code only the sword, but, I cant seem to find it in CheatSheet, my guess is, I screwed something up
I cant seem to figure out how to apply a texture to the weapon, if im not mistaken, the class in my weapons folder in my items folder in my content folder and the PNG file should have the same exact name. If no, then what DO I do to apply a texture to a weapon/class
 
Back
Top Bottom