Standalone [1.3] tModLoader - A Modding API

It's alive

Anyways, it's time for some news. On Friday, I go back to college. School doesn't actually start until half a week after that, but I'll have to start preparing for classes. This means that I will no longer have all day to procrastinate work on tModLoader; I predict that my speed for this project will drop down to however fast people normally take for these kinds of things. I would like to take this time to remind everyone that (if you have a good enough computer) you can contribute through the Github project, which will decompile Terraria for you then patch the code into tModLoader.

As for the next update, as you can tell from the video, a lot of things have been added. I plan to release the next update once I add a bunch of stuff to the example mod, before school starts. The next update will not include banner support or town NPCs; I probably won't have time for those before school starts. Other than that, the next update will include full support for NPCs and projectiles, complete with in-depth examples from the example mod.

Also when you mistype "project" as "projectile" you know you've been working with Terraria too much :p
 
@bluemagic123 Hello there!
I have received some textures from a spriter. However he has sent them as JPG. Can I still use these, or do I have to use some sketchy online converter?
It should be no problem for a real spriter so change his images to png. Jpg is not good at all and he should have som original filetypes that does not damage his sprites.
 
It's alive

Anyways, it's time for some news. On Friday, I go back to college. School doesn't actually start until half a week after that, but I'll have to start preparing for classes. This means that I will no longer have all day to procrastinate work on tModLoader; I predict that my speed for this project will drop down to however fast people normally take for these kinds of things. I would like to take this time to remind everyone that (if you have a good enough computer) you can contribute through the Github project, which will decompile Terraria for you then patch the code into tModLoader.

As for the next update, as you can tell from the video, a lot of things have been added. I plan to release the next update once I add a bunch of stuff to the example mod, before school starts. The next update will not include banner support or town NPCs; I probably won't have time for those before school starts. Other than that, the next update will include full support for NPCs and projectiles, complete with in-depth examples from the example mod.

Also when you mistype "project" as "projectile" you know you've been working with Terraria too much :p
Yay, that's awesome!
As for me I don't need banners right now, I just need to create MOOONSTERS *evil laugh*!
 
Try (Maybe it won't help but try)
Code:
      TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 18 };
Try deleting the CoordinateHeights line. By default the 3x3 style uses {16, 16, 16} for the coordinate heights.

Thanks to both of you. Both suggestions worked, but I'll use bluemagic123's one. That was almost the only line that I didn't try disabling. It's fairly obvious, now that I look at it...

Also, I noticed that there's a recipe.anyIronBar, but nothing for the other ranks of bars. Are these coming in later updates?

Welp, it's pretty much impossible to decompile with a 4GB system. I'd like to contribute to the project, but I'll have to wait on that.
I wasn't able to decompile NPC.cs with 4GB either. I even tried 3 USB sticks with readyboost to see if it made any difference. It didn't.

Has anyone else noticed that the file version of Terraria.exe is still 1.3.0.7 even though Terraria is now 1.3.0.8?
 
It's alive

Anyways, it's time for some news. On Friday, I go back to college. School doesn't actually start until half a week after that, but I'll have to start preparing for classes. This means that I will no longer have all day to procrastinate work on tModLoader; I predict that my speed for this project will drop down to however fast people normally take for these kinds of things. I would like to take this time to remind everyone that (if you have a good enough computer) you can contribute through the Github project, which will decompile Terraria for you then patch the code into tModLoader.

As for the next update, as you can tell from the video, a lot of things have been added. I plan to release the next update once I add a bunch of stuff to the example mod, before school starts. The next update will not include banner support or town NPCs; I probably won't have time for those before school starts. Other than that, the next update will include full support for NPCs and projectiles, complete with in-depth examples from the example mod.

Also when you mistype "project" as "projectile" you know you've been working with Terraria too much :p
That boss is impressive! Was it hard to make? Did you use some existing AI and tweak it a bit, or make your own? I think the eyes in the second stage are using some version of Retinazer's AI.
 
