Standalone [1.3] tModLoader - A Modding API

So I was making a mod that relies heavily on changing the names of items, buffs, and NPC's (as well as item descriptions) but somebody said I was doing it wrong but I can't figure out why. Here is the format I have been using for changing these.
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace changes
{
public class MyGlobalNPC : GlobalNPC
{
public override void SetDefaults(NPC npc)
{
if (Name == "Cursed Skull")
{
Name = "Flying Skull";
}
}
}
}
can somebody tell me what I've been doing wrong.
 
on the page you specified to find out how to compile the mod source into a tmod file, I can't seem to find the instructions.
 
Does anyone how to call a sandstorm through an item?
 
Hi, I'm not sure if I should post this here but I figured this thread is still active and someone can at least point me in the right direction. I've just started to try my hand at Terraria Mod making and I wanted to build the example Mod to have a clearer understanding of the code I'm looking at (I'm still very much an amateur coder but I understand C# well enough). Anyway I downloaded the source of the example mod so I could build it and test it in a world and I got this error
c:\Users\Tama\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod\ExampleMod.cs(203,26) : error CS0115: 'ExampleMod.ExampleMod.ModifyTransformMatrix(Microsoft.Xna.Framework.Matrix)': no suitable method found to override

I've scoured all sorts of different resources last night and I had no luck finding a similar error from another user. I had assumed it was that I didn't have the XNA framework installed so I grabbed that but later found it was already on my machine.... I've been able to take a snippet of code that referenced the XNA framework DLLs and got it to successfully build and load in a new mod. I'm using Windows 7 Ultimate right now. I've also been coding with notepad++ since I've just found my Visual studio 2013 and am installing it as I write this. If anyone has any sort of answers or can at least point me in a direction where I can get an answer, I'd be very much appreciative. Thanks in advance!^^
 
Hi, I'm not sure if I should post this here but I figured this thread is still active and someone can at least point me in the right direction. I've just started to try my hand at Terraria Mod making and I wanted to build the example Mod to have a clearer understanding of the code I'm looking at (I'm still very much an amateur coder but I understand C# well enough). Anyway I downloaded the source of the example mod so I could build it and test it in a world and I got this error
c:\Users\Tama\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod\ExampleMod.cs(203,26) : error CS0115: 'ExampleMod.ExampleMod.ModifyTransformMatrix(Microsoft.Xna.Framework.Matrix)': no suitable method found to override

I've scoured all sorts of different resources last night and I had no luck finding a similar error from another user. I had assumed it was that I didn't have the XNA framework installed so I grabbed that but later found it was already on my machine.... I've been able to take a snippet of code that referenced the XNA framework DLLs and got it to successfully build and load in a new mod. I'm using Windows 7 Ultimate right now. I've also been coding with notepad++ since I've just found my Visual studio 2013 and am installing it as I write this. If anyone has any sort of answers or can at least point me in a direction where I can get an answer, I'd be very much appreciative. Thanks in advance!^^
Just delete that method, we left that in by mistake.
 
awesome! Built and worked like a charm! Thank you so much!
 
