tModLoader Tutorial: [2] Recipes

This set of error appears when i attempt to Build my Mod here they are
Code:
c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(7,27) : error CS1002: ; expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(19,3) : error CS1519: Invalid token '{' in class, struct, or interface member declaration

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(20,15) : error CS1519: Invalid token '=' in class, struct, or interface member declaration

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(20,21) : error CS1520: Method must have a return type

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(25,5) : error CS1597: Semicolon after method or accessor block is not valid

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(28,1) : error CS1022: Type or namespace definition, or end-of-file expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(6,20) : error CS1514: { expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(6,32) : error CS1002: ; expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(7,2) : error CS1519: Invalid token '{' in class, struct, or interface member declaration
And This is the whole code i have for the recipe
Code:
using Terraria.ID;

namespace TrueTerrariaMod
{
    class TrueTerrariaMod : Mod
    {
        public TrueTerrariaMod()
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient("Star Wrath");
            recipe.AddIngredient("Meowmere");
            recipe.AddIngredient("Fragment", 20);
            recipe.anyFragment = true;
            recipe.AddIngredient("Terra Blade");
            recipe.SetResult(null,"True Terra Blade");
            recipe.AddRecipe();
        }
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }
}
 
This set of error appears when i attempt to Build my Mod here they are
Code:
c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(7,27) : error CS1002: ; expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(19,3) : error CS1519: Invalid token '{' in class, struct, or interface member declaration

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(20,15) : error CS1519: Invalid token '=' in class, struct, or interface member declaration

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(20,21) : error CS1520: Method must have a return type

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(25,5) : error CS1597: Semicolon after method or accessor block is not valid

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\TrueTerrariaMod.cs(28,1) : error CS1022: Type or namespace definition, or end-of-file expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(6,20) : error CS1514: { expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(6,32) : error CS1002: ; expected

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(7,2) : error CS1519: Invalid token '{' in class, struct, or interface member declaration
And This is the whole code i have for the recipe
Code:
using Terraria.ID;

namespace TrueTerrariaMod
{
    class TrueTerrariaMod : Mod
    {
        public TrueTerrariaMod()
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient("Star Wrath");
            recipe.AddIngredient("Meowmere");
            recipe.AddIngredient("Fragment", 20);
            recipe.anyFragment = true;
            recipe.AddIngredient("Terra Blade");
            recipe.SetResult(null,"True Terra Blade");
            recipe.AddRecipe();
        }
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }
}
Looks like you need help understanding syntax:

oDfE6d6.png
 
Looks like you need help understanding syntax:

oDfE6d6.png
This helped alot, i now understand how the Syntax works however, you are doing this in a Weapon folder and i'm using the ModName.cs folder when you open from Mod Sources, so i looked through my weapons and found the one i want to edit and it nearly completely matches your syntax so i have edited and i want to ask if it will work, if so then do i remove the recipe i have placed in ModName.cs? What do i do with that here is the code:
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod.Items.Weapons
{
    public class ExampleSword : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Example Sword";        //The name of your weapon
            item.damage = 250;            //The damage of your weapon
            item.melee = true;            //Is your weapon a melee weapon?
            item.width = 46;            //Weapon's texture's width
            item.height = 54;            //Weapon's texture's height
            item.toolTip = "A Sword Infused With The Power Of Cats, Stars and Terra!";    //The text showed below your weapon's name
            item.useTime = 5;            //The time span of using the weapon. Remember in terraria, 60 frames is a second.
            item.useAnimation = 5;            //The time span of the using animation of the weapon, suggest set it the same as useTime.
            item.useStyle = 1;            //The use style of weapon, 1 for swinging, 2 for drinking, 3 act like shortsword, 4 for use like life crystal, 5 for use staffs or guns
            item.knockBack = 6;            //The force of knockback of the weapon. Maxium is 20
            item.value = 10000;            //The value of the weapon
            item.rare = 11;                //The rarity of the weapon, from -1 to 13
            item.UseSound = SoundID.Item1;        //The sound when the weapon is using
            item.autoReuse = true;            //Whether the weapon can use automaticly by pressing mousebutton
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient("Star Wrath");
            recipe.AddIngredient("Meowmere");
            recipe.AddIngredient("Fragment", 20);
            recipe.anyFragment = true;
            recipe.AddIngredient("Terra Blade");
            recipe.SetResult(null,"True Terra Blade");
            recipe.AddRecipe();
        }
       
        public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 60);        //Add Onfire buff to the NPC for 1 second
        }
   
    }
}
 
