tModLoader Coding Problems, Please Help.

TheTrueBrawler

Plantera
Can someone help me with my mod. I am trying to make a mod that is a combination of the FrostSpark Boots and Lava Waders.

Code:
c:\Users\...\Items\FrostBurnBoots.cs(43,31) : error CS1026: ) expected
c:\Users\...\Items\FrostBurnBoots.cs(43,35) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(43,35) : error CS1525: Invalid expression term ','
c:\Users\...\Items\FrostBurnBoots.cs(43,37) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(43,38) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(43,38) : error CS1525: Invalid expression term ')'
c:\Users\...\Items\FrostBurnBoots.cs(44,31) : error CS1026: ) expected
c:\Users\...\Items\FrostBurnBoots.cs(44,35) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(44,35) : error CS1525: Invalid expression term ','
c:\Users\...\Items\FrostBurnBoots.cs(44,37) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(44,38) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(44,38) : error CS1525: Invalid expression term ')'
c:\Users\...\Items\FrostBurnBoots.cs(45,31) : error CS1026: ) expected
c:\Users\...\Items\FrostBurnBoots.cs(45,36) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(45,36) : error CS1525: Invalid expression term ','
c:\Users\...\Items\FrostBurnBoots.cs(45,38) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(45,39) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(45,39) : error CS1525: Invalid expression term ')'

Can someone please help me figure out what this means? This is the error message I keep getting when trying to build the mod.
 
If it Helps I will post the current code I am attempting to turn into an item.
Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;

namespace ExampleMod.Items
{
    public class FrostBurnBoots : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Shoes);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "FrostBurn Boots";
            item.width = 72;
            item.height = 61;
            item.toolTip = "Super Cold";
            item.toolTip2 = "Super Hot";
            item.value = 17000;
            item.rare = 10;
            item.accessory = true;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.noFallDmg = true;
            player.moveSpeed = 10f;
            player.canRocket = true;
            player.rocketTime = 2400;
            player.rocketBoots = 2;
            player.rocketTimeMax = 2400;
            player.waterWalk = true;
            player.fireWalk = true;
            player.iceSkate = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.158, 1);
            recipe.AddIngredient(ItemID.908, 1);
            recipe.AddIngredient(ItemID.1862, 1);
            recipe.AddTile(null, "ExampleWorkbench");
            recipe.SetResult(this);
        }
    }
}
 
If it Helps I will post the current code I am attempting to turn into an item.
Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;

namespace ExampleMod.Items
{
    public class FrostBurnBoots : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Shoes);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "FrostBurn Boots";
            item.width = 72;
            item.height = 61;
            item.toolTip = "Super Cold";
            item.toolTip2 = "Super Hot";
            item.value = 17000;
            item.rare = 10;
            item.accessory = true;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.noFallDmg = true;
            player.moveSpeed = 10f;
            player.canRocket = true;
            player.rocketTime = 2400;
            player.rocketBoots = 2;
            player.rocketTimeMax = 2400;
            player.waterWalk = true;
            player.fireWalk = true;
            player.iceSkate = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.158, 1);
            recipe.AddIngredient(ItemID.908, 1);
            recipe.AddIngredient(ItemID.1862, 1);
            recipe.AddTile(null, "ExampleWorkbench");
            recipe.SetResult(this);
        }
    }
}

Use either 158 or ItemID.LuckyHorseshoe. Mixing the two is like translating an English sentence into Spanish and then back into English.

bWTjZ73.png
 
Use either 158 or ItemID.LuckyHorseshoe. Mixing the two is like translating an English sentence into Spanish and then back into English.

bWTjZ73.png

Ok I had changed the 3 numbers to the following:
Code:
recipe.AddIngredient(ItemID.LuckyHorseshoe)
recipe.AddIngredient(ItemID.LavaWaders)
recipe.AddIngredient(ItemID.FrostsparkBoots)
I still got an error message concerning those three lines.
Code:
c:\Users\...\Items\FrostBurnBoots.cs(43,25) : error CS0103: The name 'ItemID' does not exist in the current context
c:\Users\...\Items\FrostBurnBoots.cs(44,25) : error CS0103: The name 'ItemID' does not exist in the current context
c:\Users\...\Items\FrostBurnBoots.cs(45,25) : error CS0103: The name 'ItemID' does not exist in the current context
Here is what I tried and still got the same error message:
  • Lowercased the First Letter in each item.
  • Lowercased the I in "ItemID."
  • Both at the Same Time.
Then I tried this for the crafting Ingredients:
Code:
recipe.AddIngredient.(null, "LuckyHorseshoe", 1)
recipe.AddIngredient.(null, "LavaWaders", 1)
recipe.AddIngredient.(null, "FrostsparkBoots", 1)
The Mod Loaded, but the boots didn't exist.
 
