Standalone [1.3] tModLoader - A Modding API

Again crashing at 'Settings up' when I add my own set armor ;/

Nevermind, yet again I'm a moron. Forgetting to rename a bunch of ExampleMod to my own mod name. ;/
 
Alright, my concept is basically in for now.
So.. the set armor increases your armor based on missing health. On top of that they provide some extra hp, immunity and a little bit more speed.
Now the combo here is that the mod weapon's deal more damage based on your armor/bonus armor.. :D Pretty cool eh?
 
Can i ask something. I've started coding my own mod. So fair everything is going well.. got crafting recipes for new items i wanna add in. they work and show up.

Now i wanna use those new items to make things with. But the recipes won't show up.. I've got them in my mod. Can see them written out but nothing in game that requires any new items. Any clues?
Example:
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.Cobweb, 10);
recipe.AddIngredient(ItemID.SlimeBlock, 5);
recipe.SetResult(null, "SlimeySilk", 1);
recipe.AddRecipe();
 
If that's your first recipe you must do this:
Code:
ModRecipe recipe = new ModRecipe(this);

any recipe after that goes like this:
Code:
recipe = new ModRecipe(this);
 
Its isn't my first recipe :D Its one down a list. I just pulled a random recipe for an example.

Not sure why its not loading thou cause all the recipes using base game items work and will create my items..
 
what do you mean by add recipes from ModItem? also can i use items i made in the mod and use them to craft things?

Yes you can:

Code:
recipe.AddIngredient(null, "Name here", 5);

Change 5 to the amount required
"Name here corresponds to:

Code:
AddItem("Name here", new ClassNameHere(), "ModName/Items/Namehere");
 
Ok so heres what i got

SetGlobalItem(new TerrariaUnleashedItem());
AddItem("SlimeBlock", new SlimeBlock(), "TerrariaUnleashed/Items/SlimeBlock");

Followed by

recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.Cobweb, 10);
recipe.AddIngredient(ItemID.SlimeBlock, 5);
recipe.SetResult(null, "SlimeySilk", 1);
recipe.AddRecipe();

Now the recipe above is my 3rd recipe.. the 2 above are using only base terraria items and work fine.
 
There we go, progress. fixed the recipe errors, it was a simple spelling error. Now when i do using HuntersMod.Items it says the items type or namespace does not exist, where do i call/declare items, or am i going about this the wrong way. thank you again.
Hm, can I see the code for your Mod class and your GlobalItem class?

Can i ask something. I've started coding my own mod. So fair everything is going well.. got crafting recipes for new items i wanna add in. they work and show up.

Now i wanna use those new items to make things with. But the recipes won't show up.. I've got them in my mod. Can see them written out but nothing in game that requires any new items. Any clues?
Example:
Are you saying that some recipes are working but other ones aren't?

what do you mean by add recipes from ModItem? also can i use items i made in the mod and use them to craft things?
I mean that there will be a hook in ModItem to add recipes, to reduce the clutter in the Mod class.
 
I can't say if they arenb't working.

The compile doesn't show issues when making it. The recipes for anything Only using base Terraria items works fine.

But any recipes using 1 or more of my Own made items as an ingredient aren't showing up when i have the items in my inventory.

So yes the recipes aren't working
 
I can't say if they arenb't working.

The compile doesn't show issues when making it. The recipes for anything Only using base Terraria items works fine.

But any recipes using 1 or more of my Own made items as an ingredient aren't showing up when i have the items in my inventory.

So yes the recipes aren't working
Hm, it's hard to tell what the problem is without the rest of the code. Several things to watch out for:
If something is wrong with the result item itself, the recipe won't show up.
Recipes must be placed in the AddRecipes method (from your last post it looks like they're in the Load method).
 
Ok. Heres my base file

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

namespace TerrariaUnleashed
{
public class TerrariaUnleashed : Mod
{
public override void SetModInfo(out string name, ref string version, ref string author)
{
name = "Terraria Unleashed";
version = "v0.0.1 Alpha Build";
author = "Dark King Joey";
}

public override void Load()
/**
This is Adding Items to Game Section
**/
{
SetGlobalItem(new GlobalItem());
AddItem("SlimeBlock", new SlimeBlock(), "TerrariaUnleashed/Items/SlimeBlock");
AddItem("SlimeAlter", new SlimeAlter(), "TerrariaUnleashed/Items/SlimeAlter");
AddItem("MBottle", new MBottle(), "TerrariaUnleashed/Items/MBottle");
AddItem("InfusedCloth", new InfusedCloth(), "TerrariaUnleashed/Items/InfusedCloth");
AddItem("InfusedLeather", new InfusedLeather(), "TerrariaUnleashed/Items/InfusedLeather");
AddItem("SlimeySilk", new SlimeySilk(), "TerrariaUnleashed/Items/SlimeySilk");
/**
AddItem("SlimeHat", new SlimeHat(), "TerrariaUnleashed/Items/Armor/SlimeHat");
AddItem("SlimeHood", new SlimeHood(), "TerrariaUnleashed/Items/Armor/SlimeHood");
AddItem("SlimeRobe", new SlimeRobe(), "TerrariaUnleashed/Items/Armor/SlimeRobe");
AddItem("SlimeLegs", new SlimeLegs(), "TerrariaUnleashed/Items/Armor/SlimeLegs");


AddEquipTexture(EquipType.Head, SlimeHat.texture);
AddEquipTexture(EquipType.Head, SlimeHood.texture);
AddEquipTexture(EquipType.Body, SlimeRobe.texture, SlimeRobe.armTexture, SlimeRobe.femaleTexture);
AddEquipTexture(EquipType.Legs, SlimeLegs.texture);
**/

}

public override void AddRecipes()
{

ModRecipe
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddIngredient(ItemID.Gel, 1);
recipe.SetResult(null, "SlimeBlock", 10);
recipe.AddRecipe();

recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.ManaPotion, 10);
recipe.SetResult(null, "MBottle", 1);
recipe.AddRecipe();
/**
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.SlimeBlock, 5);
recipe.AddIngredient(ItemID.StoneBlock, 5);
recipe.AddIngredient(ItemID.Wood, 5);
recipe.SetResult(null, "SlimeAlter", 1);
recipe.AddRecipe();

recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.Leather, 2);
recipe.AddIngredient(ItemID.MBottle, 1);
recipe.SetResult(null, "InfusedLeather", 1);
recipe.AddRecipe();
**/
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.MBottle, 1);
recipe.SetResult(null, "InfusedCloth", 1);
recipe.AddRecipe();


RecipeHolder.AddEquipmentRecipes(this);

}
}
}
 
