Standalone [1.3] tModLoader - A Modding API

efhosci

Terrarian
Hi you peepz, can you at least tell me the code for a new drill or pick please. I cannot code with json files:sigh:

You should look at the ExamplePick in the ExampleMod, it has everything you need to make a pickaxe. Just make a copy of that file and change whatever you want. (Note that item.pick is the pickaxe power) You can also use item.CloneDefaults to copy the properties of an existing item, then you only need to change the properties that will be different. For example:
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace NameofYourMod.Items
{
    public class NameOfYourPickaxeOrDrill : ModItem
    {
        public override void SetDefaults()
        {
            item.CloneDefaults(ItemID.SomeVanillaPickOrDrill);
            item.name = "My Pickaxe";
            item.damage = 10;
            item.useTime = 5;
            item.useAnimation = 5;
            item.pick = 100;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 2;
        }
    }
}
 

jopojelly

Retinazer
tModLoader
Why can I not get on public servers when this is installed?
Because several network messages have changed to facilitate mods, and we don't want people joining vanilla servers and wrecking havoc. Just run the vanilla exe. The installer should have saved a copy for you
[doublepost=1467403290,1467403136][/doublepost]
Thanks, I'll try that. Follow up: in a previous reply, you talked about looping through chests at world gen and adding items. (Basically, I'm trying to do this once per day for certain chests). http://forums.terraria.org/index.php?threads/1-3-tmodloader-a-modding-api.23726/page-372#post-921068 Some of the replies expressed concern at using a fixed number for the upper bound of chestindex. Do you know what the actual ramifications are for attempting to access more chests than exist in the world are? And is there a better way to find the number of chests in the world? Thanks again for your help.
This is the vanilla approach. I'm checking for null, so it doesn't matter. This same pattern is used for projectiles and NPC operations. I see no reason for the code to fail.
 

Hi_I'm_A_Person

Terrarian
It won't work. :(

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

I use the GOG version of Terraria if it helps.
 

efhosci

Terrarian
This is the vanilla approach. I'm checking for null, so it doesn't matter. This same pattern is used for projectiles and NPC operations. I see no reason for the code to fail.

Alright, thanks again!
 
Last edited:

CometOS

Terrarian
I think the
Code:
namespace kif's,mod.NPCs
is causing the trouble. Try changing it to kifsmod.NPCs and also you have to rename the folder that's containing your mod.
OH... Yeah i figured that out but must of changed that name in a different mod i was trying to make...
OOPS

*looks for a facepalm symbol
*gives up and uses emojis
 

aion aethertech

Terrarian
If I install this how can I launch the vanilla? I put the actual game file on my desktop but I can't launch it, an error message keeps popping up.
 

jopojelly

Retinazer
tModLoader
so is it just a glitch cause my antivirus [360 total security] says it has the trojan virus
You can call it a glitch, but "false positive" is a good term to learn, since it conveys the idea that the antivirus isn't broken completely, but just overly sensitive in this particular case.

If I install this how can I launch the vanilla? I put the actual game file on my desktop but I can't launch it, an error message keeps popping up.
Do you know what the error says? If you "put it on your desktop", that doesn't tell me much. Sounds like you are either trying to run the installer from within the zip file, trying to install using the installer but don't have java installed, or trying to just run the .exe from the desktop, all of which won't work. Read the readme.txt.

If you install normally, the "Terraria_v1.3.1.1.exe" in the steam directory is Vanilla. You can double click that, or drag a shortcut to the desktop for starting vanilla. OR, you can do it the other way, with Terraria.exe being vanilla still and installing tmodloader as tmodloader.exe or something similar....and the same process still applies...either double click or make a shortcut.

It won't work. :(

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

I use the GOG version of Terraria if it helps.
Not many GOG users here, unfortunately, but are you certain you patched a plain 1.3.1.1 Terraria?
 

algiukas222

