• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Begin your search for Journey's End information here and here. Please report bugs and issues for Journey's End here.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

Standalone [1.3] tModLoader - A Modding API

Block502

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

namespace FutureNowMod.NPCs
{
    public class UPOSpy : ModNPC
    {
        public override void SetDefaults()
        {
            npc.name = "UPOSpy";
            npc.displayName = "UPO Spy";
            npc.width = 40;
            npc.height = 20;
            npc.damage = 500;
            npc.defense = 30;
            npc.lifeMax = 500;
            npc.HitSound = SoundID.NPCHit4;
            npc.DeathSound = SoundID.NPCDeath14;
            npc.value = 60f;
                        npc.noGravity = true;
            npc.knockBackResist = 0.3f;
            npc.aiStyle = 2;
            Main.npcFrameCount[npc.type] = Main.npcFrameCount[NPCID.DemonEye];
            aiType = NPCID.EyeofCthulhu;
            animationType = NPCID.DemonEye;
        }

        public override float CanSpawn(NPCSpawnInfo spawnInfo)
        {
            return spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? 0f : 3f;
        }







public override void AI()
        {
            npc.ai[0]++;
            Player P = Main.player[npc.target];
            if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
            {
                npc.TargetClosest(true);
            }
            npc.netUpdate = true;
            npc.ai[1]++;
            if (npc.ai[1] >= 230)  // 230 is projectile fire rate
            {
                float Speed = 20f; //Projecile speed
                Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
                int damage = 100;  //projectile damage
                int type = mod.ProjectileType("ShadowArm");  //put your projectile
                Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
                float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
                int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
                npc.ai[1] = 0;
            }
      


        public override void HitEffect(int hitDirection, double damage)
        {
            for (int i = 0; i < 10; i++)
            {
                int dustType = Main.rand.Next(259, 259);
                int dustIndex = Dust.NewDust(npc.position, npc.width, npc.height, dustType);
                Dust dust = Main.dust[dustIndex];
                dust.velocity.X = dust.velocity.X + Main.rand.Next(-50, 51) * 0.01f;
                dust.velocity.Y = dust.velocity.Y + Main.rand.Next(-50, 51) * 0.01f;
                dust.scale *= 1f + Main.rand.Next(-30, 31) * 0.01f;
            }
        }
    }
}
I need help making my npc shoot a projectile. I already tried to copy the part of a boss code that make him shooting projectiles but it does not work.
 

LeeTG3

Eye of Cthulhu
public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
if(!spawnInfo.player.zoneCrimson) return 0;
return 1;
}
Appaerntly zoneCrimson dousn't exist
 

Koala

Terrarian
Are tmodloader have bug about camera mode? Because, I use tmodloader today and take pic on my build but it was pure black even though there are torch everywhere. Then the second time the game crash! Please help me :(. Note: If it is a bug I will not put the crash log
 

unitax

Terrarian
I just wish to report, that ModBrowser is broken, I wanted to update my Thorium and stuff, and tModLoader instead of updating it, it rather removes it (replaces the mod with 0 KB *.tmod file). The same goes for downloading new mods.
It's probably the cloud-server-thing issue, because it used to work on this patch.
And I wanted to play my Terraria today... (it's already past 2 p.m. for me)
 

Lithium

Spazmatism
Hi, I'm trying to make my wings glow fullbright. I searched this thread and found someone else had the same problem with projectiles, but the code just isn't working for me.
Ninja edit: Also, while I'm here, is there a way to add hoverboard functionality to my wings?
Later ninja edit: Oh, and can I make their rarity rainbow? -2, -3, 12, and 13 don't work.
Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace LithoVanities.Items
{
    public class InfinityWings : ModItem
    {
        public override Color? GetAlpha(Color lightColor)
        {
            return Color.White;
        }
     
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.Wings);
            return true;
        }
     
        public override void SetDefaults()
        {
            item.name = "Infinity Wings";
            item.width = 30;
            item.height = 28;
            item.toolTip = "These mythic wings grant the wearer the ability to fly forever-";
            item.toolTip2 = "or at least, for 31 years straight.";
            item.value = 1000000;
            item.rare = 12;
            item.accessory = true;
        }
     
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.wingTimeMax = 999999999;
        }

        public override void VerticalWingSpeeds(ref float ascentWhenFalling, ref float ascentWhenRising,
            ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
        {
            ascentWhenFalling = 0.85f;
            ascentWhenRising = 0.10f;
            maxCanAscendMultiplier = 1f;
            maxAscentMultiplier = 2f;
            constantAscend = 0.135f;
        }

        public override void HorizontalWingSpeeds(ref float speed, ref float acceleration)
        {
            speed = 10f;
            acceleration *= 2.8f;
        }
     
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.SoulofFlight, 99);
            recipe.AddIngredient(ItemID.LunarBar, 20);
            recipe.AddIngredient(ItemID.FragmentVortex, 7);
            recipe.AddIngredient(ItemID.FragmentNebula, 7);
            recipe.AddIngredient(ItemID.FragmentSolar, 7);
            recipe.AddIngredient(ItemID.FragmentStardust, 7);
            recipe.AddTile(TileID.LunarCraftingStation);
            recipe.SetResult(this);
            recipe.AddRecipe();
        } 
    }
}
 
