• 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

Commend me now!

Terrarian
player.selectedItem is the index in the inventory of the selected item. player.HeldItem will return the item instance of that slot, then you want to check it's type against that number.

player.HeldItem.type == ....
thankyou so much.

and there has anothere problem

player.ammoCost80 = true;
player.ammoCost75 = true;
player.thrownCost50 = true;
player.thrownCost33 = true;

i add this code,and cost buff& cost potion.
but looks like still consume ammo.

i just find "manaCost = 1f" in player.cs .
did ammo or thrown has same code?
and how to make ammo can through walls?
how to add this code"tileCollide = false;"in moditem.cs?
 
Last edited:
Hello all! I am having an issue hosting my server as of the latest update. I have all my mods updated, I made a new world, and when I start the dedicated server it runs perfectly. When I go to log into my own dedicated server, it loads for about 1 second, then kicks me out and says "Invalid operation at this state". I've googled every little thing I can and so far people have had router issues, but i know my router is port forwarded, I have no firewalls blocking Terraria, wiped everything Terraria related and reinstalled, and I've given it high priority and all types of stuff. I can play single player fine, so at this point I'm not sure what steps to take.

EDIT: So I decided to try my server with only one mod being added at a time, the Abyss and Pharoah mod were the reason I couldn't make my server. Abyss would get stuck on syncing mods (10+ minute wait), and Pharoah would give me the error I was getting.

EDIT EDIT: Now I can play for anywhere between 5-10 minutes and I lose connection to my own hosted server. Is there a log that will tell me what is causing this, whether it's a mod or my internet?
 
Last edited:

JackCuzYNot

Terrarian
c:\Users\Jack Morgan\Documents\My Games\Terraria\ModLoader\Mod Sources\Energy\Items\Weapons\WaterMagic.cs(13,13) : error CS0200: Property or indexer 'Terraria.Item.Name' cannot be assigned to -- it is read only

