Standalone [1.3] tModLoader - A Modding API

I think I found a bug UseItem doesn't work for me. Does anyone else having this problem?
 
I think I found a bug UseItem doesn't work for me. Does anyone else having this problem?
How doesn't it work? Could you show your 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.
 
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.
 
Do any vanilla bosses do that? I think sprite effects will only flip horizontally.
Ah that's what I meant, like it mirroring right? That's what I'm looking for anyway...
 
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: 247
my mod browser does not work and I don't know how to fix it:confused:
 
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.
 
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
Are you testing it on a ranged weapon (one that shoots)? If so, UseItem is not being called for ranged weapons (in my experience). You'll want to use the Shoot function for that instead.
 
Are you testing it on a ranged weapon (one that shoots)? If so, UseItem is not being called for ranged weapons (in my experience). You'll want to use the Shoot function for that instead.
Oh I tried changing UseItem with Shoot and it worked. Thanks :D
 
At the moment no. I'll add that to the to-do list.


Ok then, i will wait for update

One last question though: can we create a some sort of "placeholder" recipe, that can be used with any item?For example, you craft one random item with Super Essence of Ultimate Power of Gods and it gets, lets say, prefix?
 
How do you make an ore generate in the world?
 
Nevermind the last post, I really need to know how to make projectiles shoot out in a cirlce.
 
Back
Top Bottom