Standalone [1.3] tModLoader - A Modding API

Apologies if this has already been asked. I've done a search on this thread and did not find anything.

Current version: v0.7.1.1
Compatible with Terraria 1.3.0.8
Requires Steam
Platforms: Windows, Mac, Linux
Servers currently only work on Windows
Does this tool (and mods for it) work with the GOG version of Terraria?
 
So i tried to join my friends server like i was told and we used an ip address using hamachi but it still wont work, we have the tmodloader server program opened and everything
Hmm, maybe the port hasn't been forwarded on the computer that's hosting the server. You could use the port-forwarding tool that I linked you to, to check if port 7777 (or which ever port you chose) is open on the IP address of the computer hosting the server. If it isn't, you will need to find a port forwarding guide specific to the router of the computer that is hosting the server.

Somebody correct me if I'm wrong, but you shouldn't need Hamachi.

Apologies if this has already been asked. I've done a search on this thread and did not find anything.

Does this tool (and mods for it) work with the GOG version of Terraria?
Sadly, no. Nobody on the tModLoader team has the GOG version, so they can't make tModLoader work for GOG.
 
Last edited:
How do you add a drop to a specific vanilla mob? For example, gastropod.
You'll want to create a class that derives from GlobalNPC. Inside that class, override the NPCLoot function, check the type of the NPC and drop the item if necessary:
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MyMod.NPCs
{
    public class MyModNPC : GlobalNPC
    {
        public override void NPCLoot(NPC npc)
        {
            if(npc.type == NPCID.Gastropod)
            {
                // Drop your item.
            }
        }
    }
}
 
Can I ask that for 0.7.1.2, that you can specify a release time in UNIX time in build.txt, which will publish itself at that time. i.e. When I release an April fools version of my mod I do not want to be awake at midnight but that is when I want it to be released.
 
Thanks for your help since the start of porting my mod. I successfully made my own Ui and it works. Even tho the old ui still draw. I got one last question: How can we surpass max mana and max health in tmodloader. As I saw the max health can go beyond but does save at 500. So when you load again you lost the over health. The mana can't go over 400 as far as I tried. If someone got an answer I would be happy to work with it. Thank you.


And so far the mod is coming great togheter. Had to change a good part of it to port it to tModLoader.
 
Could anyone tell me what to put in public override void BossHeadSpriteEffects(ref SpriteEffects spriteEffects) to make it actually rotate the boss icon? Putting it in visual studio isn't helping me out for once.
 
Last edited:
Could anyone tell me what to put in public override void BossHeadSpriteEffects(ref SpriteEffects spriteEffects) to make it actually rotate the boss icon? Putting it in visual studio isn't helping me out for once.
Do any vanilla bosses do that? I think sprite effects will only flip horizontally.
 
