Standalone [1.3] tModLoader - A Modding API

What is going on with the tmodloader mod browser? The server has been down for hours and is annoying me.
So My mod browser is under heavy load
what does it means?
does that means youre working on the mod browser?
That means the daily bandwidth limit it has was reached. I'm investigating the cause of the sudden jump in downloads.
oh could you upload Player.cs somewhere on your github?
No, we can't. Not allowed
 
I'm having an issue with some experimental code.
I have a body armor item based off of ExampleMod. What I want it to do is copy the color of the player's skin color.
However, after adding in this code, any accessories worn around the body area stop being drawn.
Code:
public override void DrawArmorColor(Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor)
{
    PlayerDrawInfo info = new PlayerDrawInfo();

    color = info.bodyColor;
}
The armor's color is set correctly, but as said above, all accessories around the body area (shield, balloon, etc) stop drawing. The accessories appear again as soon as I take the armor off.

Additionally, the Shield of Cthulhu does not draw on dash, and neither does the afterimage effect.
 
Last edited:
I'm having an issue with some experimental code.
I have a body armor item based off of ExampleMod. What I want it to do is copy the color of the player's skin color.
However, after adding in this code, any accessories worn around the body area stop being drawn.
Code:
public override void DrawArmorColor(Player drawPlayer, float shadow, ref Color color, ref int glowMask, ref Color glowMaskColor)
{
    PlayerDrawInfo info = new PlayerDrawInfo();
    PlayerLayer.Body.layer.Invoke(info);

    color = info.bodyColor;
}
The armor's color is set correctly, but as said above, all accessories around the body area (shield, balloon, etc) stop drawing. The accessories appear again as soon as I take the armor off.

Additionally, the Shield of Cthulhu does not draw on dash, and neither does the afterimage effect.
That sounds like an exception is being thrown. Surround with try catch and log the exception.
 
That sounds like an exception is being thrown. Surround with try catch and log the exception.
How do I log the exception? I don't have much experience with try/catch blocks either.
I came up with this:
Code:
try
{
    PlayerDrawInfo info = new PlayerDrawInfo();

    color = info.bodyColor;
}
catch(System.Exception e)
{
    ErrorLogger.Log(e.ToString());
}
Would this work?
(I removed the Invoke line; turns out it wasn't needed. Behavior is still the same)

EDIT: I built the mod with this code, and everything still works as it is. Since the code is clearly still working, I can't possibly imagine there's even one exception occuring.
However, there's a good possibility that the reason this is happening is because of the method itself. In the documentation, it says that it changes the color of accessories around it too (which is bad. I don't want this.)

It's entirely possible that the body color has a very low alpha, making objects not intended to have that color invisible. Not getting the afterimage, though... possibly another side effect of the alpha change?

So I suppose the real question here is: is it possible to change the color of an armor piece without changing the color of nearby accessories? It feels like it should, since the game already seems to do that with dressers.
 
Last edited:
For the last 2, just add the correct tile.

The ExampleMod has an example of ice chest items.

The other ones need to be more specific, so I know which part is the part you need help with
Where in the example mod?

For the ore spawning, I have a ore (called Skaedium) that I want to generate like Cobalt or Palladium, (breaking a demon/crimson altar causes them to generate).

Is it possible to change the image of the moon once Hardmode is enabled? (Like how wearing sunglasses causes the sun image to change).

Also what's the tile ID for a Crimson altar?
 
Where in the example mod?

For the ore spawning, I have a ore (called Skaedium) that I want to generate like Cobalt or Palladium, (breaking a demon/crimson altar causes them to generate).

Is it possible to change the image of the moon once Hardmode is enabled? (Like how wearing sunglasses causes the sun image to change).

Also what's the tile ID for a Crimson altar?
Post world gen. Exampleworld.cs

No, that's all hard coded, unless you just want to piggyback off the tile being killed in a globaltile.

No, at least not that I think of.

It's TileID.DemonAltar
 
Code:
if (projectile.ai[1] > 0)
projectile.ai[0] = 0;
if (this.ai[0] == 0f)
{
this.velocity *= -1;
}
this.netUpdate = true;

"this" needs to be "projectile"

THANKS

Now that the boomerang goes through, how do I make it return faster. It was mentioned before that this is part of the AI I think, but it should be possible to do since the paladin's hammer uses the same AI as other boomerangs, but returns faster.

sorry if I'm annoying.

pls help
 
THANKS

