in order for them to not conflict you can't have two items with the same public classI have public class HeroBlade in 2 cs files, HeroBlade.cs and TestMod.cs, what do I do if I dont want them to conflict?
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Drakus.NPCs
{
public class ForestSkull : ModNPC
{
public override void SetDefaults()
{
npc.name = "Skull of the Forest";
npc.displayName = "Skull of the Forest";
npc.width = 26;
npc.height = 28;
npc.damage = 35;
npc.defense = 12;
npc.lifeMax = 250;
npc.HitSound = SoundID.NPCHit2;
npc.DeathSound = SoundID.NPCDeath3;
npc.value = 37f;
npc.knockBackResist = 0.6f;
npc.aiStyle = 10;
Main.npcFrameCount[npc.type] = 3;
aiType = 10;
animationType = 10;
}
public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
if(NPC.downedBoss1);
return SpawnCondition.OverworldNightMonster.Chance * 1.5f;
}
public override void HitEffect(int hitDirection, double damage)
{
if (npc.life <= 0) //this make so when the npc has 0 life(dead) he will spawn this
{
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ForestSkullGore1"), 1f); //make sure you put the right folder name where your gores is located and the right name of gores
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ForestSkullGore2"), 1f); // 1f is the gore sprite size, you can change it but i suggest to keep it to 1f
}
}
public override void NPCLoot()
{
if (Main.rand.Next(5) == 0)
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bone, Main.rand.Next(1, 2));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vine, Main.rand.Next(0, 1));
}
}
}
}
no.If I make a tModLoader server (but with no mods) will people without tModLoader be able to join it?
oh, k
You probably want to add 'npc.noGravity = true;' to set defaults. You may also want 'npc.noTileCollide = true;' if you want it to pass through the landscape.Guys, I have a very annoying problem. Whenever I try to give an NPC a Cursed Skull AI, it just stays on the ground. Same for all the other floating AIs, such as the Demon Eye AI, ect. I feel like this might be the sprite, but im not sure. Here's the code of my NPC.
Code:using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace Drakus.NPCs { public class ForestSkull : ModNPC { public override void SetDefaults() { npc.name = "Skull of the Forest"; npc.displayName = "Skull of the Forest"; npc.width = 26; npc.height = 28; npc.damage = 35; npc.defense = 12; npc.lifeMax = 250; npc.HitSound = SoundID.NPCHit2; npc.DeathSound = SoundID.NPCDeath3; npc.value = 37f; npc.knockBackResist = 0.6f; npc.aiStyle = 10; Main.npcFrameCount[npc.type] = 3; aiType = 10; animationType = 10; } public override float CanSpawn(NPCSpawnInfo spawnInfo) { if(NPC.downedBoss1); return SpawnCondition.OverworldNightMonster.Chance * 1.5f; } public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) //this make so when the npc has 0 life(dead) he will spawn this { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ForestSkullGore1"), 1f); //make sure you put the right folder name where your gores is located and the right name of gores Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ForestSkullGore2"), 1f); // 1f is the gore sprite size, you can change it but i suggest to keep it to 1f } } public override void NPCLoot() { if (Main.rand.Next(5) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bone, Main.rand.Next(1, 2)); Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vine, Main.rand.Next(0, 1)); } } } }
All help would be appriciated!
You probably want to add 'npc.noGravity = true;' to set defaults. You may also want 'npc.noTileCollide = true;' if you want it to pass through the landscape.
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace NewEvils.Items //The directory for your .cs and .png; Example: Mod Sources/TutorialMOD/Items
{
public class DarkBlade : ModItem
{
public override void SetDefaults()
{
item.name = "Dark Blade"; //the name displayed when hovering over the Weapon ingame.
item.damage = 124; //The damage stat for the Weapon.
item.melee = true; //This defines if it does Melee damage and if its effected by Melee increasing Armor/Accessories.
item.width = 85; //The size of the width of the hitbox in pixels.
item.height = 85; //The size of the height of the hitbox in pixels.
item.toolTip = "The power of dakrness"; //The description of the Weapon shown when hovering over the Weapon ingame.
item.useTime = 20; //How fast the Weapon is used.
item.useAnimation = 20; //How long the Weapon is used for.
item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing for example
item.knockBack = 6; //The knockback stat of your Weapon.
item.value = Item.buyPrice(0, 0, 25, 0); // How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 10gold)
item.rare = 5; //The color the title of your Weapon when hovering over it ingame
item.UseSound = SoundID.Item1; //The sound played when using your Weapon
item.autoReuse = true; //Weather your Weapon will be used again after use while holding down, if false you will need to click again after use to use it again.
}
public override void AddRecipes()
{ //this is how to craft this item
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10); //this is how to add an ingredient from Terraria, so for crafting this item you need 10 Dirt Block
recipe.AddTile(TileID.WorkBenches); //this is where to craft the item ,WorkBenches = all WorkBenches Anvils = all anvils , MythrilAnvil = Mythril Anvil and Orichalcum Anvil, Furnaces = all furnaces , DemonAltar = Demon Altar and Crimson Altar , TinkerersWorkbench = Tinkerer's Workbench
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
This is all fine, you sure this is the exact file it is complaining about?so I am having trouble with my new sword and I am getting these errors
\Documents\My Games\Terraria\ModLoader\Mod Sources\NewEvils\Items\DarkBlade.cs(1,15) : error CS1002: ; expected
Documents\My Games\Terraria\ModLoader\Mod Sources\NewEvils\Items\DarkBlade.cs(37,9) : error CS1585: Member modifier 'override' must precede the member type and name
I don't get what is wrong heres my code (I know about the comments)
Code:using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace NewEvils.Items //The directory for your .cs and .png; Example: Mod Sources/TutorialMOD/Items { public class DarkBlade : ModItem { public override void SetDefaults() { item.name = "Dark Blade"; //the name displayed when hovering over the Weapon ingame. item.damage = 124; //The damage stat for the Weapon. item.melee = true; //This defines if it does Melee damage and if its effected by Melee increasing Armor/Accessories. item.width = 85; //The size of the width of the hitbox in pixels. item.height = 85; //The size of the height of the hitbox in pixels. item.toolTip = "The power of dakrness"; //The description of the Weapon shown when hovering over the Weapon ingame. item.useTime = 20; //How fast the Weapon is used. item.useAnimation = 20; //How long the Weapon is used for. item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing for example item.knockBack = 6; //The knockback stat of your Weapon. item.value = Item.buyPrice(0, 0, 25, 0); // How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 10gold) item.rare = 5; //The color the title of your Weapon when hovering over it ingame item.UseSound = SoundID.Item1; //The sound played when using your Weapon item.autoReuse = true; //Weather your Weapon will be used again after use while holding down, if false you will need to click again after use to use it again. } public override void AddRecipes() { //this is how to craft this item ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.DirtBlock, 10); //this is how to add an ingredient from Terraria, so for crafting this item you need 10 Dirt Block recipe.AddTile(TileID.WorkBenches); //this is where to craft the item ,WorkBenches = all WorkBenches Anvils = all anvils , MythrilAnvil = Mythril Anvil and Orichalcum Anvil, Furnaces = all furnaces , DemonAltar = Demon Altar and Crimson Altar , TinkerersWorkbench = Tinkerer's Workbench recipe.SetResult(this); recipe.AddRecipe(); } } }
Yes this is the file its complaining about. I tried removing the item from items but it kept complaining about it.so I am having trouble with my new sword and I am getting these errors
\Documents\My Games\Terraria\ModLoader\Mod Sources\NewEvils\Items\DarkBlade.cs(1,15) : error CS1002: ; expected
Documents\My Games\Terraria\ModLoader\Mod Sources\NewEvils\Items\DarkBlade.cs(37,9) : error CS1585: Member modifier 'override' must precede the member type and name
I don't get what is wrong heres my code (I know about the comments)
Code:using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace NewEvils.Items //The directory for your .cs and .png; Example: Mod Sources/TutorialMOD/Items { public class DarkBlade : ModItem { public override void SetDefaults() { item.name = "Dark Blade"; //the name displayed when hovering over the Weapon ingame. item.damage = 124; //The damage stat for the Weapon. item.melee = true; //This defines if it does Melee damage and if its effected by Melee increasing Armor/Accessories. item.width = 85; //The size of the width of the hitbox in pixels. item.height = 85; //The size of the height of the hitbox in pixels. item.toolTip = "The power of dakrness"; //The description of the Weapon shown when hovering over the Weapon ingame. item.useTime = 20; //How fast the Weapon is used. item.useAnimation = 20; //How long the Weapon is used for. item.useStyle = 1; //The way your Weapon will be used, 1 is the regular sword swing for example item.knockBack = 6; //The knockback stat of your Weapon. item.value = Item.buyPrice(0, 0, 25, 0); // How much the item is worth, in copper coins, when you sell it to a merchant. It costs 1/5th of this to buy it back from them. An easy way to remember the value is platinum, gold, silver, copper or PPGGSSCC (so this item price is 10gold) item.rare = 5; //The color the title of your Weapon when hovering over it ingame item.UseSound = SoundID.Item1; //The sound played when using your Weapon item.autoReuse = true; //Weather your Weapon will be used again after use while holding down, if false you will need to click again after use to use it again. } public override void AddRecipes() { //this is how to craft this item ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.DirtBlock, 10); //this is how to add an ingredient from Terraria, so for crafting this item you need 10 Dirt Block recipe.AddTile(TileID.WorkBenches); //this is where to craft the item ,WorkBenches = all WorkBenches Anvils = all anvils , MythrilAnvil = Mythril Anvil and Orichalcum Anvil, Furnaces = all furnaces , DemonAltar = Demon Altar and Crimson Altar , TinkerersWorkbench = Tinkerer's Workbench recipe.SetResult(this); recipe.AddRecipe(); } } }
That's not a tModLoader bug, it isn't even a bug at all, it's intentionally made to be that way by Terraria developers. Left-click to buy one item; right-click to buy many.1. Buying stacks of multiple items (which were sold to NPCs) will only decrease the stack quantity by one.
That's not a tModLoader bug, it isn't even a bug at all, it's intentionally made to be that way by Terraria developers. Left-click to buy one item; right-click to buy many.