c:\Users\Jack Morgan\Documents\My Games\Terraria\ModLoader\Mod Sources\Energy\Items\Weapons\WaterMagic.cs(18,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'Tooltip' and no extension method 'Tooltip' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Jack Morgan\Documents\My Games\Terraria\ModLoader\Mod Sources\Energy\Projectiles\WaterProjectile.cs(14,24) : error CS1061: 'Terraria.Projectile' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Projectile' could be found (are you missing a using directive or an assembly reference?)

can someone please help me with this?
Water magic is a magic weapon and Water Projectile is the projectile it shoots
 

dennisw100

Official Terrarian
c:\Users\Jack Morgan\Documents\My Games\Terraria\ModLoader\Mod Sources\Energy\Items\Weapons\WaterMagic.cs(13,13) : error CS0200: Property or indexer 'Terraria.Item.Name' cannot be assigned to -- it is read only

c:\Users\Jack Morgan\Documents\My Games\Terraria\ModLoader\Mod Sources\Energy\Items\Weapons\WaterMagic.cs(18,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'Tooltip' and no extension method 'Tooltip' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Jack Morgan\Documents\My Games\Terraria\ModLoader\Mod Sources\Energy\Projectiles\WaterProjectile.cs(14,24) : error CS1061: 'Terraria.Projectile' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Projectile' could be found (are you missing a using directive or an assembly reference?)

can someone please help me with this?
Water magic is a magic weapon and Water Projectile is the projectile it shoots
https://docs.google.com/document/d/1GY6Jyj0IkqfvQlXJUwXg60d2V8tIzumoNVgh5OWzGIc/edit
for the second 2 errors
 

MlgEggr0ll

Terrarian
hello, whenever I try to launch the tmodloader installer, an error message pops up saying 'could not find place to install to!'. Any help would be appreciated.
 

gui10pow

Skeletron Prime
When I try to launch terraria with tremor I have these errors:
External component has thrown an exception.
at Microsoft.Xna.Framework.Media.WmpProxyThread.RunInRightApartment(WmpProxyFunction proxyFunction)
at Microsoft.Xna.Framework.Media.UnsafeNativeMethods.DecodeStreamToTexture(Void* pDevice, UInt32 stream, Int32* targetWidth, Int32* targetHeight, XnaImageOperation operation, Int32 maxAspectRatio, Void** pTexture)
at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
at Microsoft.Xna.Framework.Graphics.Texture2D.FromStream(GraphicsDevice graphicsDevice, Stream stream)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Insufficient memory to continue program execution.
at Microsoft.Xna.Framework.Helpers.GetExceptionFromResult(UInt32 result)
at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
at Microsoft.Xna.Framework.Graphics.Texture2D.FromStream(GraphicsDevice graphicsDevice, Stream stream)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
(I have 8gb of ram)
I tried with 1.3.5.3 and 1.3.4.4 and both have this problem with tremor
I've always tested disabling mods and the problem is with tremor. I use calamity, spirit, and a lot of mods together and never had any problems, but when I try to add tremor to my mods it happens. I've always enabled only tremor+calamity, spirit or other mod and still having this problem.

Could Someone help me?
 

Sin Costan

Eye of Cthulhu
Just set your projectile.aiStyle to 0 or -1, and just use this as your code

Code:
public overide void AI() 
{
    if(projectile.velocity.X > 0)
    {
        projectile.rotation += 1 * Math.PI/180; // 1 degree rotation per tick
    }
    else
    {
        projectile.rotation -= 1 * Math.PI/180;
    }
}
Unless you wanted something else, this is the simplest you can go for a spinning projectile.
 

neoselket

Ice Queen
When i try to build my mod it gives me this error:

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(10,9) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(14,4) : error CS0103: The name 'AddTooltip' does not exist in the current context

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(22,4) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(int, int)' has some invalid arguments

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(22,25) : error CS1503: Argument 1: cannot convert from 'string' to 'int'

here's the BottledLava.cs file:
using Terraria.ModLoader;

namespace BetterPotions.Items
{
public class BottledLava : ModItem
{
public override void SetDefaults()
{
base.SetDefaults();
item.name = "Bottled Lava";
item.width = 20;
item.height = 26;
item.maxStack = 30;
AddTooltip("'Don't drink it'");
item.value = 100;
item.rare = 1;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient("Bottle");
recipe.needLava = true;
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 

Sin Costan

Eye of Cthulhu
When i try to build my mod it gives me this error:

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(10,9) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(14,4) : error CS0103: The name 'AddTooltip' does not exist in the current context

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(22,4) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModRecipe.AddIngredient(int, int)' has some invalid arguments

c:\Users\neoselket\Documents\My Games\Terraria\ModLoader\Mod Sources\BetterPotions\Items\BottledLava.cs(22,25) : error CS1503: Argument 1: cannot convert from 'string' to 'int'

here's the BottledLava.cs file:
using Terraria.ModLoader;

namespace BetterPotions.Items
{
public class BottledLava : ModItem
{
public override void SetDefaults()
{
base.SetDefaults();
item.name = "Bottled Lava";
item.width = 20;
item.height = 26;
item.maxStack = 30;
AddTooltip("'Don't drink it'");
item.value = 100;
item.rare = 1;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient("Bottle");
recipe.needLava = true;
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Use this guide if you are using .10
https://docs.google.com/document/d/1GY6Jyj0IkqfvQlXJUwXg60d2V8tIzumoNVgh5OWzGIc/edit
 

gigaomega658

Terrarian
Can anyone help me figure out what i'm doing wrong? whenever i try to build this i get cs0246 type or namespace player is missing

using Terraria.ID;

using Terraria.ModLoader;


namespace MOD.Items
{


[AutoloadEquip(EquipType.Shield)]
public class holyshield : ModItem


{
public override void SetStaticDefaults()

{
DisplayName.SetDefault("holyshield");

Tooltip.SetDefault("This is a modded sword.");
}


public override void SetDefaults()
{

item.width = 28;
item.height = 30;
item.toolTip = "They will die";
item.value = 10;
item.rare = 3;
item.accessory = true;
item.lifeRegen = 35;
}


public override void AddRecipes()
{

ModRecipe recipe = new ModRecipe(mod);

recipe.AddIngredient(ItemID.Wood, 10);

recipe.AddTile(TileID.WorkBenches);

recipe.SetResult(this);
recipe.AddRecipe();
}


public override void UpdateAccessory(Player player, bool hideVisual)
{

player.noFallDmg = true;
player.meleeDamage *= 2f;
player.thrownDamage *= 2f;
player.rangedDamage *= 2f;
player.magicDamage *= 2f;
player.minionDamage *= 2f;
player.manaCost -= 0.50f;
player.noFallDmg = true;
player.fireWalk = true;
player.lavaImmune = true;
player.noKnockback = true;

} }
}
 

Sin Costan

Eye of Cthulhu
Can anyone help me figure out what i'm doing wrong? whenever i try to build this i get cs0246 type or namespace player is missing

using Terraria.ID;

using Terraria.ModLoader;


namespace MOD.Items
{


[AutoloadEquip(EquipType.Shield)]
public class holyshield : ModItem


{
public override void SetStaticDefaults()

{
DisplayName.SetDefault("holyshield");

Tooltip.SetDefault("This is a modded sword.");
}


public override void SetDefaults()
{

item.width = 28;
item.height = 30;
item.toolTip = "They will die";
item.value = 10;
item.rare = 3;
item.accessory = true;
item.lifeRegen = 35;
}


public override void AddRecipes()
{

ModRecipe recipe = new ModRecipe(mod);

recipe.AddIngredient(ItemID.Wood, 10);

recipe.AddTile(TileID.WorkBenches);

recipe.SetResult(this);
recipe.AddRecipe();
}


public override void UpdateAccessory(Player player, bool hideVisual)
{

player.noFallDmg = true;
player.meleeDamage *= 2f;
player.thrownDamage *= 2f;
player.rangedDamage *= 2f;
player.magicDamage *= 2f;
player.minionDamage *= 2f;
player.manaCost -= 0.50f;
player.noFallDmg = true;
player.fireWalk = true;
player.lavaImmune = true;
player.noKnockback = true;

} }
}
Missing a using directive, here is a more cleaned up version of your code. Always make sure your code is readable. While I am at it, you can make a code block by wrapping your code with

Code:
[CODE]
[/ CODE]
Just remove the space in the second code with the backslash

Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MOD.Items
{
    [AutoloadEquip(EquipType.Shield)]
    public class holyshield : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("holyshield");
            Tooltip.SetDefault("This is a modded sword.");
        }

        public override void SetDefaults()
        {
            item.width = 28;
            item.height = 30;
            item.toolTip = "They will die";
            item.value = 10;
            item.rare = 3;
            item.accessory = true;
            item.lifeRegen = 35;
        }


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


        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.noFallDmg = true;
            player.meleeDamage *= 2f;
            player.thrownDamage *= 2f;
            player.rangedDamage *= 2f;
            player.magicDamage *= 2f;
            player.minionDamage *= 2f;
            player.manaCost -= 0.50f;
            player.noFallDmg = true;
            player.fireWalk = true;
            player.lavaImmune = true;
            player.noKnockback = true;
        }
    }
}
 

Renu

Terrarian
I'm having frame issues with the damage floaters beacuse I do so much DPS with the calamity mod, any way to remove them?
 
Um guys, several things:
1: how do i make npcs only spawn after a boss has been defeated?
2: how do i make a boss spawn after a different boss has been defeated?
3: can i make a biome spawn after a boss has been defeated?
4: what is the code for 0.10.0.1 armor and bosses?
5: my custom projectiles are invisible and dont do damage, how to fix?
[doublepost=1498558181,1498557762][/doublepost]Um guys, several things:
1: how do i make npcs only spawn after a boss has been defeated?
2: how do i make a boss spawn after a different boss has been defeated?
3: can i make a biome spawn after a boss has been defeated?
4: what is the code for 0.10.0.1 armor and bosses?
5: my custom projectiles are invisible and dont do damage, how to fix?
 
Terraria.NPC' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

'Terraria.NPC' does not contain a definition for 'displayName' and no extension method 'displayName' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)
 

Jofairden

Duke Fishron
tModLoader
Terraria.NPC' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

'Terraria.NPC' does not contain a definition for 'displayName' and no extension method 'displayName' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)
The names, tooltips and what not have changed recently. They no longer go in SetDefaults, but a new method: SetStaticDefaults. Here is an example for Party Zombie (in Example Mod)
Code:
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Zombie");
            Main.npcFrameCount[npc.type] = Main.npcFrameCount[NPCID.Zombie];
        }
Here is an example of ExampleBlock, which also has translations
Code:
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("This is a modded block.");
            ItemID.Sets.ExtractinatorMode[item.type] = item.type;

            // This is an example of how translations are coded into the game. Making your mod Open Source is a good way to enlist help with translations and make your mod more popular worldwide. Be sure to have "using Terraria.Localization".
            DisplayName.AddTranslation(GameCulture.German, "Beispielblock");
            Tooltip.AddTranslation(GameCulture.German, "Dies ist ein modded Block");
            DisplayName.AddTranslation(GameCulture.Italian, "Blocco di esempio");
            Tooltip.AddTranslation(GameCulture.Italian, "Questo è un blocco moddato");
            DisplayName.AddTranslation(GameCulture.French, "Bloc d'exemple");
            Tooltip.AddTranslation(GameCulture.French, "C'est un bloc modgé");
            DisplayName.AddTranslation(GameCulture.Spanish, "Bloque de ejemplo");
            Tooltip.AddTranslation(GameCulture.Spanish, "Este es un bloque modded");
            DisplayName.AddTranslation(GameCulture.Russian, "Блок примера");
            Tooltip.AddTranslation(GameCulture.Russian, "Это модифицированный блок");
            DisplayName.AddTranslation(GameCulture.Chinese, "例子块");
            Tooltip.AddTranslation(GameCulture.Chinese, "这是一个修改块");
            DisplayName.AddTranslation(GameCulture.Portuguese, "Bloco de exemplo");
            Tooltip.AddTranslation(GameCulture.Portuguese, "Este é um bloco modded");
            DisplayName.AddTranslation(GameCulture.Polish, "Przykładowy blok");
            Tooltip.AddTranslation(GameCulture.Polish, "Jest to modded blok");
        }
 
The names, tooltips and what not have changed recently. They no longer go in SetDefaults, but a new method: SetStaticDefaults. Here is an example for Party Zombie (in Example Mod)
Code:
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Zombie");
            Main.npcFrameCount[npc.type] = Main.npcFrameCount[NPCID.Zombie];
        }
