tModLoader Official tModLoader Help Thread

NameTaken

Skeletron
how would i put a message in chat? Like to make sure you know that the expert exclusive item you just used in normal mode didnt work. Or the opposite, to make sure you know it DID work.
 

SapphireSuicune

Spazmatism
how do i make a custom flamethrower? I made one but it just shoots one projectile and some dust instead of actually having the whole thing do damage? also the flames come out pretty far from the actually weapon
 

NameTaken

Skeletron
how do i make a custom flamethrower? I made one but it just shoots one projectile and some dust instead of actually having the whole thing do damage? also the flames come out pretty far from the actually weapon
Im pretty sure flamethrowers are basically like the clockwork assault rifle (shoots multiple times per click and only consumes 1 ammo), but the projectile is a little different. The projectile is basically invisible due to the amount of dust, and it sets things on fire. I've never tried making a flamethrower, but this is what it seems like to me. Someone tell me if im wrong.
Also unless you want some special flames of some sort i would recommend using the normal flamethrower projectile.
 

SapphireSuicune

Spazmatism
I know this isn't really help with code, but it's for my mod.
Does anyone know what dust the onyx blaster uses? The number or the name is fine.
 

Piercepotato

Terrarian
I have an item that spawns bees when it hits an NPC - and I have no idea how to get it to be affected by the Hive Pack. I know the hive pack enables strongBees, but I don't know how to check for that. I've tried if (player.strongBees == true) but that doesn't even build. I checked ExampleMod and couldn't find what I was looking for. I'm also not at all used to C# or much coding in general so I'm probably just missing something really easy.

try decompiling the scripts for vanilla bee items and see what code they use.
 

Piercepotato

Terrarian
Does anyone know how to give tmodloader more memory? since I don't have many mods, and the program crashes ... and I really have a good pc

I believe there is a program you can find somewhere online that can double it’s allocated memory, but there’s no way to increase it beyond that. Big Terraria mods can take a huge amount of memory, so try disabling mods until you can launch into the game.
 

Dacern

Terrarian
Hey, can someone please help me figure out why every time I start up tModLoader, my game crashes?
I've tested a bit, and it only happens when the game tries to load my mod, and if I comment these lines of code it works fine.
Basically, can someone please help me figure out the issue with this code and help me to get it working? Thanks.

public class EndlessLuminiteArrowQuiver : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("It's time for the REAL fun to begin now...");
}

public override void SetDefaults()
{
item.damage = 15;
item.ranged = true;
item.width = 8;
item.height = 8;
item.consumable = false;
item.knockBack = 3.5f;
item.shoot = 639;
item.shootSpeed = 3f;
item.ammo = AmmoID.Arrow;
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.EndlessQuiver, 1);
recipe.AddIngredient(ItemID.MoonlordArrow, 3996);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

Yeah, I know, a lot of people have this idea, but I'm hoping to expand it further into stuff like endless ichor quiver, endless cursed dart case, endless crystal bullet pouch, etc.
 
Last edited:

GamingEinstein

Skeletron Prime
So I'm trying to code this below...

public override void SetDefaults()
{

item.useTime = 5;
item.consumable = false;
item.noMelee = true;
item.useAnimation = 28;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Meowmere;

}

But Visual Studio is telling me that the "item.UseSound = SoundID.Meowmere;" is invalid because it "Cannot implicitly convert type 'int' to 'Terraria.Audio.LegacySoundStyle'. I also am using this same general code but for "item.UseSound = SoundID.Moonlord;"

Anyone got any ideas?
 

Dacern

Terrarian
So I'm trying to code this below...

public override void SetDefaults()
{

item.useTime = 5;
item.consumable = false;
item.noMelee = true;
item.useAnimation = 28;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Meowmere;

}

But Visual Studio is telling me that the "item.UseSound = SoundID.Meowmere;" is invalid because it "Cannot implicitly convert type 'int' to 'Terraria.Audio.LegacySoundStyle'. I also am using this same general code but for "item.UseSound = SoundID.Moonlord;"

Anyone got any ideas?

put in item.UseSound = SoundID.Item57;
that should work
 

Stardust9681

Terrarian
Hey, can someone please help me figure out why every time I start up tModLoader, my game crashes?
I've tested a bit, and it only happens when the game tries to load my mod, and if I comment these lines of code it works fine.
Basically, can someone please help me figure out the issue with this code and help me to get it working? Thanks.

public class EndlessLuminiteArrowQuiver : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("It's time for the REAL fun to begin now...");
}

public override void SetDefaults()
{
item.damage = 15;
item.ranged = true;
item.width = 8;
item.height = 8;
item.consumable = false;
item.knockBack = 3.5f;
item.shoot = 639;
item.shootSpeed = 3f;
item.ammo = AmmoID.Arrow;
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.EndlessQuiver, 1);
recipe.AddIngredient(ItemID.MoonlordArrow, 3996);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

Yeah, I know, a lot of people have this idea, but I'm hoping to expand it further into stuff like endless ichor quiver, endless cursed dart case, endless crystal bullet pouch, etc.
Look at where your SetDefaults() ends. You need to close it after defaults, and override AddRecipes to add a new recipe, last I checked. Hope that helps.
 

Stardust9681

Terrarian
Does anybody know where I could find a guide to creating an “alternate dimension” if that’s possible? Thanks!
I don't think it's possible to make an alternate dimension, at least, not without some serious overriding of code and increasing world file size by a good amount. Unlike other games that use multiple worlds/dimensions in their "world", Terraria has one big map that covers the whole world. Sorry to disappoint.
 

Stardust9681

Terrarian
how would i put a message in chat? Like to make sure you know that the expert exclusive item you just used in normal mode didnt work. Or the opposite, to make sure you know it DID work.
I'm fairly certain you can just put in the following line on a conditional:
C#:
Main.NewText("<Your message here>", 255, 255, 33); //255, 255, and 33 are rgb colours.
 
Top Bottom