Ok so heres what i got



Followed by



Now the recipe above is my 3rd recipe.. the 2 above are using only base terraria items and work fine.

Is that recipe meant to be using the slime block from your mod or the one from vanilla terraria?

To add items from your mod as ingredients use:

Code:
recipe.AddIngredient(null, "SlimeBlock", 5);
As ItemID.SlimeBlock refers to the vanilla slime block.
 
Is the code to make a recipe use a work bench this?

recipe.requiredTile[0] = TileID.Workbench;

Or have i done something wrong with that?
 
Is the code to make a recipe use a work bench this?

recipe.requiredTile[0] = TileID.Workbench;

Or have i done something wrong with that?
It looks like the correct name is TileID.WorkBenches
Also, as shown in the docs, the ModRecipe has an AddTile method you can use. Either way works.
 
Hm, can I see the code for your Mod class and your GlobalItem class?
Ok, so i had been trying to implement a new accessory, but i think that was causing problems on its own, i just rewrote 90% of my code and have come back to the same error of the namespace not being found. here are the three .cs pages im using.
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using WyvernCore.Items;

namespace WyvernCore {
public class WyvernCore : Mod
{
public override void SetModInfo(out string name, ref string version, ref string author)
{
name = "WyvernStuff";
version = "v0.0.0.1";
author = "WyvernHunter";
}

public override void Load()
{
SetGlobalItem(new WyvernCoreItem());
AddItem("FeatherBlade", new FeatherBlade(), "WyvernCore/Items/FeatherBlade");

}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock);
recipe.SetResult(null, "FeatherBlade");
recipe.AddRecipe();
}
}
}
using System;
using Terraria.ID;
using Terraria.ModLoader;

namespace WyvernCore {
public static class RecipeHelper
{
public static void AddEquipmentRecipes(Mod mod)
{
ModRecipe recipe = new ModRecipe(mod);

}

}
}
using System;
using Terraria;
using Terraria.ModLoader;

namespace WyvernCore.Items {
public class FeatherBlade : ModItem
{
public override void SetDefaults()
{
item.name = "Feathery Blade";
item.damage = 45;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "Doesn't seem very sharp...";
item.useTime = 18;
item.useAnimation = 18;
item.useStyle = 1;
item.knockBack = 8;
item.value = 20000;
item.rare = 2;
item.useSound = 1;
item.autoReuse = true;
}
}
}
The FeatherBlade.png is located in the Items folder with FeatherBlade.cs and the Items Folder is in the WyvernCore folder, that is all i have. Thank you for your patience.
 
Ok, so i had been trying to implement a new accessory, but i think that was causing problems on its own, i just rewrote 90% of my code and have come back to the same error of the namespace not being found. here are the three .cs pages im using.
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using WyvernCore.Items;

namespace WyvernCore {
public class WyvernCore : Mod
{
public override void SetModInfo(out string name, ref string version, ref string author)
{
name = "WyvernStuff";
version = "v0.0.0.1";
author = "WyvernHunter";
}

public override void Load()
{
SetGlobalItem(new WyvernCoreItem());
AddItem("FeatherBlade", new FeatherBlade(), "WyvernCore/Items/FeatherBlade");

}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock);
recipe.SetResult(null, "FeatherBlade");
recipe.AddRecipe();
}
}
}
using System;
using Terraria.ID;
using Terraria.ModLoader;

namespace WyvernCore {
public static class RecipeHelper
{
public static void AddEquipmentRecipes(Mod mod)
{
ModRecipe recipe = new ModRecipe(mod);

}

}
}
using System;
using Terraria;
using Terraria.ModLoader;

namespace WyvernCore.Items {
public class FeatherBlade : ModItem
{
public override void SetDefaults()
{
item.name = "Feathery Blade";
item.damage = 45;
item.melee = true;
item.width = 40;
item.height = 40;
item.toolTip = "Doesn't seem very sharp...";
item.useTime = 18;
item.useAnimation = 18;
item.useStyle = 1;
item.knockBack = 8;
item.value = 20000;
item.rare = 2;
item.useSound = 1;
item.autoReuse = true;
}
}
}
The FeatherBlade.png is located in the Items folder with FeatherBlade.cs and the Items Folder is in the WyvernCore folder, that is all i have. Thank you for your patience.
Wait, so you're trying to create a new WyvernCoreItem() when that class doesn't actually exist?

I may look like a Moron, but is there a way to increase the range of a tool? o:
In the SetDefaults method, you can modify item.tileBoost.
 
Back
Top Bottom