TheTrueBrawler
Plantera
item.width = 96;
item.height = 96;
This is the hitbox of your sword.
No, 96x96 is the same as 480x480.
item.width = 96;
item.height = 96;
This is the hitbox of your sword.
hmm, looks like for a sword, it's hitbox is the product of the texture width and height with the item.scaleNo, 96x96 is the same as 480x480.
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace Adirinksmod_test.Items.Weapons //where is located
{
public class EctoplasmSword : ModItem
{
public override void SetDefaults()
{
item.name = "Ectoplasm Sword"; //Sword name
item.damage = 69; //Sword damage
item.melee = true; //if it's melee
item.width = 70; //Sword width
item.height = 70; //Sword height
item.toolTip = "It shoots swords."; //Item Description
item.useTime = 50; //how fast
item.useAnimation = 45;
item.useStyle = 1; //Style is how this item is used, 1 is the style of the sword
item.knockBack = 8; //Sword knockback
item.value = 500000;
item.rare = 7;
item.useSound = 1; //1 is the sound of the sword
item.autoReuse = true; //if it's capable of autoswing.
item.useTurn = true;
item.shoot = mod.ProjectileType("EctoplasmSword_Pro");
item.shootSpeed = 10.7f; //projectile speed
}
public override void AddRecipes() //How to craft this sword
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.ChlorophyteSaber, 1);
recipe.AddIngredient(OriciliumBar, 15);
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(1) == 0)
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("EctoplasmSword_dust"));
}
}
}
}
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Adirinksmod_test.Items
{
public class OriciliumBar : ModItem
{
public override void SetDefaults()
{
item.name = "Oricilium Bar";
item.width = 30;
item.height = 24;
item.maxStack = 999;
AddTooltip("Bar made from Oricilium ore");
item.value = 100;
item.rare = 6;
}
}
}
I'm not completely sure if this is the problem you mean, but I assume you mean this:Hello, I am all new to this but I made a mod with a sword being crafted from an Ore I made, and I know that I cant just type the name of the item there but I dont what to type there.
Code of my sword
Code:using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace Adirinksmod_test.Items.Weapons //where is located { public class EctoplasmSword : ModItem { public override void SetDefaults() { item.name = "Ectoplasm Sword"; //Sword name item.damage = 69; //Sword damage item.melee = true; //if it's melee item.width = 70; //Sword width item.height = 70; //Sword height item.toolTip = "It shoots swords."; //Item Description item.useTime = 50; //how fast item.useAnimation = 45; item.useStyle = 1; //Style is how this item is used, 1 is the style of the sword item.knockBack = 8; //Sword knockback item.value = 500000; item.rare = 7; item.useSound = 1; //1 is the sound of the sword item.autoReuse = true; //if it's capable of autoswing. item.useTurn = true; item.shoot = mod.ProjectileType("EctoplasmSword_Pro"); item.shootSpeed = 10.7f; //projectile speed } public override void AddRecipes() //How to craft this sword { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ChlorophyteSaber, 1); recipe.AddIngredient(OriciliumBar, 15); recipe.AddTile(TileID.WorkBenches); //at work bench recipe.SetResult(this); recipe.AddRecipe(); public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.Next(1) == 0) { int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("EctoplasmSword_dust")); } } } }
Code of my item
Code:using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace Adirinksmod_test.Items { public class OriciliumBar : ModItem { public override void SetDefaults() { item.name = "Oricilium Bar"; item.width = 30; item.height = 24; item.maxStack = 999; AddTooltip("Bar made from Oricilium ore"); item.value = 100; item.rare = 6; } } }
recipe.AddIngredient(OriciliumBar, 15);
recipe.AddIngredient(mod.ItemType("OriciliumBar"), 15);
Thanks! I didint know it was so easy I looked everywhere and I couldnot find it. Thank you once more!I'm not completely sure if this is the problem you mean, but I assume you mean this:
That will not work. The correct format is this:Code:recipe.AddIngredient(OriciliumBar, 15);
Code:recipe.AddIngredient(mod.ItemType("OriciliumBar"), 15);
namespace (mod name).Items
Are you getting an error when trying to build/reload your mod? Is your mod loaded, but it doesn't show anything in game?Ok I got a major issue. My mod in general is failing to work, and I don't see what it is. I know for a fact that it is not my items because I tested them over in another mod changing the mod name in each item on the following line.
Why is my mod not working?Code:namespace (mod name).Items
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace MarcinMod.NPCs
{
public class ForestMage : ModNPC
{
public override void SetDefaults()
{
npc.name = "ForestMage";
npc.displayName = "Forest Mage";
npc.soundHit = 1;
npc.soundKilled = 1;
npc.aiStyle = 8;
npc.lifeMax = 125;
npc.damage = 20;
npc.defense = 70;
npc.knockBackResist = 0.5f;
npc.width = 50; //22
npc.height = 75; //18
aiType = NPCID.Tim;
animationType = NPCID.Tim;
Main.npcFrameCount[npc.type] = 3;
npc.value = Item.buyPrice(0, 0, 5, 45);
npc.npcSlots = 1f;
npc.netAlways = true;
}
}
}
Nope. What happens is that there is no error message, I can turn it on and off like any other mod, but the items seize to exist. I can't craft them, or get them from the creative inventory from Hero's Mod which is compatible with other mods.Are you getting an error when trying to build/reload your mod? Is your mod loaded, but it doesn't show anything in game?
Do you have a class that derives from Mod in your mods rootfolder and does it set Autoload to true?Nope. What happens is that there is no error message, I can turn it on and off like any other mod, but the items seize to exist. I can't craft them, or get them from the creative inventory from Hero's Mod which is compatible with other mods.
?Do you have a class that derives from Mod in your mods rootfolder and does it set Autoload to true?
How to Change color of this
Code:using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace MarcinMod.NPCs { public class ForestMage : ModNPC { public override void SetDefaults() { npc.name = "ForestMage"; npc.displayName = "Forest Mage"; npc.soundHit = 1; npc.soundKilled = 1; npc.aiStyle = 8; npc.lifeMax = 125; npc.damage = 20; npc.defense = 70; npc.knockBackResist = 0.5f; npc.width = 50; //22 npc.height = 75; //18 aiType = NPCID.Tim; animationType = NPCID.Tim; Main.npcFrameCount[npc.type] = 3; npc.value = Item.buyPrice(0, 0, 5, 45); npc.npcSlots = 1f; npc.netAlways = true; } } }
You have a folder in Mod Source which contains all you mod items, NPCs, etc. Does this folder contain a class that is named the same as the folder?
Look at the ExampleMod. In the root folder of the ExampleMod (called ExampleMod) is a file that is called ExampleMod.cs. This is the file I'm referring to. You'll want to copy this class over to your mod, change every instance of ExampleMod to your own mod name and remove all code inside the class, exept the one that is now named the same as your mod.I got no idea what you mean, but if you need to know here's a download link to my folder on the mod.
Forest, Underworld and Ocean all don't have flags in Terrarias Code. Instead there's other things you need to check.I don't exactly have a problem with my code but I'm not sure what all the 'zones' are in Terraria. I have certain items which I want to be dropped in certain biomes or 'zones' but there are two which I don't know the name for, well I do but not for the code.
Hell / Underworld - I tried .ZoneUnderworld and I also tried .ZoneHell neither work
and
Forest - I tried .ZoneForest which doesn't work so I'm using .ZoneJungle
So what should I put if Forest and Underworld don't have flags?Forest, Underworld and Ocean all don't have flags in Terrarias Code. Instead there's other things you need to check.
Forest - The player is in a forest, when no other biome flag is set and if they are overground, but still below sky height.
Underworld - The player is in the Underworld, if they are near the bottom of the world. The exact y-Coordinate differs depending on world size.
Ocean - The player is in the Ocean, if they are close to the eastern/western edge of the map and are neither underground nor in the sky.