• Journey's End on PC - Find info here and here. Please report bugs and issues for PC 1.4 and 1.4.1 to Re-Logic here.
  • Journey's End on Mobile - Find info here. Report bugs for Mobile 1.4 to DR Studios at this link and give as much detail as possible.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Console and Switch - The latest news can be found here. To report a bug, please use this link.

tModLoader Official tModLoader Help Thread

Me and a friend are trying to install tModLoader on our computers. Mine runs fine and works right away, but for my friend it says it could not find a location to install to. So we tried to do his mainly exactly how so many guides told us to do, but now it keeps saying "Please run Terraria though the steam client" Even though that is exactly what he is doing. Can I get some help?
sure, what u do is u have to run it in the steamapps/common/terraria thing, run terraria.exe there
 

Gubzs

Terrarian
Came here to ask how to newline in the newer version but I tried on a whim and GOD BLESS YOU GUYS for allowing the \n character. I got so sick of the "1" + Environment.NewLine + "2" nonsense. 10/10.
 

Akito-kun

Terrarian
How do i create a for loop that does something for each active player? For each active player in a specific party (like red, green, blue, ..) would be even better. Any help would be appreciated :happy:
 

Solo-Ion

Dungeon Spirit
Came here to ask how to newline in the newer version but I tried on a whim and GOD BLESS YOU GUYS for allowing the \n character. I got so sick of the "1" + Environment.NewLine + "2" nonsense. 10/10.
Actually, it was possible to do that in earlier versions. You have been able to use \n to get three or more lines for some time now.

How do i create a for loop that does something for each active player? For each active player in a specific party (like red, green, blue, ..) would be even better. Any help would be appreciated :happy:
Something like the following can be used to loop through the player array, and I've included an if statement that checks if the player in the loop is friendly for free.
Code:
            for (int i = 0; i < Main.player.Length; i++ )
            {
                Player loopPlayer = Main.player[i];
                if (loopPlayer.active || loopPlayer.dead)
                    continue; //skip dead or inactive players
                if (loopPlayer == player || !(loopPlayer.hostile && player.hostile) || (player.team == loopPlayer.team && (loopPlayer.team != 0 || player.team != 0))) //if both the player and myself aren't hostile, or not on an enemy team.
                {
                    //this is a friendly player, or myself
                }
            }
The player's team is stored in player.team, though I forget which number relates to which colour.
 

Akito-kun

Terrarian
Something like the following can be used to loop through the player array, and I've included an if statement that checks if the player in the loop is friendly for free.
Code:
            for (int i = 0; i < Main.player.Length; i++ )
            {
                Player loopPlayer = Main.player[i];
                if (loopPlayer.active || loopPlayer.dead)
                    continue; //skip dead or inactive players
                if (loopPlayer == player || !(loopPlayer.hostile && player.hostile) || (player.team == loopPlayer.team && (loopPlayer.team != 0 || player.team != 0))) //if both the player and myself aren't hostile, or not on an enemy team.
                {
                    //this is a friendly player, or myself
                }
            }
The player's team is stored in player.team, though I forget which number relates to which colour.
You are amazing, thank you so much!
 

Solo-Ion

Dungeon Spirit
Reinstalling it was one of the first things we did- Multiple times. I don't understand it as much as the next guy but we are really trying to find a fix for this
It's possible that something in the ModLoader folder within My Documents has become corrupt somehow. Try renaming/removing the ModLoader folder and see if it works. The folder I'm referring to is \My Documents\My Games\Terraria\ModLoader.
 

Plague Doctor 2

Terrarian
Help guys! I'm new to tModLoader, so i can't do even this simple thing!!
All i want to do is to make consumable item that gives you debuff "On fire", that's it!
(MY HORRIBLE CODE IN SPOILER.)

I just want to understand how this works, but my item isn't even usable in game. It does nothing.
Just explain me how this works.
And for example, how to interact with player health through item? So that item would hurt you or heal you upon usage?
How do i spawn projectiles with item? - I want to make consumable item that spawns 10 bullets around player and launches them in different dirrections?

If someone will help me and write code for this items, then i can understand how it works.

Oh and last question. Where do i find "commands"? Like "target.AddBuff(BuffID.x, x)"?
What can i put instead "AddBuff"? What else can i do with target?

Please, i hope someone will help.

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

namespace TerraAbilities.Items.Cards
{
public class c1 : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Test");
Tooltip.SetDefault("* * *");
}