Here is an example of ExampleBlock, which also has translations
Code:
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("This is a modded block.");
            ItemID.Sets.ExtractinatorMode[item.type] = item.type;

            // This is an example of how translations are coded into the game. Making your mod Open Source is a good way to enlist help with translations and make your mod more popular worldwide. Be sure to have "using Terraria.Localization".
            DisplayName.AddTranslation(GameCulture.German, "Beispielblock");
            Tooltip.AddTranslation(GameCulture.German, "Dies ist ein modded Block");
            DisplayName.AddTranslation(GameCulture.Italian, "Blocco di esempio");
            Tooltip.AddTranslation(GameCulture.Italian, "Questo è un blocco moddato");
            DisplayName.AddTranslation(GameCulture.French, "Bloc d'exemple");
            Tooltip.AddTranslation(GameCulture.French, "C'est un bloc modgé");
            DisplayName.AddTranslation(GameCulture.Spanish, "Bloque de ejemplo");
            Tooltip.AddTranslation(GameCulture.Spanish, "Este es un bloque modded");
            DisplayName.AddTranslation(GameCulture.Russian, "Блок примера");
            Tooltip.AddTranslation(GameCulture.Russian, "Это модифицированный блок");
            DisplayName.AddTranslation(GameCulture.Chinese, "例子块");
            Tooltip.AddTranslation(GameCulture.Chinese, "这是一个修改块");
            DisplayName.AddTranslation(GameCulture.Portuguese, "Bloco de exemplo");
            Tooltip.AddTranslation(GameCulture.Portuguese, "Este é um bloco modded");
            DisplayName.AddTranslation(GameCulture.Polish, "Przykładowy blok");
            Tooltip.AddTranslation(GameCulture.Polish, "Jest to modded blok");
        }
ty so much, dude, do you know any other changes?like in bosses there are errors always saying about auto load head, and i heard they chnged it too
[doublepost=1498592440,1498592356][/doublepost]
public override void SetStaticDefaults() { DisplayName.SetDefault("Zombie"); Main.npcFrameCount[npc.type] = Main.npcFrameCount[NPCID.Zombie]; }
also, where would this go?
and exactly what goes there? cuz my npcs work and all but they dissaper and reapear every sec0ond, and have they added how to make npcs spawn after boss killed?
 

EvelynSnowLeopard

Steampunker
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?
 
Top Bottom