This helped alot, i now understand how the Syntax works however, you are doing this in a Weapon folder and i'm using the ModName.cs folder when you open from Mod Sources, so i looked through my weapons and found the one i want to edit and it nearly completely matches your syntax so i have edited and i want to ask if it will work, if so then do i remove the recipe i have placed in ModName.cs? What do i do with that here is the code:
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod.Items.Weapons
{
    public class ExampleSword : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Example Sword";        //The name of your weapon
            item.damage = 250;            //The damage of your weapon
            item.melee = true;            //Is your weapon a melee weapon?
            item.width = 46;            //Weapon's texture's width
            item.height = 54;            //Weapon's texture's height
            item.toolTip = "A Sword Infused With The Power Of Cats, Stars and Terra!";    //The text showed below your weapon's name
            item.useTime = 5;            //The time span of using the weapon. Remember in terraria, 60 frames is a second.
            item.useAnimation = 5;            //The time span of the using animation of the weapon, suggest set it the same as useTime.
            item.useStyle = 1;            //The use style of weapon, 1 for swinging, 2 for drinking, 3 act like shortsword, 4 for use like life crystal, 5 for use staffs or guns
            item.knockBack = 6;            //The force of knockback of the weapon. Maxium is 20
            item.value = 10000;            //The value of the weapon
            item.rare = 11;                //The rarity of the weapon, from -1 to 13
            item.UseSound = SoundID.Item1;        //The sound when the weapon is using
            item.autoReuse = true;            //Whether the weapon can use automaticly by pressing mousebutton
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient("Star Wrath");
            recipe.AddIngredient("Meowmere");
            recipe.AddIngredient("Fragment", 20);
            recipe.anyFragment = true;
            recipe.AddIngredient("Terra Blade");
            recipe.SetResult(null,"True Terra Blade");
            recipe.AddRecipe();
        }
      
        public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 60);        //Add Onfire buff to the NPC for 1 second
        }
  
    }
}
My point was some of your code was incorrect, here, this is your original:
Code:
using Terraria.ID;

namespace TrueTerrariaMod
{
    class TrueTerrariaMod : Mod
    {
        public TrueTerrariaMod()
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient("Star Wrath");
            recipe.AddIngredient("Meowmere");
            recipe.AddIngredient("Fragment", 20);
            recipe.anyFragment = true;
            recipe.AddIngredient("Terra Blade");
            recipe.SetResult(null,"True Terra Blade");
            recipe.AddRecipe();
        }
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }
}
and here is a corrected version. Note that you basically put the AddRecipe Methods in the wrong place. Also note that you don't need to manuall specify all that ModProperties stuff and you should be using Terraria.ID values instead of strings:
Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TrueTerrariaMod
{
    class TrueTerrariaMod : Mod
    {
        public TrueTerrariaMod()
        {
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.StarWrath);
            recipe.AddIngredient(ItemID.Meowmere);
            recipe.AddRecipeGroup("Fragment", 20);
            recipe.AddIngredient(ItemID.TerraBlade);
            recipe.SetResult(null, "TrueTerraBlade");
            recipe.AddRecipe();
        }
    }
}
 
My point was some of your code was incorrect, here, this is your original:
Code:
using Terraria.ID;

namespace TrueTerrariaMod
{
    class TrueTerrariaMod : Mod
    {
        public TrueTerrariaMod()
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient("Star Wrath");
            recipe.AddIngredient("Meowmere");
            recipe.AddIngredient("Fragment", 20);
            recipe.anyFragment = true;
            recipe.AddIngredient("Terra Blade");
            recipe.SetResult(null,"True Terra Blade");
            recipe.AddRecipe();
        }
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }
}
and here is a corrected version. Note that you basically put the AddRecipe Methods in the wrong place. Also note that you don't need to manuall specify all that ModProperties stuff and you should be using Terraria.ID values instead of strings:
Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TrueTerrariaMod
{
    class TrueTerrariaMod : Mod
    {
        public TrueTerrariaMod()
        {
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(this);
            recipe.AddIngredient(ItemID.StarWrath);
            recipe.AddIngredient(ItemID.Meowmere);
            recipe.AddRecipeGroup("Fragment", 20);
            recipe.AddIngredient(ItemID.TerraBlade);
            recipe.SetResult(null, "TrueTerraBlade");
            recipe.AddRecipe();
        }
    }
}
Ok thanks! I'll try this now you have helped alot, i'll be sure to look out for you for any other problems, now last question..... do i keep the code i just gave in the ExampleWeapon.cs?
EDIT: Ok so i tried it and got this error
Code:
c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(30,32) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(30,46) : error CS1503: Argument 1: cannot convert from 'ExampleMod.Items.Weapons.ExampleSword' to 'Terraria.ModLoader.Mod'
-Arctic
 
Last edited:
Ok thanks! I'll try this now you have helped alot, i'll be sure to look out for you for any other problems, now last question..... do i keep the code i just gave in the ExampleWeapon.cs?
EDIT: Ok so i tried it and got this error
Code:
c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(30,32) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments

