tModLoader Official tModLoader Help Thread

Would it be possible to make a weapon autoswing if i have a specific buff? for example, i want to make a buff that makes weapon 1 autoswing without making weapon 2 or 3 autoswing.

also how do i make the buff increase my melee damage and swing speed?
 
Last edited:
How do I make it so an NPC inflicts a buff on me with a 1 in 3 chance?
Sure thing! :happy:

C#:
    public override void OnHitPlayer(Player player, int damage, bool crit) {
        if (Main.rand.NextBool(3)) {
                player.AddBuff(Buff, Number, true);
        }
    }

Replace 'Buff' with a Buff ID.
Replace 'Number' with how long you want your buff to last. 60 = 1 second.
The '3' in (Main.rand.NextBool(3)) makes it so it has a 1 in 3 chance for the NPC to inflict the buff of your choice.
You can get Buff IDs from here: Buff IDs - The Official Terraria Wiki
Alternatively, you can get Buff IDs from here: Vanilla Buff IDs - GitHub
 
Last edited:
'sup guys
got a problem with terraria and tmodloader since 1.4 , the games dont launch and a there's a crash report.
I tried to uninstall then reinstall and now terraria don't launch at all and tmodloader keep crashing with this message :
View attachment 279984
I can share the logs folder if it can help too.
Try uninstalling and reinstalling Terraria one more time on steam.
Also, Tmodloader is now a dlc for Terraria.
After downloading Tmodloader, you will see both Terraria and Tmodloader as seperate games.
You're welcome! :D
 
I'm new to this world of mods, so someone could tell me how to put a glow effect on a weapon (sword, sickle, bow, etc.) and where to put it
Try this:
C#:
        public override void AI() {
                    Player owner = Main.player[projectile.owner];
                    projectile.light = Number;
        }
Replace 'Number' with a number ranging from 0 to 1. Remember to put an 'f' at the end of the number so Tmodloader can recognize that the number is a float (decimal)
 
Last edited:
Try this:
C#:
        public override void AI() {
                    Player owner = Main.player[projectile.owner];
                    projectile.light = Number;
        }
Replace 'Number' with a number ranging from 0 to 1. Remember to put an 'f' at the end of the number so Tmodloader can recognize that the number is a float (decimal)

well, he finds no replacement method
 
I'm pretty sure that that code is for a projectile, i'll try to figure out how to do it for a weapon, I think that you need to use dusts that produce light, kind of like night's edge or fiery greatsword.
 
Whoops, sorry about that. I only know how projectiles produce light, not weapons. Like NameTaken said, try using dusts that produce light.
 
I'm trying to implement a boss in the game, but for some reason, whenever he appears, he disappears immediately, I checked everything and I can't solve the problem (I'm new to mod, programming)


using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Private. NPCs
{

[AutoloadBossHead]
public class Private : ModNPC
{


public override void SetDefaults()
{
npc.aiStyle = 5;
npc.lifeMax = 7000;
npc.damage = 15;
npc.defense = 20;
npc.knockBackResist = 0.5f;
npc.width = 130;
npc.height = 264;
animationType = NPCID.DemonEye;
Main.npcFrameCount[npc.type] = 2;
npc.value = Item.buyPrice(0, 40, 75, 45);
npc.npcSlots = 1f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = true;
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit9;
npc.DeathSound = SoundID.NPCDeath1;
npc.buffImmune[24] = true;
music = MusicID.Boss2;
npc.netAlways = true;
}
public override void BossLoot(ref string name, ref int potionType)
{
potionType = ItemID.LesserHealingPotion;
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Private"));
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.700f * bossLifeScale);
npc.damage = (int)(npc.damage * 0.20f);
}
}
}
 
Try uninstalling and reinstalling Terraria one more time on steam.
Also, Tmodloader is now a dlc for Terraria.
After downloading Tmodloader, you will see both Terraria and Tmodloader as seperate games.
You're welcome! :D
I know that tmodloader and terraria are not the same game, and this show up when i try to start tmodloader cause terraria litteraly don't start.
I just tried to reinstall both and now terraria crash instead of don't launch and nothing has change for tmod.
Here's the message for terraria:
1592913522362.png

