Standalone [1.3] tModLoader - A Modding API

Quick question. Is it possible to decompile another .tmod file to view it as its source? (ie. Example mod). I am interested into getting into this whole "modding community", but I am new and viewing source files may help me understand stuff a little bit better than with just the example mod.

I don't know if you can decompile tModLoader mods, but you can open .tapi mods using 7-zip or a similar program... it won't help that much since it is for a different version and a different modding API after all, but you can still learn from it. As for the ExampleMod, the download in the opening post includes the source code. I'm not sure how you got the mod but not the source code... unless I'm misunderstanding and you want to do with other mods what you can do with ExampleMod
 
Quick question. Is it possible to decompile another .tmod file to view it as its source? (ie. Example mod). I am interested into getting into this whole "modding community", but I am new and viewing source files may help me understand stuff a little bit better than with just the example mod.
It is possible. However, before you try to directly decompile it you'll have to separate the bytes in the file that represent the code from the bytes that represent things like images, etc. And in order to do that you'll have to look at the code for how it's saved and read then make your own program to separate everything.
 
I don't know if you can decompile tModLoader mods, but you can open .tapi mods using 7-zip or a similar program... it won't help that much since it is for a different version and a different modding API after all, but you can still learn from it. As for the ExampleMod, the download in the opening post includes the source code. I'm not sure how you got the mod but not the source code... unless I'm misunderstanding and you want to do with other mods what you can do with ExampleMod

I DID get the source code, but I am looking for even more. :p Sorry for being misleading. Also, thanks for the information andre.

It is possible. However, before you try to directly decompile it you'll have to separate the bytes in the file that represent the code from the bytes that represent things like images, etc. And in order to do that you'll have to look at the code for how it's saved and read then make your own program to separate everything.

Thanks guys. It seems to me that plenty of the hooks are fairly similar between Tapi mods and TModLoader mods, so it may suit me better as I wouldn't be spending so much time on creating a custom decompiler instead of familiarizing myself with this new api. :D Btw, the progress you are making on TModLoader is just insane. Thanks for that. :happy:
 
Would anyone know why i'm getting a missing texture error on a texture that is there..?
It would most likely be because of some small typo. You'd be amazed how many people make small typos in their file names, check it over 10 times, and never find it.

If for certain it isn't a typo, then you'll need to give more information.
 
What do you mean by "doesn't work"?
The sprite is 374x240 pixels, when you are in game, you can see the real size of the NPC, but the collide box are smaller than the NPC...
Sin_t_tulo.png

As you can see, the hitbox of the NPC are smaller than the sprite
 
The sprite is 374x240 pixels, when you are in game, you can see the real size of the NPC, but the collide box are smaller than the NPC...
Sin_t_tulo.png

As you can see, the hitbox of the NPC are smaller than the sprite
Can you show us the SetDefaults function of your NPC?
 
Can you show us the SetDefaults function of your NPC?
Code:
public override void SetDefaults()
    {
        npc.name = "Golden Slime";
        npc.displayName = "Golden Slime";
        npc.aiStyle = 15;
        npc.lifeMax = 100000;
        npc.damage = 60;
        npc.defense = 35;
        npc.knockBackResist = 0f;
        npc.width = 374;
        npc.height = 240;
        Main.npcFrameCount[npc.type] = 5;
        npc.npcSlots = 1;
        npc.boss = true;
        npc.soundHit = 1;
        npc.soundKilled = 1;
        music = 12;
    }
 
Does anyone here know how to make neutral creatures? like bunnies for example.
Vanilla Bunny and all other npc field values can be found here: https://github.com/bluemagic123/tModLoader/wiki/Vanilla-NPC-Field-Values

Try setting aiStyle to 7. (and aiType to NPCID.Bunny if you need to...or whatever neutral creature behavior you want to mimic.) Oddly, bunny doesn't have Friendly set to true. Let me know if this works at all. (aiStyle to 24 for birds....just check the spreadsheet.)

Edit:
Setting lifemax to 5 or less or setting Friendly to true will prevent Minions from targeting it. Other than that, just make sure your neutral NPC doesn't attack the player.
 
Last edited:
Its crazy how good at programming some people are. there are mods that add entire biomes, and i can't even make a critter without help! By the way, does anyone know how to access vanilla sprite animations? thanks for the help everyone.
 
Last edited:
Its crazy how good at programming some people are. there are mods that add entire biomes, and i can't even make a critter without help! By the way, does anyone know how to access vanilla sprite animations? thanks for the help everyone.
I'm just going to link you to this thread. All instructions are on there.
Hope it helps!
 
Is it possible (with the current tmodloader capabilities) to make an accessory which turns all weapons auto-usable?
If so, would it be hard?
 
BlueMagic, can you also add an animated Mod tile, Flail, Spear, Summon type weapons examples in the Example Mod?
Or can anyone just tell me how to animate a Mod tile Asap please? :eek:
 
BlueMagic, can you also add an animated Mod tile, Flail, Spear, Summon type weapons examples in the Example Mod?
Or can anyone just tell me how to animate a Mod tile Asap please? :eek:
In the SetDefaults function of your ModTile, define 'animationFrameHeight' with the height of each of your animation frames including the padding. So if your animation is 48 pixels high (for example) and there is a padding of 2 pixels between each frame, you set animationFrameHeight to 50.
Then you can override the AnimateTile function inside your tile where you can increase the second parameter (called frameCounter by default) and check that against a set value of ticks. If the check returns true, then you can set the first parameter (called frame by default) to the animation frame you want to display (and reset frameCounter, ofc).
 
How would I program a tile so that it would only work as a crafting station if a specific tile was immediately adjacent to it?

Think Minecraft's mods' multiblock structures, but in Terraria.
 
Back
Top Bottom