Hi, I have a problem I made a weapon and its projectile.
Its a pot with darts in it but when I attack it's just like I'm throwing the darts.
So i set graphics to false and throwing animation.
But when I'm ingame, the projectile just deletes when I'm near blocks but the other weapon with exactly the same code doesn't do that.
I fire that projectile and it dissappear even before it appear!?
When I want to shoot backwards, forwards and down, but the projectile isnt too long its even smaller then the working one.. So I don't know.. When I put nocollide true it just works and it appears and fly through walls, but wtf, its not that long to dissappear even when i want to shot it forwards..
Projectile Code(ignore the // they could be wrong because its already edited
Also its pretty basic but i dont want to continue when i cant even solve this problem
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Projectiles
{
    public class tikis : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Tiki Dart");     //The English name of the projectile
        }       
        public override void SetDefaults()
        {
            projectile.width = 10;  //Set the hitbox width
            projectile.height = 61;  //Set the hitbox height
            projectile.aiStyle = 1; //How the projectile works
            projectile.friendly = true;  //Tells the game whether it is friendly to players/friendly npcs or not
            projectile.hostile = false; //Tells the game whether it is hostile to players or not
            projectile.tileCollide = true; //Tells the game whether or not it can collide with a tile
            projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
            projectile.thrown = true;   //Tells the game whether it is a ranged projectile or not
            projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed
            projectile.timeLeft = 75; //The amount of time the projectile is alive for
            aiType = 1; // this is the projectile ai style . 1 is for arrows style
        }
    }
}
And the item code
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Items
{
    public class tikispear : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Mahagony Tiki Holder");
            Tooltip.SetDefault("Can be fired without any ammo");           
        }       
        public override void SetDefaults()
        {        
            item.damage = 22;                       
            item.thrown = true;                     //this make the item do magic damage
            item.width = 30;
            item.height = 34;
            item.useTime = 17;
            item.useAnimation = 20;
            item.useStyle = 1;        //this is how the item is holded5knizka
            item.noMelee = true;
            item.knockBack = 2;       
            item.value = 300;
            item.rare = 1;             //mana use
            item.UseSound = SoundID.Item1;            //this is the sound when you use the item20good
            item.shoot = mod.ProjectileType("tikis"); //this make the item shoot your projectile PainterPaintballPainterPaintballPainterPaintballPainterPaintball
            item.shootSpeed = 8f;    //projectile speed when shoot
            item.autoReuse = true;
            item.noUseGraphic = true;               
        }    
        public override void AddRecipes()       
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Hook, 2);   
            recipe.AddIngredient(ItemID.RichMahogany, 14);           
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }           
    }
}
The working one: item:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Items
{
    public class harpyknives : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Sharp Harpy Fan");           
        }       
        public override void SetDefaults()
        {        
            item.damage = 22;                       
            item.ranged = true;                     //this make the item do magic damage
            item.width = 32;
            item.height = 32;
            item.useTime = 17;
            item.useAnimation = 20;
            item.useStyle = 1;        //this is how the item is holded5knizka
            item.noMelee = true;
            item.knockBack = 2;       
            item.value = 300;
            item.rare = 1;             //mana use
            item.UseSound = SoundID.Item1;            //this is the sound when you use the item20good
            item.shoot = mod.ProjectileType("harpyf"); //this make the item shoot your projectile PainterPaintballPainterPaintballPainterPaintballPainterPaintball
            item.shootSpeed = 8f;    //projectile speed when shoot
            item.autoReuse = true;       
        }
        public override void AddRecipes()       
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Feather, 15);           
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }       
    }
}
projectile:
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Projectiles
{
    public class harpyf : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Sharp Feather");     //The English name of the projectile
        }       
        public override void SetDefaults()
        {
            projectile.width = 7;  //Set the hitbox width
            projectile.height = 7;  //Set the hitbox height
            projectile.aiStyle = 1; //How the projectile works
            projectile.friendly = true;  //Tells the game whether it is friendly to players/friendly npcs or not
            projectile.hostile = false; //Tells the game whether it is hostile to players or not
            projectile.tileCollide = true; //Tells the game whether or not it can collide with a tile
            projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
            projectile.ranged = true;   //Tells the game whether it is a ranged projectile or not
            projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed
            projectile.timeLeft = 350; //The amount of time the projectile is alive for
            aiType = 1; // this is the projectile ai style . 1 is for arrows style
        }
    }
}
 