Sadly, no. Nobody on the tModLoader team has the GOG version, so they can't make tModLoader work for GOG.
Bummer. :(

Obviously, I have the GOG version, so that's why I ask. If the team would like someone to help or test, I'm happy to do so. Please PM me with details if so.
 
Thanks for your help since the start of porting my mod. I successfully made my own Ui and it works. Even tho the old ui still draw. I got one last question: How can we surpass max mana and max health in tmodloader. As I saw the max health can go beyond but does save at 500. So when you load again you lost the over health. The mana can't go over 400 as far as I tried. If someone got an answer I would be happy to work with it. Thank you.


And so far the mod is coming great togheter. Had to change a good part of it to port it to tModLoader.
To increase the max health/mana more, you'll have to create some fields in your ModPlayer class, increase player.statLifeMax2 or player.statManaMax2 based on those stats, and save/load those fields in SaveCustomData and LoadCustomData.

I think I found a bug UseItem doesn't work for me. Does anyone else having this problem?
The bug's somewhere in your mod; can you show us the code?

Could anyone tell me what to put in public override void BossHeadSpriteEffects(ref SpriteEffects spriteEffects) to make it actually rotate the boss icon? Putting it in visual studio isn't helping me out for once.
You can make the boss head icon flip by setting spriteEffects to either SpriteEffects.FlipHorizontally or SpriteEffects.FlipVertically. SpriteEffects is in the Microsoft.Xna.Framework.Graphics namespace.
 
anyone knows how to fix this error please help I wanna play normally with my friends they can play online normally but when ever I sign in to my server an they playing I get the error and sometimes they do too, I'm playing the thorium mod with ersion please help asap.
 

Attachments

  • Untitled.png
    Untitled.png
    31.7 KB · Views: 212
I've got a bit of a conundrum here. I'm trying to spawn a projectile and store the projectile inside a field, but I'm having trouble getting it synced across a server.
Code:
if (Main.netMode != 1) //if not a client
            {
                int proNam = Projectile.NewProjectile(player.Center.X + (player.width + offsetX) * player.direction, (player.Center.Y + offsetY), (float)Math.Cos(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), (float)Math.Sin(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), mod.ProjectileType("NamPowerLead"), damage, knockBack, player.whoAmI);

                namLeader = Main.projectile[proNam]; //this line needs to happen on a client also
           
                if (Main.netMode == 2) //if a server
                {
                    NetMessage.SendData(27, -1, -1, "", proNam, 0.0f, 0.0f, 0.0f, 0); //Sync clients with server
                }
            }
I want namLeader to be set on clients and the server. I can't move it outside of the first if clause because it won't have access to proNam anymore.

The way I see it, I either need to get the server set namLeader on all clients, or send proNam to all clients and have them use that to set namLeader. Any suggestions?
 
Is there any way to check if item is crafted?Like tAPI's hook OnCraft?

For example, if I craft some item(even vanilla one), there's random chance that it would have "someRandomVar" variable set to 1.
 
Last edited:
The bug's somewhere in your mod; can you show us the code?
Sure here:
Code:
 public override bool UseItem(Item item, Player player)
        {
            //Main.NewText("USE");
            Main.NewText(Main.projectile.Length.ToString());
                        for(int m = 0; m < Main.projectile.Length; m++)
                        {
                            if(Main.projectile[m].type == mod.ProjectileType("CustomProjectile"))
                            {
                                CustomProjectile pro = (CustomProjectile)Main.projectile[m].modProjectile;
                                pro.test();
                            }
                    }
            return true;

        }
the Main.NewText are just for testing
 
I've got a bit of a conundrum here. I'm trying to spawn a projectile and store the projectile inside a field, but I'm having trouble getting it synced across a server.
Code:
if (Main.netMode != 1) //if not a client
            {
                int proNam = Projectile.NewProjectile(player.Center.X + (player.width + offsetX) * player.direction, (player.Center.Y + offsetY), (float)Math.Cos(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), (float)Math.Sin(player.itemRotation) * 3 * player.direction + (Main.rand.NextFloat() * 1f - 0.2f), mod.ProjectileType("NamPowerLead"), damage, knockBack, player.whoAmI);

                namLeader = Main.projectile[proNam]; //this line needs to happen on a client also
         
                if (Main.netMode == 2) //if a server
                {
                    NetMessage.SendData(27, -1, -1, "", proNam, 0.0f, 0.0f, 0.0f, 0); //Sync clients with server
                }
            }
I want namLeader to be set on clients and the server. I can't move it outside of the first if clause because it won't have access to proNam anymore.

The way I see it, I either need to get the server set namLeader on all clients, or send proNam to all clients and have them use that to set namLeader. Any suggestions?
Hm, the solution would depend on what exactly you're trying to use proNam for. I would think that you could set it somewhere from the projectile's AI.

Is there any way to check if item is crafted?Like tAPI's hook OnCraft?

For example, if I craft some item(even vanilla one), there's random chance that it would have "someRandomVar" variable set to 1.
At the moment no. I'll add that to the to-do list.

Sure here:
Code:
public override bool UseItem(Item item, Player player)
        {
            //Main.NewText("USE");
            Main.NewText(Main.projectile.Length.ToString());
                        for(int m = 0; m < Main.projectile.Length; m++)
                        {
                            if(Main.projectile[m].type == mod.ProjectileType("CustomProjectile"))
                            {
                                CustomProjectile pro = (CustomProjectile)Main.projectile[m].modProjectile;
                                pro.test();
                            }
                    }
            return true;

        }
the Main.NewText are just for testing
Can you show the rest of the item's code too? It doesn't help when we only have code that we already know isn't being called.
 
Back
Top Bottom