tModLoader Why don't my mod items show up.

TMC

Brain of Cthulhu
I'm a noob when it comes to making mods so its probably just me being dumb. I was making an item just as a test so I can practice with tmodloader. The mod with the description and everything showed up but the items didn't. I kept retrying to the point where i just copied and pasted the code from bluemagic's example mod but even that didn't work. Did i do something wrong or do i have to add something else.
 
I'm a noob when it comes to making mods so its probably just me being dumb. I was making an item just as a test so I can practice with tmodloader. The mod with the description and everything showed up but the items didn't. I kept retrying to the point where i just copied and pasted the code from bluemagic's example mod but even that didn't work. Did i do something wrong or do i have to add something else.
If you're saying 'didn't show up' I'm going to assume you were unable to craft it.
If this is the case, you'll want to make sure you've got a class that derives from Mod in your project. In this class is a function that will allow you to set 'Autoload' to true. What this does is that it will allow each and every item to load by itself (instead of you loading every item manually, which is a pain). Allow me to show you the most basic class that derives from Mod:
Code:
using System;

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace YourModNamespace
{
    public class YourModName : Mod
    {
        public override void SetModInfo(out string name, ref ModProperties properties)
        {
            name = "YourModName";
            properties.Autoload = true;
            properties.AutoloadGores = true;
            properties.AutoloadSounds = true;
        }
    }
}
Now there are two instances you want to replace: 'YourModNamespace' should be changed to your root namespace and 'YourModName' should be changes to the name of your mod WITHOUT any spaces or funny stuff like ' / ; [ . ] etc.
 
It keeps getting this message

Missing texture Project2/Items/Weapons/Ak_47
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

sorry if this is getting annoying
[DOUBLEPOST=1452593033,1452592965][/DOUBLEPOST]this is the code

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Project2.Items.Weapons
{
public class Ak_47 : ModItem
{
public override void SetDefaults ()
{
item.name = "Ak-47";
item.damage = 50;
item.ranged = true;
item.width = 40;
item.height = 20;
item.toolTip = "Just an everyday Ak-47.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 4;
item.value = 10000;
item.rare = 2;
item.useSound = 11;
item.autoReuse = true;
item.shoot = 10; //idk why but all the guns in the vanilla source have this
item.shootSpeed = 16f;
item.useAmmo = ProjectileID.Bullet;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
As you can see, like i said before, it's all basically copied and pasted.
 
It keeps getting this message

Missing texture Project2/Items/Weapons/Ak_47
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

sorry if this is getting annoying
[DOUBLEPOST=1452593033,1452592965][/DOUBLEPOST]this is the code

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Project2.Items.Weapons
{
public class Ak_47 : ModItem
{
public override void SetDefaults ()
{
item.name = "Ak-47";
item.damage = 50;
item.ranged = true;
item.width = 40;
item.height = 20;
item.toolTip = "Just an everyday Ak-47.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 4;
item.value = 10000;
item.rare = 2;
item.useSound = 11;
item.autoReuse = true;
item.shoot = 10; //idk why but all the guns in the vanilla source have this
item.shootSpeed = 16f;
item.useAmmo = ProjectileID.Bullet;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
As you can see, like i said before, it's all basically copied and pasted.
This means that it cannot find the texture for your item, double check your spelling ;)
 
There is a problem with the animation. I don't know if its the sprite or the code but how do I put the gun more towards the player so it looks like he's actually holding it?
Capture.PNG
 
Once again sorry if this is getting annoying, but i think i found what I need. If it is HoldoutOffset() than where in the code would i put it.
 
Once again sorry if this is getting annoying, but i think i found what I need. If it is HoldoutOffset() than where in the code would i put it.
Ah, that must be a new function (I haven't really had the time to look at those yet). Judging from the wiki that'd be the way to go, yeah!
 
no, ill try it right now
[DOUBLEPOST=1452730220,1452730088][/DOUBLEPOST]it worked, thanks
 
is there something i need to add to make the npcs spawn, like how i needed to add that recipe thing?
 
I have finished my GameDevelopment bachelor... Other than that, Unity3D is a Nice place to learn the C# syntax.

You will need to override the CanSpawn function on your NPC in question (look on the tModLoader wiki).
 
Back
Top Bottom