Ok I had changed the 3 numbers to the following:
Code:
recipe.AddIngredient(ItemID.LuckyHorseshoe)
recipe.AddIngredient(ItemID.LavaWaders)
recipe.AddIngredient(ItemID.FrostsparkBoots)
I still got an error message concerning those three lines.
Code:
c:\Users\...\Items\FrostBurnBoots.cs(43,25) : error CS0103: The name 'ItemID' does not exist in the current context
c:\Users\...\Items\FrostBurnBoots.cs(44,25) : error CS0103: The name 'ItemID' does not exist in the current context
c:\Users\...\Items\FrostBurnBoots.cs(45,25) : error CS0103: The name 'ItemID' does not exist in the current context
Here is what I tried and still got the same error message:
  • Lowercased the First Letter in each item.
  • Lowercased the I in "ItemID."
  • Both at the Same Time.
Then I tried this for the crafting Ingredients:
Code:
recipe.AddIngredient.(null, "LuckyHorseshoe", 1)
recipe.AddIngredient.(null, "LavaWaders", 1)
recipe.AddIngredient.(null, "FrostsparkBoots", 1)
The Mod Loaded, but the boots didn't exist.
Do you have using Terraria.ID; at the top of the file?
 
What do you mean?
In programming, when you are referencing a class, you need to inform the programming language where the class is located. In this case, it didn't know about ItemID because it is nested in Terraria.ID, so you need to mention that at the top of the file using what i just told you. All the ExampleMod classes show how to do it.
 
In programming, when you are referencing a class, you need to inform the programming language where the class is located. In this case, it didn't know about ItemID because it is nested in Terraria.ID, so you need to mention that at the top of the file using what i just told you. All the ExampleMod classes show how to do it.
Are you talking about this tutorial (this one has failed me too many times for me to even consider it again), or another one I am unaware about?
 
Are you talking about this tutorial (this one has failed me too many times for me to even consider it again), or another one I am unaware about?
This isn't a tutorial, it's the documentation. I'm talking about ExampleMod. The source is available in the tmodloader thread post, and it has example usage of most hooks. Anyway, just put that line at the top of th .cs file .
 
This isn't a tutorial, it's the documentation. I'm talking about ExampleMod. The source is available in the tmodloader thread post, and it has example usage of most hooks. Anyway, just put that line at the top of th .cs file .
Can you please put the exact line i need to copy paste there, and where I have to place it so I can try again?
 
In the first 3 lines of your code you have:

using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;​

Just add one more line to that:

using Terraria.ID;​
 
Ok I am getting two issues.

- One I dont know what the official ID for tinker's workshop is. Can someone tell me please?
- Two I got another error message.

Code:
c:\Users\...\Items\FrostBurnBoots.cs(47,34) : error CS1026: ) expected
c:\Users\...\Items\FrostBurnBoots.cs(47,38) : error CS1002: ; expected
c:\Users\...\Items\FrostBurnBoots.cs(47,38) : error CS1525: Invalid expression term ')'

Here is the Code I am using for my item.

Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace ExampleMod.Items
{
    public class FrostBurnBoots : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Shoes);
            return true;
        }

        public override void SetDefaults()
        {
            item.name = "FrostBurn Boots";
            item.width = 34;
            item.height = 32;
            item.toolTip = "Super Cold";
            item.toolTip2 = "Super Hot";
            item.value = 17000;
            item.rare = 10;
            item.accessory = true;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.noFallDmg = true;
            player.moveSpeed = 10f;
            player.canRocket = true;
            player.rocketTime = 2400;
            player.rocketBoots = 2;
            player.rocketTimeMax = 2400;
            player.waterWalk = true;
            player.fireWalk = true;
            player.iceSkate = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.LuckyHorseshoe, 1);
            recipe.AddIngredient(ItemID.LavaWaders, 1);
            recipe.AddIngredient(ItemID.FrostsparkBoots, 1);
            recipe.AddTile(TileID.(need Tinker'ws Workshop Official Coding ID));
            recipe.SetResult(this);
        }
    }
}

Can someone help me figure out the problem?
 
I dont know what the official ID for tinker's workshop is. Can someone tell me please?
TileID.TinkerersWorkshop should work. See https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Item-IDs. Either put "TileID.TinkerersWorkshop", or just a number; don't put "TileID.398".

As for your second problem, it's a syntax error because of your placeholder for the Tinkerer's workshop id. Put in the Tinkerer's Workshop, and the second problem should go away.
 
No
TileID.TinkerersWorkshop should work. See https://github.com/bluemagic123/tModLoader/wiki/Vanilla-Item-IDs. Either put "TileID.TinkerersWorkshop", or just a number; don't put "TileID.398".

As for your second problem, it's a syntax error because of your placeholder for the Tinkerer's workshop id. Put in the Tinkerer's Workshop, and the second problem should go away.
I edited that in there. The colored text isn't in my actual code. I got 114 in place of it which is Tinker's Workshop's tile ID according to the Terraria wiki.
 
Oh now i get it. It is TinkerersWorkbench. I didn't know the second "er" was in there, and thougyht it was workshop. So after making that change here is my error message.

Code:
c:\Users\...\Items\FrostBurnBoots.cs(47,35) : error CS0117: 'Terraria.ID.TileID' does not contain a definition for 'TinkerersWorkshop'

You have to type TinkerersWorkbench, not Workshop.
 
I made edits to my post.
[doublepost=1466189243,1466189087][/doublepost]So now its working, but it either isn't applying my item to the game, or is not able to craft it.

You have to end that block with recipe.AddRecipe();
 
Back
Top Bottom