Standalone [1.3] tModLoader - A Modding API

Hey, I got a problem.
After a sent my computer to fix because of a problem, my Terraria couldn't load. It gave me this message:
Code:
An unexpected error has occurred.
  at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
  at Terraria.ModLoader.Default.ModLoaderMod.ReadTexture(String file)
  at Terraria.ModLoader.Default.ModLoaderMod.LoadTextures()
  at Terraria.ModLoader.Default.ModLoaderMod.Load()
  at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
And when I put "Continue" it crashed and this appeared: (check uploaded files)
What do I do?

Btw, when I deleted all mods in the file, the game didn't crash but keep showing the same error.
Have you tried verifying Terraria's cache and/or reinstalling tModLoader? One or the other of those things may fix your problem.
 
Hi, I am new to modding. I am trying to make a workbench with your example mod and I've been jumping back and forth trying to create a recipe but no luck. Think you can help?

Example Block (Uses a basic recipe and is inside example mod, trying to get info off this.)
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace ExampleMod.Tiles
{
    public class ExampleBlock : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolid[Type] = true;
            Main.tileMergeDirt[Type] = true;
            Main.tileBlockLight[Type] = true;
            Main.tileLighted[Type] = true;
            dustType = mod.DustType("Sparkle");
            drop = mod.ItemType("ExampleBlock");
            AddMapEntry(new Color(200, 200, 200));
            SetModTree(new ExampleTree());
        }

        public override void NumDust(int i, int j, bool fail, ref int num)
        {
            num = fail ? 1 : 3;
        }

        public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
        {
            r = 0.5f;
            g = 0.5f;
            b = 0.5f;
        }

        public override void ChangeWaterfallStyle(ref int style)
        {
            style = mod.GetWaterfallStyleSlot("ExampleWaterfallStyle");
        }

        public override int SaplingGrowthType(ref int style)
        {
            style = 0;
            return mod.TileType("ExampleSapling");
        }
    }
}

My workbench (Trying to get a recipe but no luck. Says there is no method, but I don't know how to make a recipe like that.
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using TerrariaOverhaul;

namespace JT.Tiles
{
    public class glitchworkbench : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolidTop[Type] = true;
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileTable[Type] = true;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
            TileObjectData.newTile.CoordinateHeights = new int[]{ 18 };
            TileObjectData.addTile(Type);
            AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable);
            ModTranslation name = CreateMapEntryName();
            name.SetDefault("Glitch Workbench");
            Tooltip.SetDefault("Don't create a virus now!");
            AddMapEntry(new Color(200, 200, 200), name);
            disableSmartCursor = true;
            adjTiles = new int[]{ TileID.WorkBenches };
        }
        public void OverhaulInit()
        {
            this.SetTag("flammable");
            this.SetTag("footstep_Wood");
        }
        public override void NumDust(int i, int j, bool fail, ref int num)
        {
            num = fail ? 1 : 3;
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 32, 16, mod.ItemType("glitchworkbench"));
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(mod, "glitchitem", 8);
            recipe.AddTile(TileID.Workbenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

And the item used to craft it. (Has no problems)
Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace JT.Items
{
    public class glitchitem : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("Are you a debugger?"
            + "Can be used for special crafting.");
        }

        public override void SetDefaults()
        {
            item.width = 16;
            item.height = 16;
            item.maxStack = 999;
            item.value = 305;
            item.rare = 1;
        }
    }
}



Did you check and see if the sounds exist inside the mod? It's saying that certain sounds do not exist.

