Standalone [1.3] tModLoader - A Modding API

I lag when I record the main menu. Like it drops to 50 FPS an jumps around from 30-60. The vanilla version of the game records just fine, but when I try recording in tMod I lag constantly. Any fixes?


I want to do a play through of a mod, but when I lag constantly it gets annoying to play in as well as watch because it causes audio sync issues and makes me irritated and cause me to ramble about it when I've been trying not to talk about it in videos.
 
Okay I have a coding issue, that I need resolved. I am making a material made with Gold/Platinum, Iron/Lead, Copper/Tin, and Tungsten/Silver. How do I make it so it's any Gold/Iron/ETC bar?
[doublepost=1469923518,1469923377][/doublepost]Maybe someone can edit the code? The code is
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.Modloader;

namespace LivenUP.Items.Materials
{
public class Circut Board : ModItem
{
public override void SetDefaults()
{
item.name = "Circut Board";
item.width = 20;
item.height = 16;
item.maxStack = 999;
item.toolTip = "'What a strange material'";
item.toolTip2 = "Strangly, it's waterproof";
item.value = 0;
item.rare = -1;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe AddIngredient(Terraria.ID.ItemID.Iron Bar, 1);
recipe AddTile(Terraria.ID.TileID.Anvil);
recipe.SetResult(this, );
recipe.AddRecipe(LivenUP.ID.ItemID.Shattered Television, 1)
}
}
}
 
Okay I have a coding issue, that I need resolved. I am making a material made with Gold/Platinum, Iron/Lead, Copper/Tin, and Tungsten/Silver. How do I make it so it's any Gold/Iron/ETC bar?
To do that, you want to use AddRecipeGroup instead of AddIngredient when making a recipe. However, as far as I'm aware this only works for Iron and Lead.

So for example, a recipe that uses Iron or Lead Bars would look like this:
Code:
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.IronBar); // This would mean you can only use Iron Bars, not Lead ones.
recipe.AddRecipeGroup("IronBar"); // This allows for both Iron and Lead bars.
recipe.SetResult(this);
recipe.AddRecipe();
}
I suppose you could get around this by checking the world, but that's rather complicated. Might be easier to just make two recipes.
 
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.
 
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?
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
 
Back
Top Bottom