Hi, I have a problem I made a weapon and its projectile.
Its a pot with darts in it but when I attack it's just like I'm throwing the darts.
So i set graphics to false and throwing animation.
But when I'm ingame, the projectile just deletes when I'm near blocks but the other weapon with exactly the same code doesn't do that.
I fire that projectile and it dissappear even before it appear!?
When I want to shoot backwards, forwards and down, but the projectile isnt too long its even smaller then the working one.. So I don't know.. When I put nocollide true it just works and it appears and fly through walls, but wtf, its not that long to dissappear even when i want to shot it forwards..
Projectile Code(ignore the // they could be wrong because its already edited
Also its pretty basic but i dont want to continue when i cant even solve this problem
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Projectiles
{
    public class tikis : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Tiki Dart");     //The English name of the projectile
        }      
        public override void SetDefaults()
        {
            projectile.width = 10;  //Set the hitbox width
            projectile.height = 61;  //Set the hitbox height
            projectile.aiStyle = 1; //How the projectile works
            projectile.friendly = true;  //Tells the game whether it is friendly to players/friendly npcs or not
            projectile.hostile = false; //Tells the game whether it is hostile to players or not
            projectile.tileCollide = true; //Tells the game whether or not it can collide with a tile
            projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
            projectile.thrown = true;   //Tells the game whether it is a ranged projectile or not
            projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed
            projectile.timeLeft = 75; //The amount of time the projectile is alive for
            aiType = 1; // this is the projectile ai style . 1 is for arrows style
        }
    }
}
And the item code
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Items
{
    public class tikispear : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Mahagony Tiki Holder");
            Tooltip.SetDefault("Can be fired without any ammo");          
        }      
        public override void SetDefaults()
        {       
            item.damage = 22;                      
            item.thrown = true;                     //this make the item do magic damage
            item.width = 30;
            item.height = 34;
            item.useTime = 17;
            item.useAnimation = 20;
            item.useStyle = 1;        //this is how the item is holded5knizka
            item.noMelee = true;
            item.knockBack = 2;      
            item.value = 300;
            item.rare = 1;             //mana use
            item.UseSound = SoundID.Item1;            //this is the sound when you use the item20good
            item.shoot = mod.ProjectileType("tikis"); //this make the item shoot your projectile PainterPaintballPainterPaintballPainterPaintballPainterPaintball
            item.shootSpeed = 8f;    //projectile speed when shoot
            item.autoReuse = true;
            item.noUseGraphic = true;              
        }   
        public override void AddRecipes()      
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Hook, 2);  
            recipe.AddIngredient(ItemID.RichMahogany, 14);          
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }          
    }
}
The working one: item:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Items
{
    public class harpyknives : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Sharp Harpy Fan");          
        }      
        public override void SetDefaults()
        {       
            item.damage = 22;                      
            item.ranged = true;                     //this make the item do magic damage
            item.width = 32;
            item.height = 32;
            item.useTime = 17;
            item.useAnimation = 20;
            item.useStyle = 1;        //this is how the item is holded5knizka
            item.noMelee = true;
            item.knockBack = 2;      
            item.value = 300;
            item.rare = 1;             //mana use
            item.UseSound = SoundID.Item1;            //this is the sound when you use the item20good
            item.shoot = mod.ProjectileType("harpyf"); //this make the item shoot your projectile PainterPaintballPainterPaintballPainterPaintballPainterPaintball
            item.shootSpeed = 8f;    //projectile speed when shoot
            item.autoReuse = true;      
        }
        public override void AddRecipes()      
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Feather, 15);          
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }      
    }
}
projectile:
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace tristanajanna.Projectiles
{
    public class harpyf : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Sharp Feather");     //The English name of the projectile
        }      
        public override void SetDefaults()
        {
            projectile.width = 7;  //Set the hitbox width
            projectile.height = 7;  //Set the hitbox height
            projectile.aiStyle = 1; //How the projectile works
            projectile.friendly = true;  //Tells the game whether it is friendly to players/friendly npcs or not
            projectile.hostile = false; //Tells the game whether it is hostile to players or not
            projectile.tileCollide = true; //Tells the game whether or not it can collide with a tile
            projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
            projectile.ranged = true;   //Tells the game whether it is a ranged projectile or not
            projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed
            projectile.timeLeft = 350; //The amount of time the projectile is alive for
            aiType = 1; // this is the projectile ai style . 1 is for arrows style
        }
    }
}
Not sure what you mean by pot, but coming to the discord and posting a video might get you more help.
 
Ok found an answer on discord, thank you.. I didnt notice that my pixels count changed after i changed sized of sprite so i put like 10x60 even if it was 5x20:))) :d
 
could the Tmod team make modded terraria a 64 bit program? that would help all people who want lots of mods.
 
could the Tmod team make modded terraria a 64 bit program? that would help all people who want lots of mods.
Not really possible, XNA, which tmodloader is built on, is 32 bit.
 
I'm not sure if this is the appropriate forum to post this I honestly don't know where else to look but I am having issues with loading mods on I am constantly getting this error I have never had this issue until now. I have tried multiple solutions, such as verifying integrity on steam with no avail, I also tried reinstalling tmodloader and terraria to no avail I have also tried deleting all the mods I have installed but it still had this error with almost all my mods. the mods I'm running are calamity, thorium, hero's mod, spirit and some other stuff that don't conclude to the problem.
 

Attachments

  • error 2.png
    error 2.png
    424.5 KB · Views: 557
  • error.png
    error.png
    442.6 KB · Views: 487
ребят помогите пожалуйста у меня вот такая проблема
System.DllNotFoundException: Unable to load DLL 'CSteamworks': Не найден указанный модуль. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)