c:\Users\arcti\Documents\My Games\Terraria\ModLoader\Mod Sources\TrueTerrariaMod\Items\True Terra Blade.cs(30,46) : error CS1503: Argument 1: cannot convert from 'ExampleMod.Items.Weapons.ExampleSword' to 'Terraria.ModLoader.Mod'
-Arctic
I don't know why you brought up ExampleSword, that image I showed you was just to show you the colored rectangles showing the { and }. What I gave you was a complete solution. If you want to add the recipes in the ModItem class, however, you'd have to change "new ModRecipe(this);" to "new ModRecipe(mod);" and change the SetResult thing to SetResult(this);
 
I don't know why you brought up ExampleSword, that image I showed you was just to show you the colored rectangles showing the { and }. What I gave you was a complete solution. If you want to add the recipes in the ModItem class, however, you'd have to change "new ModRecipe(this);" to "new ModRecipe(mod);" and change the SetResult thing to SetResult(this);
Thankyou so so much, i now understand, hopefully the final problem will be solved, are you ok with supplying me with some code if it fails, i brought up ExampleSword (True Terra Blade) because everytime i do the regular code without a modification to True Terra Blade.cs it crashes and has errors relating to True Terra Blade.cs
 
Thankyou so so much, i now understand, hopefully the final problem will be solved, are you ok with supplying me with some code if it fails, i brought up ExampleSword (True Terra Blade) because everytime i do the regular code without a modification to True Terra Blade.cs it crashes and has errors relating to True Terra Blade.cs
The common pitfall people have is assuming .cs filenames matter. Read this: https://forums.terraria.org/index.p...der-a-modding-api.23726/page-679#post-1122935
 
WOW!!!! THIS WHOLE TIME THE CRASHES WERE JUST MY MOD FOLDER CRASHING... But only the sword your recipes were also helping stop some of the crashes!!! it works now!!!!!! i just gotta make the sword and hope for the best! Thanks!
 
Error:
c:\Users\admin\Documents\My Games\Terraria\ModLoader\Mod Sources\MyFirstMod\Items\MyFirstItem.cs(22,9) : error CS1061: 'Terraria.Item' does not contain a definition for 'useSound' and no extension method 'useSound' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)
 
I want to make an upgrade from TutorialSword but i can't get it right

Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
    public class TutorialSword : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("TutorialSword");
            Tooltip.SetDefault("This is a modded sword 2.");
        }
        public override void SetDefaults()
        {
            item.damage = 5;
            item.melee = true;
            item.width = 52;
            item.height = 52;
            item.useTime = 25;
            item.useAnimation = 25;
            item.useStyle = 1;
            item.knockBack = 2;
            item.value = 10000;
            item.rare = 2;
            item.UseSound = SoundID.Item1;
            item.autoReuse = false;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
    public class TutorialSwordUpgrade : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("This is a modded sword upgraded.");  //The (English) text shown below your weapon's name
        }

        public override void SetDefaults()
        {
            item.damage = 50;           //The damage of your weapon
            item.melee = true;          //Is your weapon a melee weapon?
            item.width = 53;            //Weapon's texture's width
            item.height = 53;           //Weapon's texture's height
            item.useTime = 25;          //The time span of using the weapon. Remember in terraria, 60 frames is a second.
            item.useAnimation = 25;         //The time span of the using animation of the weapon, suggest set it the same as useTime.
            item.useStyle = 1;          //The use style of weapon, 1 for swinging, 2 for drinking, 3 act like shortsword, 4 for use like life crystal, 5 for use staffs or guns
            item.knockBack = 3;         //The force of knockback of the weapon. Maxium is 20
            item.value = 12500;         //The value of the weapon
            item.rare = 3;              //The rarity of the weapon, from -1 to 13
            item.UseSound = SoundID.Item1;      //The sound when the weapon is using
            item.autoReuse = true;          //Whether the weapon can use automaticly by pressing mousebutton
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddIngredient(Items.TutorialSword, 1); //The error is here, i don't know what to put.
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
      
    }
}

Can someone tell me what's wrong?


c:\Users\X\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\TutorialSwordUpgrade.cs(35,34) : error CS0119: 'TutorialMod.Items.TutorialSword' es 'tipo', que no es válida en el contexto indicado
 