public override void SetDefaults()
{
item.width = 20;
item.height = 20;
item.maxStack = 999;
item.value = 15;
item.rare = 8;
}

public virtual bool CanConsumeItem (Player player)
{
return true;
}

public virtual bool ConsumeItem (Player player)
{
return true;
}

public virtual bool UseItem (Player player)
{
player.AddBuff(BuffID.OnFire, 60);
return true;
}
}
}
 

Sin Costan

Eye of Cthulhu
Help guys! I'm new to tModLoader, so i can't do even this simple thing!!
All i want to do is to make consumable item that gives you debuff "On fire", that's it!
(MY HORRIBLE CODE IN SPOILER.)

I just want to understand how this works, but my item isn't even usable in game. It does nothing.
Just explain me how this works.
And for example, how to interact with player health through item? So that item would hurt you or heal you upon usage?
How do i spawn projectiles with item? - I want to make consumable item that spawns 10 bullets around player and launches them in different dirrections?

If someone will help me and write code for this items, then i can understand how it works.

Oh and last question. Where do i find "commands"? Like "target.AddBuff(BuffID.x, x)"?
What can i put instead "AddBuff"? What else can i do with target?

Please, i hope someone will help.

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

namespace TerraAbilities.Items.Cards
{
public class c1 : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Test");
Tooltip.SetDefault("* * *");
}

public override void SetDefaults()
{
item.width = 20;
item.height = 20;
item.maxStack = 999;
item.value = 15;
item.rare = 8;
}

public virtual bool CanConsumeItem (Player player)
{
return true;
}

public virtual bool ConsumeItem (Player player)
{
return true;
}

public virtual bool UseItem (Player player)
{
player.AddBuff(BuffID.OnFire, 60);
return true;
}
}
}
Well for the most part, it looks correct. The problem is that you do "virtual" instead of "override".

You can find commands by using ilSpy on Terraria.exe. Other useful things can be found in the wiki [ https://github.com/blushiemagic/tModLoader/wiki ]
 

Akito-kun

Terrarian
My player changes the stats of an item from another player but these changes doesnt seem to arrive at the other players client automatically. How can I send those changes to his client?
 
error CS0246: The type or namespace name 'Minion' could not be found (are you missing a using directive or an assembly reference?), error CS0246: The type or namespace name 'HoverShooter' could not be found (are you missing a using directive or an assembly reference?)
im using minion.cs and hovershooter.cs in example mod to make my minion
and help?
 
I keep getting 1514 even though i copied it from a vid.
pls help

heres my code:


using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace PewPewMod.Items
{
public class line_cleanser.cs : ModItem
{
public override void SetDefaults()
{
item.name = "The Line Cleanser";
item.damage = 150;
item.melee = true;
item.width = 120;
item.height = 18;
item.toolTip = "dont.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 4;
item.knockBack = 6;
item.value = Item.buyPrice(0, 10, 0, 0);
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 

Zylch

Terrarian
I'm getting this issue - heres my code and the issue itself.

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

namespace MoreInvasions.Items.Weapons
{
public class Slimeblaster : ModItem

{
public override void SetDefaults()
{
item.name = "Slime blaster";
item.damage = 28;
item.ranged = true;
item.width = 40;
item.height = 28;
item.toolTip = "A Phoenix blaster covered in a slimy substance.";
item.useTime = 12;
item.useAnimation = 12;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 3;
item.value = 10000;
item.rare = 2;
item.useSound = SoundID.Item11;
item.autoReuse = false;
item.shoot = 10;
item.shootSpeed = 16f;
item.useAmmo = AmmoID.Bullet;
}

public override void AddRecipes()
{
ModRecipe recipe = new Modrecipe(mod);
recipe.AddIngredient(ItemID.23, 10);
recipe.AddIngredient(ItemID.239, 5);
recipe.AddIngredient(ItemID.219, 1);
recipe.AddTile(TileID.Hellforges);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}







c:\Users\Zylch\Documents\My Games\Terraria\ModLoader\Mod Sources\moreinvasions\Items\Slimeblaster.cs(6,15) : error CS0101: The namespace 'MoreInvasions.Items.Weapons' already contains a definition for 'Slimeblaster'
 
Object reference not set to an instance of an object.
at LegendsOfTerraria.Mounts.BrainMount.SetDefaults()
at Terraria.ModLoader.ModMountData.SetupMount(MountData mountData)
at Terraria.ModLoader.MountLoader.SetupMount(MountData mount)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

btw im making custom mount
 
Top Bottom