веpсия теppаpии 1.3.5.3 скачал tMODLoader у вас и вот такая ошибка вылазиет скачал terraria от GOG купить terraria нет денег
[doublepost=1515667810,1515667460][/doublepost]ребят помогите пожалуйста у меня вот такая проблема
System.DllNotFoundException: Unable to load DLL 'CSteamworks': Не найден указанный модуль. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)

веpсия теppаpии 1.3.5.3 скачал tMODLoader у вас и вот такая ошибка вылазиет скачал terraria от GOG купить terraria нет денег
 
ребят помогите пожалуйста у меня вот такая проблема
System.DllNotFoundException: Unable to load DLL 'CSteamworks': Не найден указанный модуль. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)

веpсия теppаpии 1.3.5.3 скачал tMODLoader у вас и вот такая ошибка вылазиет скачал terraria от GOG купить terraria нет денег
[doublepost=1515667810,1515667460][/doublepost]ребят помогите пожалуйста у меня вот такая проблема
System.DllNotFoundException: Unable to load DLL 'CSteamworks': Не найден указанный модуль. (Exception from HRESULT: 0x8007007E)
at Steamworks.NativeMethods.SteamAPI_RestartAppIfNecessary(AppId_t unOwnAppID)
at Terraria.Social.Steam.CoreSocialModule.Initialize()
at Terraria.Social.SocialAPI.Initialize(Nullable`1 mode)
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)

веpсия теppаpии 1.3.5.3 скачал tMODLoader у вас и вот такая ошибка вылазиет скачал terraria от GOG купить terraria нет денег
https://github.com/blushiemagic/tMo...tfoundexception-unable-to-load-dllcsteamworks
 
Hey devs! Can you help me? I'm trying to disable the knock-back of a projectile or just setting it to not effective (0), but I already tried so many ways that I don't know what I can do to solve this issue! Just to make it clear and fair, I tried to set
Code:
projectile.knockBack = 0;
in the AI() method, tried creating it with 0 knock-back in the
Code:
Projectile.NewProjectile()
method and also tried with a
Code:
Main.projectile[K].knockBack = 0;
right after creating it, but none of this worked...
I Solved the issue. Just needed to use the OnHitByProjectile method on my GlobalPlayer.
 
Hey.. i'm not here for like.. flame or something, i just wanna inform.

I tried to download some mods from my mod browser and alright, but i had errors trying to reload em, i checked a few things to discover what was causing that error. Then i noticed something.. Mods were for 1.3.5.3 and i had Terraria 1.3.5.2, which surprised me cuz i play it on steam.. Then i went to play normal Terraria and i had 1.3.5.3 and i was like.. the :red: xDD
And then, i tried to install tModLoader again. THe last version, which is 0.10.1.1
Before installing it, i checked its Terraria's version, and it was on 1.3.5.1
I don't know if maths aply here but wtf xD

Can someone help me or explain or wtf? Cuz i rlly wanna play modded Terraria q-q

Thanks for reading me tho, and sorry if you had struggles reading my English lol
 
Hey.. i'm not here for like.. flame or something, i just wanna inform.

I tried to download some mods from my mod browser and alright, but i had errors trying to reload em, i checked a few things to discover what was causing that error. Then i noticed something.. Mods were for 1.3.5.3 and i had Terraria 1.3.5.2, which surprised me cuz i play it on steam.. Then i went to play normal Terraria and i had 1.3.5.3 and i was like.. the :red: xDD
And then, i tried to install tModLoader again. THe last version, which is 0.10.1.1
Before installing it, i checked its Terraria's version, and it was on 1.3.5.1
I don't know if maths aply here but wtf xD

Can someone help me or explain or wtf? Cuz i rlly wanna play modded Terraria q-q

Thanks for reading me tho, and sorry if you had struggles reading my English lol
tModLoader is based on 1.3.5.2, so when you install tmodloader, the text in the bottom left will say 1.3.5.2. Think of tModLaoder and Vanilla Terraria as completely separate things, when using tModLoader, only the tmodloader version matters.
 
tModLoader is based on 1.3.5.2, so when you install tmodloader, the text in the bottom left will say 1.3.5.2. Think of tModLaoder and Vanilla Terraria as completely separate things, when using tModLoader, only the tmodloader version matters.
Oh :red:.. well thank you :D
 
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.
 

Attachments

  • image.png
    image.png
    65 KB · Views: 358
Last edited:
Could anyone give me a proper code for item location so that a very big swords like this (Size of the sword is 128x128) could fit in the hand? I was trying to find proper X and Y location but it's just frustrating.

20180113_005937.jpg
 
Back
Top Bottom