I want to make an upgrade from TutorialSword but i can't get it right

Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
    public class TutorialSword : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("TutorialSword");
            Tooltip.SetDefault("This is a modded sword 2.");
        }
        public override void SetDefaults()
        {
            item.damage = 5;
            item.melee = true;
            item.width = 52;
            item.height = 52;
            item.useTime = 25;
            item.useAnimation = 25;
            item.useStyle = 1;
            item.knockBack = 2;
            item.value = 10000;
            item.rare = 2;
            item.UseSound = SoundID.Item1;
            item.autoReuse = false;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
    public class TutorialSwordUpgrade : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("This is a modded sword upgraded.");  //The (English) text shown below your weapon's name
        }

        public override void SetDefaults()
        {
            item.damage = 50;           //The damage of your weapon
            item.melee = true;          //Is your weapon a melee weapon?
            item.width = 53;            //Weapon's texture's width
            item.height = 53;           //Weapon's texture's height
            item.useTime = 25;          //The time span of using the weapon. Remember in terraria, 60 frames is a second.
            item.useAnimation = 25;         //The time span of the using animation of the weapon, suggest set it the same as useTime.
            item.useStyle = 1;          //The use style of weapon, 1 for swinging, 2 for drinking, 3 act like shortsword, 4 for use like life crystal, 5 for use staffs or guns
            item.knockBack = 3;         //The force of knockback of the weapon. Maxium is 20
            item.value = 12500;         //The value of the weapon
            item.rare = 3;              //The rarity of the weapon, from -1 to 13
            item.UseSound = SoundID.Item1;      //The sound when the weapon is using
            item.autoReuse = true;          //Whether the weapon can use automaticly by pressing mousebutton
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddIngredient(Items.TutorialSword, 1); //The error is here, i don't know what to put.
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
     
    }
}

Can someone tell me what's wrong?


c:\Users\X\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\TutorialSwordUpgrade.cs(35,34) : error CS0119: 'TutorialMod.Items.TutorialSword' es 'tipo', que no es válida en el contexto indicado
Read this: https://github.com/bluemagic123/tModLoader/wiki/Basic-Recipes
 
I want to make an upgrade from TutorialSword but i can't get it right

Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
    public class TutorialSword : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("TutorialSword");
            Tooltip.SetDefault("This is a modded sword 2.");
        }
        public override void SetDefaults()
        {
            item.damage = 5;
            item.melee = true;
            item.width = 52;
            item.height = 52;
            item.useTime = 25;
            item.useAnimation = 25;
            item.useStyle = 1;
            item.knockBack = 2;
            item.value = 10000;
            item.rare = 2;
            item.UseSound = SoundID.Item1;
            item.autoReuse = false;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
    public class TutorialSwordUpgrade : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("This is a modded sword upgraded.");  //The (English) text shown below your weapon's name
        }

        public override void SetDefaults()
        {
            item.damage = 50;           //The damage of your weapon
            item.melee = true;          //Is your weapon a melee weapon?
            item.width = 53;            //Weapon's texture's width
            item.height = 53;           //Weapon's texture's height
            item.useTime = 25;          //The time span of using the weapon. Remember in terraria, 60 frames is a second.
            item.useAnimation = 25;         //The time span of the using animation of the weapon, suggest set it the same as useTime.
            item.useStyle = 1;          //The use style of weapon, 1 for swinging, 2 for drinking, 3 act like shortsword, 4 for use like life crystal, 5 for use staffs or guns
            item.knockBack = 3;         //The force of knockback of the weapon. Maxium is 20
            item.value = 12500;         //The value of the weapon
            item.rare = 3;              //The rarity of the weapon, from -1 to 13
            item.UseSound = SoundID.Item1;      //The sound when the weapon is using
            item.autoReuse = true;          //Whether the weapon can use automaticly by pressing mousebutton
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 10);
            recipe.AddIngredient(Items.TutorialSword, 1); //The error is here, i don't know what to put.
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
     
    }
}

Can someone tell me what's wrong?


c:\Users\X\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\TutorialSwordUpgrade.cs(35,34) : error CS0119: 'TutorialMod.Items.TutorialSword' es 'tipo', que no es válida en el contexto indicado

Thanks a lot!, i changed
recipe.SetResult(this.GetItem("TutorialSwordUpgrade"));
to
recipe.SetResult(mod.ItemType<Items.TutorialSwordUpgrade>());
 
Hi, I have a problem with putting a material from my mod.



Code:
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.SDMG, 1 );
recipe.AddIngredient(this, Ultimatebar, 5);
recipe.AddIngredient(ItemID.SniperRifle, 1);
recipe.AddIngredient(ItemID.Duck, 2);
recipe.AddTile(TileID.AncientManipulator);
recipe.SetResult(this);
recipe.AddRecipe();
}
 
Hi, I have a problem with putting a material from my mod.



Code:
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.SDMG, 1 );
recipe.AddIngredient(this, Ultimatebar, 5);
recipe.AddIngredient(ItemID.SniperRifle, 1);
recipe.AddIngredient(ItemID.Duck, 2);
recipe.AddTile(TileID.AncientManipulator);
recipe.SetResult(this);
recipe.AddRecipe();
}
https://github.com/blushiemagic/tModLoader/wiki/Basic-Recipes
 
I'm trying to make my item require the fragments, dumb question, but what would the internal IDs for them be?
The ones from the pillars, to be clear
 
Last edited:
Back
Top Bottom