Last edited:
I have a huge problem with the downloading thing. So I installed terraria fresh from steam and then downloaded Java and tMod. I click tModLoaderinstaller.jar and it successfully installed. Then I opened it and i have been waiting for about 3 hours looking at a black screen. Do I have to install a mod first? Am I an idiot? Any help?
P.S:I have a iMac.
 

dtim

Terrarian
I have a huge problem with the downloading thing. So I installed terraria fresh from steam and then downloaded Java and tMod. I click tModLoaderinstaller.jar and it successfully installed. Then I opened it and i have been waiting for about 3 hours looking at a black screen. Do I have to install a mod first? Am I an idiot? Any help?
P.S:I have a iMac.
I had this problem on my Mac about a couple of months ago. What that turned out to be was that Steam had installed an old version of Terraria. No idea why but it installed something like 1.3.0.8. I don't remember exactly what I did to get Steam to update Terraria but once it was updated I reinstalled tModLoader and it worked fine from there (aside from in-game mod browser).
 

unitax

Terrarian
Hey, ModBrowser still does not work. Whenever I try to download something, it downloads a 0 KB .tmod file.
Or am I doing something wrong? Does it work normally for you?? (If you wish to check, better make a backup copy of your mods!)

@down: Thank you, sir, but there's still a problem: whenever I try to download something, my browser tells me it's an unsafe, the connection with dropbox isn't protected, so browsers block it.

Does it happen to you too?
 
Last edited:

IDFC

Skeletron Prime
Everyone whenever I load or create a world, the game crashes even though I am only dealing with small worlds and I'm only using seven mods.
Thorium Mod
Calamity Mod
Spirit Mod
Zoaklen Mod
Fargo's Mutant Mod
MoreAccessories+
Wingslot Mod
 

MisterTor

Terrarian
Hi, I'm trying to add my own mod for the first time, so I've had to go trough the excruciatingly nonsensical process of getting things to work as a newbie.
I think I'm almost there, I'm just stuck on one thing. I'm using a mac, so I've created a Windows.dll and a Mono.dll, however, how do I get the "Mac" Terraria.exe and the TerrariaWindows.exe to use as references?

I'm getting this message:

Missing dll files for auricblade

Must have either All.dll or both of Windows.dll and Mono.dll
All.dll must not have any references to Microsoft.Xna.Framework or FNA
Windows.dll must reference the windows Terraria.exe and Microsoft.Xna.Framework.dll
Mono.dll must reference a non-windows Terraria.exe and FNA.dll

I've got the FNA.dll and the Microsoft.Xna.Framework.dll, I'm just trying to get these two last exe's to work. If I even have them.
I'm using the Terraria.exe's that I got from the Mac & Windows tModLoader.zip files.
Is it right to use those? I feel like I'm missing something obvious here.
 

Sosmula2011

Terrarian
Is there a mod that allows modded items to be placed on item frames and armor stands? It doesn't work for me. Whenever I put modded items on item frames or mannequins, the item texture glitches and the item is destroyed. I've seen youtubers such as gameraiders and happydays place modded items on frames and mannequins
 

crazydave18

Terrarian
Hello, I didnt find answer for that issue so I need your help now ehh, everytime i try to launch my mod i get this error code:

Failed to load C:\Users\Marek\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\build.txt
System.FormatException: Vstupní řetězec nemá správný formát.
v System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
v System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent)
v System.Version.TryParseVersion(String version, VersionResult& result)
v System.Version.Parse(String input)
v System.Version..ctor(String version)
v Terraria.ModLoader.BuildProperties.ReadBuildFile(String modDir)
v Terraria.ModLoader.ModCompile.ReadProperties(String modFolder, IBuildStatus status)

Thank you.
 

Eldrazi

Eater of Worlds
Hello, I didnt find answer for that issue so I need your help now ehh, everytime i try to launch my mod i get this error code:

Failed to load C:\Users\Marek\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\build.txt
System.FormatException: Vstupní řetězec nemá správný formát.
v System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
v System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent)
v System.Version.TryParseVersion(String version, VersionResult& result)
v System.Version.Parse(String input)
v System.Version..ctor(String version)
v Terraria.ModLoader.BuildProperties.ReadBuildFile(String modDir)
v Terraria.ModLoader.ModCompile.ReadProperties(String modFolder, IBuildStatus status)

Thank you.
Do you have a file in your mod root folder called build.txt? If not, create a file called build with file-extension .txt
You can check the ExampleMod for the content you can fill that file with.
 

crazydave18

Terrarian
Do you have a file in your mod root folder called build.txt? If not, create a file called build with file-extension .txt
You can check the ExampleMod for the content you can fill that file with.
Yep, I have..

author = Your Name
version = v0.1
displayName = YourModName
hideCode = true
hideResources = true
includeSource = true
 
Top Bottom