Terrarian
when I start a Tmodloader server start-tModloaderServer. i'm doing fine on the server, but when my friend joins it he can't do anything, he starts teleporting all over the place, by what he told me, he starts doing everything slowly, it's like he's on the moon, after he jumps and starts falling down, he takes twice as long to get down, than me, he mooves twice as slow, and when he hits a monster the monster teleports behind him, but for me as the host everything is fine, he tried hosting the server but the same thing happened to him, on singleplayer he said he's doing fine, so we I tried hosting a regular terraria srver the non modloader one, and it worked fine for both of us, so idk. could there be a lag issue with your modloader server ?
 
Code:
using System;
using Terraria.ID;
using Terraria.ModLoader;

namespace Items_Extended.Items.Weapons
{
    public class Bronze Eye : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Bronze Eye";
            item.damage = 60;
            item.ranged = true;
            item.width = 44;  
            item.height = 14;
            item.toolTip = "Fires Bronze Coins.";
            item.useTime = 30;
            item.useAnimation = 30;
            item.useStyle = 5; 
            item.noMelee = true;
            item.knockBack = 5.25;
            item.value = 100;
            item.rare = 1;
            item.useSound = 11;
            item.autoReuse = true;
            item.shoot = 10;
            item.shootSpeed = 10f;
            item.useAmmo = ProjectileID.BronzeCoin;
        }
     
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Musket, 1);
            recipe.AddIngredient(ItemID.BronzeBar, 30);
            recipe.AddIngredient(ItemID.BronzeCoin, 1000);  
            recipe.AddIngredient(ItemID.IllegalGunParts, 1);          
            recipe.AddTile(TileID.Furnaces);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
     
        public override void onHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            player.AddBuff(BuffID.Spelunker, 30); 
        }
    }
}
I'm quite new to C# and I've already run into an error in my extremely simple code for a gun. I got an error that says 'error cs1514 { expected ', but I don't see anything wrong with it or any missing {. It appears for every ranged weapon I make. Please help! Thanks.
 
Last edited:
Why can I not get on public servers when this is installed?
Thanks! it really helps a lot. I shall have a look and will try to make a good mod. also, if any other fellow terrarians are stuck, they should visit www.youtube.com and search terraria tmodloader how to make a mod and there is a series for modding like a pro if you are a noob
[doublepost=1467464226,1467464099][/doublepost]UPDATE! IT WASNT JSON FILES IT WAS CS FILES!
 

Itorius

Skeletron Prime
Code:
using System;
using Terraria.ID;
using Terraria.ModLoader;

namespace Items_Extended.Items.Weapons
{
    public class Bronze Eye : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Bronze Eye";
            item.damage = 60;
            item.ranged = true;
            item.width = 44; 
            item.height = 14;
            item.toolTip = "Fires Bronze Coins.";
            item.useTime = 30;
            item.useAnimation = 30;
            item.useStyle = 5;
            item.noMelee = true;
            item.knockBack = 5.25;
            item.value = 100;
            item.rare = 1;
            item.useSound = 11;
            item.autoReuse = true;
            item.shoot = 10;
            item.shootSpeed = 10f;
            item.useAmmo = ProjectileID.BronzeCoin;
        }
    
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Musket, 1);
            recipe.AddIngredient(ItemID.BronzeBar, 30);
            recipe.AddIngredient(ItemID.BronzeCoin, 1000); 
            recipe.AddIngredient(ItemID.IllegalGunParts, 1);         
            recipe.AddTile(TileID.Furnaces);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    
        public override void onHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            player.AddBuff(BuffID.Spelunker, 30);
        }
    }
}
I'm quite new to C# and I've already run into an error in my extremely simple code for a gun. I got an error that says 'error cs1514 { expected ', but I don't see anything wrong with it or any missing {. It appears for every ranged weapon I make. Please help! Thanks.
You cannot have spaces in class/namespace names. So instead of using Bronze Eye use BronzeEye. :)
 

J-Marcus

Terrarian
Is there a way I can get a weapon to fire a set amount of bullets in quick succession and then have a cooldown time between another burst?
 

Snrasha

Terrarian
Last edited:
Top Bottom