Now that the boomerang goes through, how do I make it return faster. It was mentioned before that this is part of the AI I think, but it should be possible to do since the paladin's hammer uses the same AI as other boomerangs, but returns faster.

sorry if I'm annoying.

pls help
If I were you, I'd copy the ai code in and edit it directly, but if you want to do this blind, a solution might be changing the aiType to the hammer after collide
 
Everytime i have to download Tmodloader again and again because i can only play it once then when i try to play a second time it says:


System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (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)



WHAT SHOULD I DO!!!!!!
 
Everytime i have to download Tmodloader again and again because i can only play it once then when i try to play a second time it says:


System.DllNotFoundException: Unable to load DLL 'CSteamworks': The specified module could not be found. (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)



WHAT SHOULD I DO!!!!!!

Reinstall Terraria,how it looks you deleted CSteamworks.dll
 
Can anyone help me add more than one craft group. I can't seem to figure out how to add more.

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod
{
    public class ExampleMod : Mod
    {
        public ExampleMod()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }

        public override void AddRecipeGroups()
        {
            RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + " " + GetItem("ExampleItem").item.name, new int[]
            {
                ItemType("ExampleItem"),
                ItemType("EquipMaterial"),
                ItemType("BossItem")
            });
            RecipeGroup.RegisterGroup("ExampleMod:ExampleItem", group);
        }
    }
}
Here's how I do multiple craft groups.
public override void AddRecipeGroups()
{
//Add the silver ranked group
RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + " Silver", new int[]
{
ItemID.SilverBar,
ItemID.TungstenBar
});
RecipeGroup.RegisterGroup("TDK:rankSilver", group);
//Add the Gold ranked group
group = new RecipeGroup(() => Lang.misc[37] + " Gold", new int[]
{
ItemID.GoldBar,
ItemID.PlatinumBar
});
RecipeGroup.RegisterGroup("TDK:rankGold", group);
}

THANKS

Now that the boomerang goes through, how do I make it return faster. It was mentioned before that this is part of the AI I think, but it should be possible to do since the paladin's hammer uses the same AI as other boomerangs, but returns faster.

sorry if I'm annoying.

pls help
Sorry about the mistake with 'this.' instead of 'projectile.' Thanks jopojelly for catching it. ;)

The projectile's ai[0] is set to 1 to tell it to return to the player. You could try checking if ai[0] is 1 and then multiplying it' velocity by something bigger than 1. Or, if you want more control, you could do as jopojelly suggested. I remember someone asking for boomerang AI earlier this thread, though I don't know if any was provided.
 
Hello, Is that possible to add at the Menu like tmodloader adds its version?
42669a22dd0710e82a45597961dbb77b.png

I want to add my own mod version there too
 
I want to add my own mod version there too

I don't know if it is possible or not, but it sounds like the kind of thing that once one person does it, everyone will jump on board and, the next thing you know, the screen is crowded with version numbers.
 
Hello, Is that possible to add at the Menu like tmodloader adds its version?
42669a22dd0710e82a45597961dbb77b.png

I want to add my own mod version there too

What do you mean with 'too'? tModLoader is the application, it's not a loaded mod. I very much doubt you're going to be able to modify it through just a mod.
 
Here's how I do multiple craft groups.
public override void AddRecipeGroups()
{
//Add the silver ranked group
RecipeGroup group = new RecipeGroup(() => Lang.misc[37] + " Silver", new int[]
{
ItemID.SilverBar,
ItemID.TungstenBar
});
RecipeGroup.RegisterGroup("TDK:rankSilver", group);
//Add the Gold ranked group
group = new RecipeGroup(() => Lang.misc[37] + " Gold", new int[]
{
ItemID.GoldBar,
ItemID.PlatinumBar
});
RecipeGroup.RegisterGroup("TDK:rankGold", group);
}


Sorry about the mistake with 'this.' instead of 'projectile.' Thanks jopojelly for catching it. ;)

The projectile's ai[0] is set to 1 to tell it to return to the player. You could try checking if ai[0] is 1 and then multiplying it' velocity by something bigger than 1. Or, if you want more control, you could do as jopojelly suggested. I remember someone asking for boomerang AI earlier this thread, though I don't know if any was provided.

Thank you.
 
I wanted to Report a little Bug
If you add
Code:
player.wingTime =
to an Armor/accecoire the Gliding is broken a bit

Normal:
ezgif.com-video-to-gif(1).gif



With player.wingTime
ezgif.com-video-to-gif.gif
 
Back
Top Bottom