I have the logs of tmodloader if necessary.
 
I know that tmodloader and terraria are not the same game, and this show up when i try to start tmodloader cause terraria litteraly don't start.
I just tried to reinstall both and now terraria crash instead of don't launch and nothing has change for tmod.
Here's the message for terraria:
View attachment 280049
I have the logs of tmodloader if necessary.
I'm not sure if I can help as I am not an expert yet, but reading the top section, it seems like Terraria wants you to verify that the XNA Framework has been Installed. Again, I'm not 100% sure, but this is the best I can do to help at the moment.
 
I'm not sure if I can help as I am not an expert yet, but reading the top section, it seems like Terraria wants you to verify that the XNA Framework has been Installed. Again, I'm not 100% sure, but this is the best I can do to help at the moment.
you're the best bro
 
can any one help me to install tModLoader on PC, i have GOG version and i keep get this error message "
1593026344989.png
" and i also tried to rename the exe file to "Terraria_1.4.0.5.exe", i was getting the same error message then i changed it to "Terraria_1.4.0.5.exe" and the error message was saying this "
[14:09:26] [1/INFO] [tML]: Starting tModLoader v0.11.7.4 Windows client (6/24/2020)
[14:09:27] [1/INFO] [tML]: Running on NetFramework 4.8
[14:09:27] [1/INFO] [tML]: Executable: C:\GOG Games\tModLoader\tModLoader.exe
[14:09:27] [1/INFO] [tML]: Working Directory: C:\GOG Games\tModLoader
[14:09:27] [1/INFO] [tML]: Launch Parameters:
[14:09:27] [1/DEBUG] [tML]: Assembly Resolve: -> MonoMod.RuntimeDetour, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null
[14:09:27] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null -> MonoMod.Utils, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null
[14:09:27] [1/DEBUG] [tML]: Assembly Resolve: MonoMod.RuntimeDetour, Version=20.5.14.1, Culture=neutral, PublicKeyToken=null -> Mono.Cecil, Version=0.11.2.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e
[14:09:27] [1/DEBUG] [tML]: Assembly Resolve: -> Ionic.Zip.Reduced, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c
[14:09:27] [1/DEBUG] [tML]: Assembly Resolve: -> Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
[14:09:27] [1/INFO] [tML]: Checking GOG or manual installation...
[14:09:27] [1/FATAL] [tML]: ..\Terraria\Terraria_1.4.0.4.exe is not the unmodified Terraria executable.

GOG installs must have the unmodified Terraria executable to function.

If you patched the .exe, you can create a copy of the original exe and name it "Terraria_v<VERSION>.exe" so on all methods i did i am keep getting this error message that is say "Terraria_1.4.0.4.exe is not the unmodified Terraria executable" or "Terraria.exe is not the unmodified Terraria executable" so how i can make it works can any one help me.
 
Last edited:
I am making a boss NPC and whenever I respawn it the bosses npc.ai[0] etc. doesn't reset and starts back on the value they were at for the previous boss. Does anyone know what's wrong?

Here is the code
 

Attachments

  • DarkVoid.cs
    9.2 KB · Views: 134
Last edited:
I'm new to the mod making business, I would like to know how to add resistance to a block (to be able to define at what level of tool (pick, axe, hammer) it should be broken)
 
Last edited:
If I were to edit the code of the Deathweed to make it only spawn in corruption worlds and not crimson, what would I do to create that code?
 
Idk where to put this i guess under here:
So, i've installed myself and a few friends a tModLoader Server, the problem is, i want the server to run when i'm not online.
The Server is a Linux VServer and to start the server with PuTTy, i'm using the normal startscript named "tModLoaderServer" but it when i close PuTTy the server just stops, anyone got a solution?
KICKSTART=./${BASENAME}.bin.${ext}

# copy the Terraria and rename the terraria kickstart
if [ ! -f ${KICKSTART} ]; then
kicks=( Terraria*.bin.${ext} ) # find a vanilla kickstart, either Terra$
cp "./${kicks[0]}" $KICKSTART
fi

export MONO_IOMAP=all
$KICKSTART $@
You need to start the server as a different background process, google how to do it
 
Back
Top Bottom