Nice boss AI! very impressive ;)


Is it possible in the current build to add the I.E Molten Armor flame effect but purpley-blueish? going for the full look of the abyss :)
 
How does one fix this:
11909895_1110594445634790_1462409630_n.jpg

I updated the tModloader when this happened. :/
I believe that it is a character from old version. It won't work.
 
Hi again @bluemagic123!

Hopefully this'll be my last post on this issue. I've tried what you said ... and everything eles. The last 4 hours of my life have been spent looking through Main.cs and I'm about to explode.

Here's my code. I've tried changing the numbers around, using different Draw() functions etc. Brain is kill.
Code:
int num9 = 32;
     int num11 = 0;
     int num12 = 18;
     int frameX = 0;
     int frameY = 0;
     Vector2 zero = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange);
     if (Main.drawToScreen)
     {
       zero = Vector2.Zero;
     }
     var vect = new Vector2((float)(i * 16 - (int)Main.screenPosition.X) - ((float)num9 - 16f) / 2f, (float)(j * 16 - (int)Main.screenPosition.Y + num11)) + zero;
     var rect = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) frameX, (int)frameY, num9, num12));
     var color = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255);
     Texture2D texture;
     texture = Main.tileTexture[Type];
     
     spriteBatch.Draw(texture, vect, rect, color);

I keep getting this/variations of it
Screenshot (27).png

(plus bonus example of glitch that happens sometimes - is that zombie meant to be called that?)


All I want to do is shade the damn thing, is there any way to do that without redrawing the entire texture? (this also really stuffs up with tiles - either drawing the whole texture for every tile or drawing the wrong frames)

The thing that seems to be wrong is that I'm getting the frames wrong ... but I'll be dead before I figure out how to fix that on my own.
 
Is it possible to modify the used item's position when it's used? I have a gun which has its handle apart from the sprite's right side.
 
Today I woke up to alerts in the double-digits entirely from here :p

@bluemagic123 Hello there!
I have received some textures from a spriter. However he has sent them as JPG. Can I still use these, or do I have to use some sketchy online converter?
You should be able to use any image editor to open it then save it as a png.

Thanks to both of you. Both suggestions worked, but I'll use bluemagic123's one. That was almost the only line that I didn't try disabling. It's fairly obvious, now that I look at it...

Also, I noticed that there's a recipe.anyIronBar, but nothing for the other ranks of bars. Are these coming in later updates?


I wasn't able to decompile NPC.cs with 4GB either. I even tried 3 USB sticks with readyboost to see if it made any difference. It didn't.

Has anyone else noticed that the file version of Terraria.exe is still 1.3.0.7 even though Terraria is now 1.3.0.8?
I probably won't add anything for other bars myself, but you can create crafting groups that contain other bars.

That boss is impressive! Was it hard to make? Did you use some existing AI and tweak it a bit, or make your own? I think the eyes in the second stage are using some version of Retinazer's AI.
I made all the AI entirely from scratch around half a year ago (I think it took a day or two), then added on some expert mode stuff yesterday (the lasers between the eyes and the second-stage ghost things). For the second stage I was trying to make some of the eyes behave similarly to Retinazer, although I'm too lazy to look for the actual Retinazer code :p

How does one fix this:
11909895_1110594445634790_1462409630_n.jpg

I updated the tModloader when this happened. :/
v0.4 uses a different format for saving characters and worlds with modded content. So any characters/worlds with modded content will be incompatible with this version.

Hi again @bluemagic123!

Hopefully this'll be my last post on this issue. I've tried what you said ... and everything eles. The last 4 hours of my life have been spent looking through Main.cs and I'm about to explode.

