Standalone [1.3] tModLoader - A Modding API

That's... that's amazing! Thanks!
[doublepost=1469923882,1469923825][/doublepost]Then again using ore would be more real-life like. ;=;
 
public class Circut Board : ModItem
recipe AddIngredient(Terraria.ID.ItemID.Iron Bar, 1);
recipe.AddRecipe(LivenUP.ID.ItemID.Shattered Television, 1)

Just as a general coding note, you can't put spaces in identifiers. You need to remove the spaces from 'Circuit Board', 'Iron Bar', and 'Shattered Television' from each line, respectively.

On a completely trivial note, 'Circut' is misspelled, it should be 'Circuit'. :p
 
recipe AddIngredient(Terraria.ID.ItemID.Iron Bar, 1);
recipe AddTile(Terraria.ID.TileID.Anvil);
While we're at it, you need to remove the spaces after recipe: you are calling the methods AddIngredient and AddTile from the ModRecipe instance named recipe, that's what the period is for.

It doesn't matter if that doesn't make sense, but you do need to remove those spaces or it will give you errors.
 
Last edited:
I'm not American, so idfk how you spell it. I am European, and circut is how I learned to spell it, but since you want it changed, fine.
 
I'm not American, so idfk how you spell it. I am European, and circut is how I learned to spell it, but since you want it changed, fine.

I was only joking around, spell it however you feel most comfortable. :)
 
So then I'm assuming then it has to be for instance, recipe.AddWhatever(thisisuseless), not recipe AddWhatever (thisisuseless)?
[doublepost=1469925381,1469925305][/doublepost]And now to change everything AGAIN....... alright coding sucks what else can I do? :redspin:
[doublepost=1469925543][/doublepost]Also, sell price for 25000 should equal 2 gold 50 silver right?
 
I need to make an animated texture, what do I need to do? I'm making lightning bugs be able to be made into bioluminessence, which I want to pulsate in your inventory.
 
Can anyone tell me how to make a vanilla boss drop a modded item?
 
Can anyone tell me how to make a vanilla boss drop a modded item?
Yes I can and yes I will. :)

First, you need to make a new class, make it a child of GlobalNPC.

Then, put this in it:
Code:
public override void NPCLoot(NPC npc)
{
    if(npc.type == NPCID.BossName)
    {
        Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"), 1);
    }
}
Replace BossName with the name of the boss you want to drop the item, and ItemName with the name of the item you want dropped.

Please let me know if this works for you. ;)
 
Yes I can and yes I will. :)

First, you need to make a new class, make it a child of GlobalNPC.

Then, put this in it:
Code:
public override void NPCLoot(NPC npc)
{
    if(npc.type == NPCID.BossName)
    {
        Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"), 1);
    }
}
Replace BossName with the name of the boss you want to drop the item, and ItemName with the name of the item you want dropped.

Please let me know if this works for you. ;)
Ok, I'll try it, but I'm not sure how to make something a child of something else. Could you tell me how?
 
Ok, I'll try it, but I'm not sure how to make something a child of something else. Could you tell me how?

Yes, after the class declaration, you have to put a colon and then the name of the parent class, namely GlobalNPC.

So, if you were to call this class MyGlobalNPC, you should get something like this:
Code:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace ModName
{
    public class MyGlobalNPC : GlobalNPC
    {
        public override void NPCLoot(NPC npc)
        {
            if(npc.type == NPCID.BossName)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"), 1);
            }
        }
    }
}
 
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](1Enumerable)`1 source, Func`2 predicate)
at Terraria.Modloader.AssemblyManager.InstantiateMods(List`1modsToLoad)
 
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](1Enumerable)`1 source, Func`2 predicate)
at Terraria.Modloader.AssemblyManager.InstantiateMods(List`1modsToLoad)
You don't have a mod class is what this usually is
 
Well why don't you look at the paremeters? I believe, pos x, pos y, type, damage, knockback
From there on I dunno.. but just check the parameters.. lol
Found the parameters under Main. Sort of expected to see them in Player, but I didn't. Well, at least now I know how they spawn the cultists!
 
Yes, after the class declaration, you have to put a colon and then the name of the parent class, namely GlobalNPC.

So, if you were to call this class MyGlobalNPC, you should get something like this:
Code:
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;

namespace ModName
{
    public class MyGlobalNPC : GlobalNPC
    {
        public override void NPCLoot(NPC npc)
        {
            if(npc.type == NPCID.BossName)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"), 1);
            }
        }
    }
}
Hmm... it didn't work... this is the code and the error code:


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

namespace TheOmegaMod.Items.Materials
{
public class MoonlitEssence : ModItem
{
public override void SetDefaults()
{
item.name = "Moonlit Essence";
item.width = 22;
item.height = 22;
item.maxStack = 999;
AddTooltip("Lit by the power of the Moon Lord");
item.value = 750;
item.rare = 10;
}
public override void NPCLoot(NPC npc)
{
if (npc.type == NPCID.MoonLordCore)
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MoonlitEssence"), 7);
}
}
}
}

Error code:

c:\Users\nick\Documents\My Games\Terraria\ModLoader\Mod Sources\TheOmegaMod\Items\Materials\MoonlitEssence.cs(19,30) : error CS0115: 'TheOmegaMod.Items.Materials.MoonlitEssence.NPCLoot(Terraria.NPC)': no suitable method found to override

Any idea of how to fix it?
 
Where do I find the class? In the video I watched Mr. Terrarian I think is how you spell it, he didn't say anything about a class. Sorry for my not as good english, I'm European.
 
Oh nevermind I got it :D Thanks :D
 
@Jeckel What are mod classes and where to find them? I'm almost done with the MAIN crafting recipes, which the main part of the mod is to add a boss with unique items.
 
@Jeckel What are mod classes and where to find them? I'm almost done with the MAIN crafting recipes, which the main part of the mod is to add a boss with unique items.
A Mod class would look like this:

Code:
using Microsoft.Xna.Framework.Graphics;
using Terraria.ModLoader;
using Terraria;
using Microsoft.Xna.Framework;

namespace CaveStory
{
    class CaveStory : Mod
    {
        public CaveStory()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }
    }
}
 
Back
Top Bottom