tModLoader Official tModLoader Help Thread

Now the problem I'm having is a mystery. I added 8 swords to my mod, and when I loaded it up, the UI was missing. I did some testing and narrowed the problem down. For some reason I can't have more than 21 weapons, else it causes the UI to disappear.

Anyone know a fix?
 
Now the problem I'm having is a mystery. I added 8 swords to my mod, and when I loaded it up, the UI was missing. I did some testing and narrowed the problem down. For some reason I can't have more than 21 weapons, else it causes the UI to disappear.

Anyone know a fix?
Probably you added a ItemID to a recipe. Anyway, just post some code or we can't help you.
 
Probably you added a ItemID to a recipe. Anyway, just post some code or we can't help you.
Thanks, but I just figured it out. There was no problem with my mod, I had it checked by someone else and they couldn't find any problems. Just now I discovered that apparently having too many mods will make your game glitch out. I guess with all the other mods I had installed and adding just a few more items to mine, made too many for the game to handle.
 
Thanks, but I just figured it out. There was no problem with my mod, I had it checked by someone else and they couldn't find any problems. Just now I discovered that apparently having too many mods will make your game glitch out. I guess with all the other mods I had installed and adding just a few more items to mine, made too many for the game to handle.
That seems very unlikely, but if you're happy with it, fine.
 
That seems very unlikely, but if you're happy with it, fine.
Well see, when I took away other mods everything worked fine. How could I be sure that the problem isn't with someone else's mods and not mine? My code matches that of the example mod almost exactly. It's hard for me to imagine that the problem is with my code when I followed the examples closely and it contains basically nothing but added weapons, nothing that would alter the UI. I would sooner believe that tModLoader is having problems loading up all the items. But that's just my thoughts. I could be wrong, I'm new to modding Terraria after all.
 
Well see, when I took away other mods everything worked fine. How could I be sure that the problem isn't with someone else's mods and not mine? My code matches that of the example mod almost exactly. It's hard for me to imagine that the problem is with my code when I followed the examples closely and it contains basically nothing but added weapons, nothing that would alter the UI. I would sooner believe that tModLoader is having problems loading up all the items. But that's just my thoughts. I could be wrong, I'm new to modding Terraria after all.
Some mods add thousands of items without issue, I doubt the 20 you added caused issue. Anyway, yeah, it might be some other mod causing the issue, but my doubt was that you reached a limit.
 
How would I go about making a custom plant tile grow on grass like a mushroom would? I couldn't find anything like that in the example mod.
 
You should probably use the OnHitPlayer or ModifyHitPlayer hook to do this, for items you'll probably use the HoldItem hook.

You can do this by calling Dust.NewDust in the WingUpdate hook from ModItem.

As you said you're not very good at this yet, I'd recommend looking into other things first. What you're asking is possible, heck I even fancied around it, but it's rather difficult compared to a lot of other things. You'll be messing around with custom AI and drawing code.
Thank you very much.
 
I want to make the extractinator spew out another ore. How would I do that? I know that I edit the files for the Silt Block and Desert Fossils, but I can't seem to make it work.
Help?
 
Ok, so I've been trying to make a mod that allows pillar fragments to be crafted into more pillar fragments using certain items, and I believe that I'm almost done, but I keep getting this error and I don't know how to fix it:
c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(11,23) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments

c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(11,37) : error CS1503: Argument 1: cannot convert from 'CraftableFragments.CraftableFragments' to 'Terraria.ModLoader.Mod'

c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(17,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments

c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(17,27) : error CS1503: Argument 1: cannot convert from 'CraftableFragments.CraftableFragments' to 'Terraria.ModLoader.Mod'

c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(23,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments

c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(23,27) : error CS1503: Argument 1: cannot convert from 'CraftableFragments.CraftableFragments' to 'Terraria.ModLoader.Mod'

c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(29,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments

c:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\Craftable Pillar Fragments\CraftableFragments.cs(29,27) : error CS1503: Argument 1: cannot convert from 'CraftableFragments.CraftableFragments' to 'Terraria.ModLoader.Mod'

This is my code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace CraftableFragments
{
public class CraftableFragments
{
public void AddRecipes(Mod mod)
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.FragmentVortex, 10);
recipe.AddIngredient(ItemID.ShroomiteBar, 3);
recipe.AddTile(412);
recipe.SetResult(ItemID.FragmentVortex, 20);
recipe.AddRecipe();
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.FragmentNebula, 10);
recipe.AddIngredient(ItemID.SpectreBar, 3);
recipe.AddTile(412);
recipe.SetResult(ItemID.FragmentNebula, 20);
recipe.AddRecipe();
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.FragmentSolar, 10);
recipe.AddIngredient(ItemID.BeetleHusk, 10);
recipe.AddTile(412);
recipe.SetResult(ItemID.FragmentSolar, 2);
recipe.AddRecipe();
recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.FragmentStardust, 10);
recipe.AddIngredient(ItemID.SpookyWood, 20);
recipe.AddTile(412);
recipe.SetResult(ItemID.FragmentStardust, 20);
recipe.AddRecipe();
}
}
}

I would really like some help with this! Thanks in advance!
 
@boto3798
If you create a new ModRecipe you need to pass the mod not your CraftableFragments class. So change every:
Code:
ModRecipe recipe = new ModRecipe(this);
to
Code:
ModRecipe recipe = new ModRecipe(mod);
[doublepost=1483287805,1483287253][/doublepost]@Will A
You can use
ExtractinatorUse(...)

you can read more about the function here:
https://github.com/bluemagic123/tModLoader/wiki/GlobalItem

[doublepost=1483288050][/doublepost]@Gage007
Crate a class that inheritances GlobalNPC and override inheritance
EditSpawnPool(...) where you can control which NPC can spawn.

See https://github.com/bluemagic123/tModLoader/wiki/GlobalNPC
for more Information.
 
@boto3798
If you create a new ModRecipe you need to pass the mod not your CraftableFragments class. So change every:
Code:
ModRecipe recipe = new ModRecipe(this);
to
Code:
ModRecipe recipe = new ModRecipe(mod);
Ok, I did that, and it now successfully builds the mod, but I get another error when trying to enable and reload the mod:
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad)
 
Ok, I did that, and it now successfully builds the mod, but I get another error when trying to enable and reload the mod:
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad)
Hold up, that code you showed earlier wasn't even extending a tmodloader class, it won't be called. You need a class that extends Mod, then you can overrider the add recipes hook, then use this again instead of mod since you are in the Mod class.

Code:
using Terraria.ModLoader;
using Terraria;
using Terraria.ID;

namespace ModNameHere
{
    public class ModNameHere : Mod
    {
        public ModNameHere()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
            };
        }

        public override void AddRecipes()
        {
            // Recipes here
        }
    }
}
 
Back
Top Bottom