[How to: click "more info" on the mod in the mods menu, and then click extract. It should appear in "Mod Sources" at Documents/My Games/Terraria/Modloader/Mod Sources. Then open it and find the Sounds folder. If you read the error, it should say where the sound was supposed to be. If the sound isn't there, then try again and reinstall the mod. But DONT enable it. Instead, extract it and find the sound. If the sound is there, then go the Mod Sources in the main menu. Find the name of the mod and click "Build + Reload" It should work. Tell me if you have any further problems.
Recipes don't go in ModTile, they can go in Mod and ModItem.
 
Ohh, okay thanks. After reading this reply I checked and saw there was not just a Tile but an ITEM for the same object. Thanks for that. I dun goofed.
 
I did reinstall tML but it didn't work, but where do I find Terraria's cache?
To verify a games Cache in Steam, right click on that game in your library then click properties. Click on the Local Files tab then click Verify Integrity of Game Files.

Also, can you run the vanilla version of the game without problem? If that's also broken and Verifying the game doesn't fix that, then you may need to reinstall the XNA framework, or something like that.
 
So, I have the issue of Terraria locking up whenever the Mod Browser is opened, with this error message:
zvofp1.png


From what I gather, the gist of it is this; I live in Turkey. Imgur is blocked in Turkey. When the Mod Browser tries to load up mod thumbnails, if those thumbnails are Imgur images, it will screw up. Could we have a setting that disables thumbnails in the Browser?
 
So, I have the issue of Terraria locking up whenever the Mod Browser is opened, with this error message:
zvofp1.png


From what I gather, the gist of it is this; I live in Turkey. Imgur is blocked in Turkey. When the Mod Browser tries to load up mod thumbnails, if those thumbnails are Imgur images, it will screw up. Could we have a setting that disables thumbnails in the Browser?
Thanks, we'll try to resolve this next update, for now use: http://javid.ddns.net/tModLoader/DirectModDownloadListing.php
 
How do you make spreading blocks?

and how do you make an enemy have a rotating animation, like dungeon guardian?
 
Last edited:
How do you change living mahogany trees to require jungle grass to spawn?

Can you just add liquids already, and I think that if it mixes with a liquid it does not know what to do with (other mods), it should default to a set block

How do you set world gen to spawn walls in a custom biome, and spawning similar to jungle
 
Last edited:
Some quick questions: When I download tmodloader, should I just move my .plr files and .wld files to it or should I copy them first? Should I move the .bak files? Should I move the "map" folders for the characters or not?
Also, if I move my worlds into tmodloader, are they going to be affected by the mods I have enabled or will the worlds stay vanilla? Because I have a completed regular world and I'm working on expert mode, but I was also thinking of trying Calamity.
Thanks for making tmodloader!
 
Some quick questions: When I download tmodloader, should I just move my .plr files and .wld files to it or should I copy them first? Should I move the .bak files? Should I move the "map" folders for the characters or not?
Also, if I move my worlds into tmodloader, are they going to be affected by the mods I have enabled or will the worlds stay vanilla? Because I have a completed regular world and I'm working on expert mode, but I was also thinking of trying Calamity.
Thanks for making tmodloader!
If you want to move your world, I'd recommend copy and paste rather than move, so you have a backup.
However I'd really recommend to create a new world, so you get world gen and stuff
 
Help! Im making a Terraria mod and i Always get the same error on it and i can't find anything that solves it!! Its CS0115 and i'm trying to create a TownNPC here is my code:
Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Zartius.NPCs
{
    public class Lucas : ModNPC
    {
        public override bool Autoload(ref string name, ref string texture, ref string[] altTextures)
        {
            name = "Lucas";
            return mod.Properties.Autoload;
        }
        public override void SetDefaults()
        {
            npc.name = "Lucas";   //the name displayed when hovering over the npc ingame.
            npc.townNPC = true; //This defines if the npc is a town Npc or not
            npc.friendly = true;  //this defines if the npc can hur you or not()
            npc.width = 18; //the npc sprite width
            npc.height = 46;  //the npc sprite height
            npc.aiStyle = 7; //this is the npc ai style, 7 is Pasive Ai
            npc.defense = 25;  //the npc defense
            npc.lifeMax = 250;// the npc life
            npc.HitSound = SoundID.NPCHit1;  //the npc sound when is hit
            npc.DeathSound = SoundID.NPCDeath1;  //the npc sound when he dies
            npc.knockBackResist = 0.5f;  //the npc knockback resistance
            Main.npcFrameCount[npc.type] = 25; //this defines how many frames the npc sprite sheet has
            NPCID.Sets.ExtraFramesCount[npc.type] = 9;
            NPCID.Sets.AttackFrameCount[npc.type] = 4;
            NPCID.Sets.DangerDetectRange[npc.type] = 150; //this defines the npc danger detect range
            NPCID.Sets.AttackType[npc.type] = 2; //this is the attack type,  0 (throwing), 1 (shooting), or 2 (magic). 3 (melee)
            NPCID.Sets.AttackTime[npc.type] = 30; //this defines the npc attack speed
            NPCID.Sets.AttackAverageChance[npc.type] = 10;//this defines the npc atack chance
            NPCID.Sets.HatOffsetY[npc.type] = 4; //this defines the party hat position
            animationType = NPCID.Guide;  //this copy the guide animation
        }
        public override bool CanTownNPCSpawn(int numTownNPCs, int money) //Whether or not the conditions have been met for this town NPC to be able to move into town.
        {
            if (NPC.downedBoss1)  //so after the EoC is killed
            {
                return true;
            }
            return false;
        }
        public override bool CheckConditions(int left, int right, int top, int bottom)    //Allows you to define special conditions required for this town NPC's house
        {
            return true;  //so when a house is available the npc will  spawn
        }
        public override string TownNPCName()     //Allows you to give this town NPC any name when it spawns
        {
            switch (WorldGen.genRand.Next(6))
            {
                case 0:
                    return "Lucas";

                default:
                    return "Lucas";
            }
        }

        public override void SetChatButtons(ref string button, ref string button2)  //Allows you to set the text for the buttons that appear on this town NPC's chat window.
        {
            button = "Buy Items";   //this defines the buy button name
        }
        public override void OnChatButtonClicked(bool firstButton, ref bool openShop) //Allows you to make something happen whenever a button is clicked on this town NPC's chat window. The firstButton parameter tells whether the first button or second button (button and button2 from SetChatButtons) was clicked. Set the shop parameter to true to open this NPC's shop.
        {

            if (firstButton)
            {
                openShop = true;   //so when you click on buy button opens the shop
            }
        }

        public override void SetupShop(Chest shop, ref int nextSlot)       //Allows you to add items to this town NPC's shop. Add an item by setting the defaults of shop.item[nextSlot] then incrementing nextSlot.
        {
            if (NPC.downedSlimeKing)   //this make so when the king slime is killed the town npc will sell this
            {
                shop.item[nextSlot].SetDefaults(ItemID.RecallPotion);  //an example of how to add a vanilla terraria item
                nextSlot++;
                shop.item[nextSlot].SetDefaults(ItemID.WormholePotion);
                nextSlot++;
            }
            if (NPC.downedBoss3)   //this make so when Skeletron is killed the town npc will sell this
            {
                shop.item[nextSlot].SetDefaults(ItemID.BookofSkulls);
                nextSlot++;
                shop.item[nextSlot].SetDefaults(ItemID.ClothierVoodooDoll);
                nextSlot++;
            }
            shop.item[nextSlot].SetDefaults(ItemID.IronskinPotion);
            nextSlot++;
            shop.item[nextSlot].SetDefaults(mod.ItemType("CustomSword"));  //this is an example of how to add a modded item
            nextSlot++;

        }

        public override string GetChat()       //Allows you to give this town NPC a chat message when a player talks to it.
        {
            int wizardNPC = NPC.FindFirstNPC(NPCID.ArmsDealer);   //this make so when this npc is close to Wizard
            if (wizardNPC >= 0 && Main.rand.Next(4) == 0)    //has 1 in 3 chance to show this message
            {
                return "Esse tal de " + Main.npc[armsdealerNPC].displayName + " é cuck.";
            }
            int guideNPC = NPC.FindFirstNPC(NPCID.Nurse); //this make so when this npc is close to the Guide
            if (guideNPC >= 0 && Main.rand.Next(4) == 0) //has 1 in 3 chance to show this message
            {
                return "Eu ja comi essa tal de " + Main.npc[nurseNPC].displayName + " ,e foi muito bom.";
            }
            switch (Main.rand.Next(4))    //this are the messages when you talk to the npc
            {
                case 0:
                    return "NÃO ME DIGA NÃO BRASIL!!!!NÃO ME DIGA NÃO!!!";
                case 1:
                    return "Estados Unidos, Estados Unidos, Estados Unidos...";
                case 2:
                    return "Papai tem um peixe, e o nome dele é homossexual";
                case 3:
                    return "Eu já comi todas as NPCs gostosas daqui brow";
                default:
                    return "Tranquilo?";

            }
        }
        public override void TownNPCAttackStrength(ref int damage, ref float knockback)//  Allows you to determine the damage and knockback of this town NPC attack
        {
            damage = 30;  //npc damage
            knockback = 5f;   //npc knockback
        }

        public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)  //Allows you to determine the cooldown between each of this town NPC's attack. The cooldown will be a number greater than or equal to the first parameter, and less then the sum of the two parameters.
        {
            cooldown = 5;
            randExtraCooldown = 10;
        }
       

        //----------------------------------This is an example of how to make the npc use a gun and a projectile ----------------------------------
          public override void DrawTownAttackGun(ref float scale, ref int item, ref int closeness) //Allows you to customize how this town NPC's weapon is drawn when this NPC is shooting (this NPC must have an attack type of 1). Scale is a multiplier for the item's drawing size, item is the ID of the item to be drawn, and closeness is how close the item should be drawn to the NPC.
          {
              scale = 1f;
              item = mod.ItemType(Handgun); 
              closeness = 20;
          }
          public override void TownNPCAttackProj(ref int projType, ref int attackDelay)//Allows you to determine the projectile type of this town NPC's attack, and how long it takes for the projectile to actually appear
          {
              projType = ProjectileID.CrystalBullet;
              attackDelay = 1;
          }
          public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)//Allows you to determine the speed at which this town NPC throws a projectile when it attacks. Multiplier is the speed of the projectile, gravityCorrection is how much extra the projectile gets thrown upwards, and randomOffset allows you to randomize the projectile's velocity in a square centered around the original velocity
          {
              multiplier = 7f;
             // randomOffset = 4f;
          }  
    }
}
 
soo how does one reset the language on the tmodloader menu as i may have been setting it up and accidentally pressed a language i don't understand......
[doublepost=1516124027,1516123929][/doublepost]
soo how does one reset the language on the tmodloader menu as i may have been setting it up and accidentally pressed a language i don't understand......
scratch that i did it
 
If you want to move your world, I'd recommend copy and paste rather than move, so you have a backup.
However I'd really recommend to create a new world, so you get world gen and stuff
I am going to make a new world, I just want to know if my mods will affect my existing one (for example, if a mod adds an enemy to the forest, will it spawn in my vanilla world). And yeah, I think copy+pasting is a good idea, because I have backups.
 
I am going to make a new world, I just want to know if my mods will affect my existing one (for example, if a mod adds an enemy to the forest, will it spawn in my vanilla world). And yeah, I think copy+pasting is a good idea, because I have backups.
Moving vanilla to modded will get anything the mod adds exept world gen stuff
 
Back
Top Bottom