tModLoader Official tModLoader Help Thread

Yep 100% sure i clicked on mods have it enabled reloaded i got into the mod source menu build+ reload there too it doesn't show up <O>
Have you replaced the ingredients for 1 dirt block and removed the required tiles? It should show up
Otherwise it means your item is not registrered
 
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}


It looks like this now o= is that right??


EDIT

I removed the need of the anvil and it still doesn't show up
 
Last edited:
If i do that it gives me a new error


c:\Users\Izzy\Documents\My Games\Terraria\ModLoader\Mod Sources\Hardmode Arkhalis\Items\Eclipse.cs(30,30) : error CS0118: 'Eclipse.Items.Eclipse' is a 'type' but is used like a 'variable'
 
Alright did that too... still not working .... i can't craft it no matter what i try Dx .... i guess it really is not registered for some reason x.x'
 
Sure thing

Here it goes

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

namespace Eclipse.Items {
public class Eclipse : ModItem
{
public override void SetDefaults()
{
item.name = "Eclipse";
item.toolTip = "A sword imbued with enormous Power";
item.knockBack = 1;
item.damage = 49;
item.melee = true;
item.useSound = 9;
item.useAnimation = 30;
item.useTime = 16;
item.useStyle = 5;
item.width = 34;
item.height = 38;
item.value = 100;
item.rare = 7;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.SetResult(Eclipse, 1);
recipe.AddRecipe();
}
}
}
 
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Eclipse.Items
{
    public class Eclipse : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Eclipse";
            item.toolTip = "A sword imbued with enormous Power";
            item.knockBack = 1;
            item.damage = 49;
            item.melee = true;
            item.useSound = 9;
            item.useAnimation = 30;
            item.useTime = 16;
            item.useStyle = 5;
            item.width = 34;
            item.height = 38;
            item.value = 100;
            item.rare = 7;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 1);
            recipe.SetResult(this, 1);
            recipe.AddRecipe();
        }
    }
}
Change Eclipse to this
Final Code
 
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Eclipse.Items
{
    public class Eclipse : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Eclipse";
            item.toolTip = "A sword imbued with enormous Power";
            item.knockBack = 1;
            item.damage = 49;
            item.melee = true;
            item.useSound = 9;
            item.useAnimation = 30;
            item.useTime = 16;
            item.useStyle = 5;
            item.width = 34;
            item.height = 38;
            item.value = 100;
            item.rare = 7;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 1);
            recipe.SetResult(this, 1);
            recipe.AddRecipe();
        }
    }
}
Change Eclipse to this
Final Code


Didn't work :/ Even used a new character and new worls.... i don't know what's wrong but no matter what it just doesn't want to work >-<
 
May I suggest one thing to add to snippets?
If so, then it would be handy for beginners who don't want to bother with placing the projectile at the correct position.
Code:
float angle = (float)Math.Atan(speedY/speedX);
Vector2 projPos = new Vector2(position.X+75f*(float)Math.Cos(angle), position.Y+75f*(float)Math.Sin(angle));
float mouseX = (float)Main.mouseX + Main.screenPosition.X;
if(mouseX < player.position.X)
{
    projPos = new Vector2(position.X-75f*(float)Math.Cos(angle), position.Y-75f*(float)Math.Sin(angle));
}
//Just change the 75f if it's too far or too close
Projectile.NewProjectile(projPos.X, projPos.Y, ...) //the projectile
 
Last edited:
Where can I find info about what player variables to use? Where can I find info about settings of all vanilla items?
I want to create boots accessories that can run a bit faster than frostspark/lightning.

Edit: Got the answer in another thread. Thanks.
 
Last edited:
I have an issue with getting some code to work how I want it to. I want demons to drop a piece of Hellstone every time they die. Here's my current code.

namespace MyMod.NPCs
{
public class HellstoneDrop : Terraria.ModLoader.GlobalNPC
{
public override void NPCLoot(Terraria.NPC npc)
{
if (npc.value > 0f && target.type == Terraria.ID.NPCID.Demon)
{
Terraria.Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, Terraria.ID.ItemID.Hellstone);
}
}
}}

Some help with scoping out issues would be wonderful, thanks. :happy:
 
I have an issue with getting some code to work how I want it to. I want demons to drop a piece of Hellstone every time they die. Here's my current code.

namespace MyMod.NPCs
{
public class HellstoneDrop : Terraria.ModLoader.GlobalNPC
{
public override void NPCLoot(Terraria.NPC npc)
{
if (npc.value > 0f && target.type == Terraria.ID.NPCID.Demon)
{
Terraria.Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, Terraria.ID.ItemID.Hellstone);
}
}
}}

Some help with scoping out issues would be wonderful, thanks. :happy:
I'd suggest renaming your GlobalNPC class to just GlobalNPC, as there can't be more than one class that overrides GlobalNPC so you need to put all your GlobalNPC code in one class
 
I have an issue with getting some code to work how I want it to. I want demons to drop a piece of Hellstone every time they die. Here's my current code.

namespace MyMod.NPCs
{
public class HellstoneDrop : Terraria.ModLoader.GlobalNPC
{
public override void NPCLoot(Terraria.NPC npc)
{
if (npc.value > 0f && target.type == Terraria.ID.NPCID.Demon)
{
Terraria.Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, Terraria.ID.ItemID.Hellstone);
}
}
}}

Some help with scoping out issues would be wonderful, thanks. :happy:
You have the parameter which is called 'npc', but you're testing 'target.type' against Terraria.ID.NPCID.Demon. I'd suggest replacing 'target.type' with 'npc.type'.
 
Last edited:
I'd suggest renaming your GlobalNPC class to just GlobalNPC, as there can't be more than one class that overrides GlobalNPC so you need to put all your GlobalNPC code in one class
It actually is possible to have multiple GlobalNPC classes per mod now.
 
So renaming your class and CS file is too much effort for you? :red:
No need to go on the offensive, he might not now what you were talking about.
What do you mean by that? Could you give me an example?
You've got the following code:
Code:
public class HellstoneDrop : Terraria.ModLoader.GlobalNPC
{
        // Inner code.
}
He meant changing the 'HellstoneDrop' to 'GlobalNPC', since there could only be one class inheriting from GlobalNPC.
@bluemagic123, however, stated that it's now possible to have multiple classes inheriting from GlobalNPC, so this is no longer necessary.
 
Back
Top Bottom