tModLoader Tutorial: [3] Items

i found a Newtonsoft.json.dll is that the same thing and how and why is it a necessity to delete it
Because it's already loaded, so it's a duplicate. If you don't trust it, you can make a backup on your desktop or something. But you'll need to move it out of that folder.
 
This is my error when I try to build the mod:

Items/MyFirstItem
at Terraria.ModLoader.Mod.GetTexture(String name)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

And here is my code:

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

namespace MyFirstMod.Items
{
public class MyFirstItem : ModItem
{
public override void SetDefaults()
{
item.name = "The Nonexistent";
item.damage = 100000;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "This shouldn't exist, but it does.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 6;
item.value = 10000;
item.rare = 11;
item.UseSound = SoundID.NPCDeath53;
item.autoReuse = true;
}

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

Wat do?
 
This is my error when I try to build the mod:

Items/MyFirstItem
at Terraria.ModLoader.Mod.GetTexture(String name)
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

And here is my code:

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

namespace MyFirstMod.Items
{
public class MyFirstItem : ModItem
{
public override void SetDefaults()
{
item.name = "The Nonexistent";
item.damage = 100000;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "This shouldn't exist, but it does.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 6;
item.value = 10000;
item.rare = 11;
item.UseSound = SoundID.NPCDeath53;
item.autoReuse = true;
}

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

Wat do?
Read this: http://forums.terraria.org/index.ph...der-a-modding-api.23726/page-679#post-1122935
 
I've looked everywhere, and I hoped this would help. I wouldn't be exaggerating if I said i've been looking for 3-4 hours now...

How do I add custom critical strike chances to my items?
 
I made some code for custom blaster like meteor blaster, but it is not working.

using Terraria.ID;
using Terraria.ModLoader;

namespace HellsGorge.Items
{
public class StarBlaster : ModItem
{
public override void SetDefaults()
{
item.name = "Star Blaster";
item.damage = 58;
item.width = 40;
item.height = 38;
item.toolTip = "Pew, pew, pew...";
item.useTime = 8;
item.useAnimation = 20;
item.useStyle = 5;
item.useAmmo = 14;
item.knockBack = 10;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item36;
item.autoReuse = true;
item.shoot = 12;
item.ranged = true;
}

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

}
}
What can be wrong with this?
 
I made some code for custom blaster like meteor blaster, but it is not working.

using Terraria.ID;
using Terraria.ModLoader;

namespace HellsGorge.Items
{
public class StarBlaster : ModItem
{
public override void SetDefaults()
{
item.name = "Star Blaster";
item.damage = 58;
item.width = 40;
item.height = 38;
item.toolTip = "Pew, pew, pew...";
item.useTime = 8;
item.useAnimation = 20;
item.useStyle = 5;
item.useAmmo = 14;
item.knockBack = 10;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item36;
item.autoReuse = true;
item.shoot = 12;
item.ranged = true;
}

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

}
}
What can be wrong with this?
What is the error? We can't help if we don't know what the error is.
 
I made some code for custom blaster like meteor blaster, but it is not working.

using Terraria.ID;
using Terraria.ModLoader;

namespace HellsGorge.Items
{
public class StarBlaster : ModItem
{
public override void SetDefaults()
{
item.name = "Star Blaster";
item.damage = 58;
item.width = 40;
item.height = 38;
item.toolTip = "Pew, pew, pew...";
item.useTime = 8;
item.useAnimation = 20;
item.useStyle = 5;
item.useAmmo = 14;
item.knockBack = 10;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item36;
item.autoReuse = true;
item.shoot = 12;
item.ranged = true;
}

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

}
}
What can be wrong with this?

The problem is that my blaster doesn't want to shoot.
 
I can't seem to get the Instant Health Potion to work. I copy pasted all the code and put it in a new item, but no dice.
using Terraria.ID;
using Terraria.ModLoader;

namespace Detharium.Items
{
public class FullHealPotion : ModItem
{
public override void SetDefaults()
{
item.CloneDefaults(ItemID.SuperHealingPotion);
item.name = "Instant health potion";
item.healLife = Main.player[item.owner].statLifeMax2;
}

public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
texture = "Terraria/Item_" + ItemID.SuperHealingPotion;
return true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
c:\Users\udon'tneedtoseemyname\Documents\My Games\Terraria\ModLoader\Mod Sources\Detharium\Items\FullHealPotion.cs(15,76) : error CS0246: The type or namespace name 'IList' could not be found (are you missing a using directive or an assembly reference?)
 
Excuse my ignorance

C: \ Users \Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ GameRemixMOD \ Items \ Frostmourne.cs (34,21): Error CS1518: Expected a class, delegate, enumeration, Struct


Here's the code

namespace GameRemixMOD.Items
{
public class Frostmourne : ModItem
{
public override void SetDefaults()
{
item.name = "Frostmourne";
item.damage = 61;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "Let then come.";
item.useTime = 5;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 6;
item.value = 5;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.2161 5);
recipe.AddIngredient(ItemID.239(3) 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(ItemID.GoldCoin);
recipe.AddRecipe();
}
} public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
target.AddBuff(BuffID.47, 5 * 60);
}
}
 
Excuse my ignorance

C: \ Users \Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ GameRemixMOD \ Items \ Frostmourne.cs (34,21): Error CS1518: Expected a class, delegate, enumeration, Struct


Here's the code

namespace GameRemixMOD.Items
{
public class Frostmourne : ModItem
{
public override void SetDefaults()
{
item.name = "Frostmourne";
item.damage = 61;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "Let then come.";
item.useTime = 5;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 6;
item.value = 5;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.2161 5);
recipe.AddIngredient(ItemID.239(3) 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(ItemID.GoldCoin);
recipe.AddRecipe();
}
} public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
target.AddBuff(BuffID.47, 5 * 60);
}
}
delete the } -> "} public " (and add one to the bottom too I think)

oDfE6d6.png
 
pls help

c:\Users\Roma\Documents\My Games\Terraria\ModLoader\Mod Sources\SwordOfRoma\Items\SwordOfRoma.cs(38,39) : error CS0246: The type or namespace name 'Player' could not be found (are you missing a using directive or an assembly reference?)

c:\Users\Roma\Documents\My Games\Terraria\ModLoader\Mod Sources\SwordOfRoma\Items\SwordOfRoma.cs(38,54) : error CS0246: The type or namespace name 'NPC' could not be found (are you missing a using directive or an assembly reference?)
 
Is there a way to implement an effect where if i hit an enemy or a boss it will deduct a specified amount of Defense? and a percentage for that to happen? Appreciate all help.
 
so i made a sword but it wont build heres the code https://hastebin.com/betiminovo.cpp
and here are the errors
c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(6,28) : error CS1514: { expected

c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(8,41) : error CS1514: { expected

c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(44,10) : error CS1513: } expected

c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(44,10) : error CS1513: } expected
if you could help i would be really happy
 
so i made a sword but it wont build heres the code https://hastebin.com/betiminovo.cpp
and here are the errors
c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(6,28) : error CS1514: { expected

c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(8,41) : error CS1514: { expected

c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(44,10) : error CS1513: } expected

c:\Users\Kids\Documents\My Games\Terraria\ModLoader\Mod Sources\TutorialMod\Items\swordthesword.cs(44,10) : error CS1513: } expected
if you could help i would be really happy

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

namespace TutorialMod.Items
{
public class swordthesword : ModItem
{
public override void SetDefaults()
{
item.name = "sword the sword";
item.damage = 10;
item.melee = true;
item.width = 40;
item.height = 40;
item.tooltip = "this is a starting sword my dudes its for the mele person its kinda fast"
item.usetime = 15;
item.useanimation = 15;
item.usestyle = 1;
item.knockback = 8;
item.value = 10000;
item.rare = 2;
item.usesound = 1;
item.autoreuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Wood, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

This should be the proper code, you were missing out multiple { and } which makes your code exclude your namespace and certain parts of the codes
[doublepost=1499253738,1499253319][/doublepost]
pls help

c:\Users\Roma\Documents\My Games\Terraria\ModLoader\Mod Sources\SwordOfRoma\Items\SwordOfRoma.cs(38,39) : error CS0246: The type or namespace name 'Player' could not be found (are you missing a using directive or an assembly reference?)

c:\Users\Roma\Documents\My Games\Terraria\ModLoader\Mod Sources\SwordOfRoma\Items\SwordOfRoma.cs(38,54) : error CS0246: The type or namespace name 'NPC' could not be found (are you missing a using directive or an assembly reference?)


Can you put the code in your .cs file here
 
Back
Top Bottom