Here's my code. I've tried changing the numbers around, using different Draw() functions etc. Brain is kill.
Code:
int num9 = 32;
     int num11 = 0;
     int num12 = 18;
     int frameX = 0;
     int frameY = 0;
     Vector2 zero = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange);
     if (Main.drawToScreen)
     {
       zero = Vector2.Zero;
     }
     var vect = new Vector2((float)(i * 16 - (int)Main.screenPosition.X) - ((float)num9 - 16f) / 2f, (float)(j * 16 - (int)Main.screenPosition.Y + num11)) + zero;
     var rect = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) frameX, (int)frameY, num9, num12));
     var color = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255);
     Texture2D texture;
     texture = Main.tileTexture[Type];
  
     spriteBatch.Draw(texture, vect, rect, color);

I keep getting this/variations of it View attachment 72952
(plus bonus example of glitch that happens sometimes - is that zombie meant to be called that?)


All I want to do is shade the damn thing, is there any way to do that without redrawing the entire texture? (this also really stuffs up with tiles - either drawing the whole texture for every tile or drawing the wrong frames)

The thing that seems to be wrong is that I'm getting the frames wrong ... but I'll be dead before I figure out how to fix that on my own.
num9 is more supposed to be the width of the frame.

I forget whether or not I showed this already, but here's what I did in tAPI that worked for me. It should work for most tiles:
Code:
        Tile tile = Main.tile[x, y];
        Vector2 zero = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange);
        if(Main.drawToScreen)
        {
            zero = Vector2.Zero;
        }
        Main.spriteBatch.Draw(modBase.textures["Tiles/WirelessTransceiverGlow"], new Vector2((float)(x * 16 - (int)Main.screenPosition.X) - 1, (float)(y * 16 - (int)Main.screenPosition.Y) - 1) + zero, new Rectangle?(new Rectangle((int)tile.frameX, (int)tile.frameY, 16, 16)), new Color(200, 200, 200, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);


Is it possible to modify the used item's position when it's used? I have a gun which has its handle apart from the sprite's right side.
You can override the UseStyle hook to set the item's position. There might also be some sort of array in Item or ItemID.Sets that could help.
 
It's alive

Anyways, it's time for some news. On Friday, I go back to college. School doesn't actually start until half a week after that, but I'll have to start preparing for classes. This means that I will no longer have all day to procrastinate work on tModLoader; I predict that my speed for this project will drop down to however fast people normally take for these kinds of things. I would like to take this time to remind everyone that (if you have a good enough computer) you can contribute through the Github project, which will decompile Terraria for you then patch the code into tModLoader.

As for the next update, as you can tell from the video, a lot of things have been added. I plan to release the next update once I add a bunch of stuff to the example mod, before school starts. The next update will not include banner support or town NPCs; I probably won't have time for those before school starts. Other than that, the next update will include full support for NPCs and projectiles, complete with in-depth examples from the example mod.

Also when you mistype "project" as "projectile" you know you've been working with Terraria too much :p
You sir just got yourself another subscriber.
 
Hey @bluemagic123 sorry to ask but when will the new update be released (4.1) ?
It will be released... when it's ready. :p
My goal is to release it by Monday at latest though.

You sir just got yourself another subscriber.
I honestly don't use that channel much anymore; mostly just when I want to make a video too large for gifs so I can embed it somewhere.
 
You can't directly ... however, you can craft a 'bag' to produce two items. Take a look at the ExplorerBag in the example mod.
How do you make it so a bag produces new modded items?

Also, didn't get how to make a recipe where you need 2 ingredients, consume the first as normal but keep the second.
 
How do you make it so a bag produces new modded items?

Also, didn't get how to make a recipe where you need 2 ingredients, consume the first as normal but keep the second.
I'm pretty sure you just have to replace ItemID.<item> with null, "<mod item>".

Edit: Never mind you get an error from that.
 
How do you make it so a bag produces new modded items?

Also, didn't get how to make a recipe where you need 2 ingredients, consume the first as normal but keep the second.
If you want a bag to create your own items, you can get the ID of your item with mod.ItemType("InternalItemName").

To make it so that an ingredient isn't consumed, you can override ModRecipe then use this hook:
https://github.com/bluemagic123/tMo...rtual-int-consumeitemint-type-int-numrequired
 
Back
Top Bottom