• 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.

Standalone [1.3] tModLoader - A Modding API

Flandre_Scarlet

Skeletron Prime
The world I want to use on vanilla Terraria only has 3 files for some reason (.twld, .twld.bak, and wld.bak). The .wld file is missing. All my other worlds made in TModLoader have .wld files.
Just use tEdit, edit the modded world and save it in your normal worlds folder. This way the map reverts back to vanilla.
 

Duck27TEC

Terrarian
I have a problem with my Tmod loader, it works as if it was a compleatly separate Terraria and when i installed the latest version, it compleatly bugged out with a error code over, and over, and over, again, dose anyone know how to help???
 

IDFC

Skeletron Prime
I'm having a problem where sometimes not all the mods I have are showing on my mods list. I need to refresh it and that occasionally makes my game say:
"Terraria is not responding"
 

Lolkat

Skeletron Prime
When I compile I get the error "error CS0117: 'Terraria.ModLoader.ModNPC' does not contain a definition for 'Center'"
 
So, bit of weirdness. Recently updated a few mods on the Mod Browser, and now when I reloaded the mod list, I now have a crash when it reaches the end of the Loading state... Anyone else suffering that error?
 

Fury

Lunatic Cultist
So, bit of weirdness. Recently updated a few mods on the Mod Browser, and now when I reloaded the mod list, I now have a crash when it reaches the end of the Loading state... Anyone else suffering that error?
Yeah, it seems a lot of people are. The problem (for me) came from Nightmares Unleashed. I moved that mod out of my folder and, sure enough, everything works fine now. I'm sure Psychotic will find a solution soon.
If that isn't what is causing it for you, then I don't know...
 
Yeah, it seems a lot of people are. The problem (for me) came from Nightmares Unleashed. I moved that mod out of my folder and, sure enough, everything works fine now. I'm sure Psychotic will find a solution soon.
If that isn't what is causing it for you, then I don't know...
Ah, got that in my folder, so that's probably the reason!

Relatedly, anyone know of a mod that tries to stuff everything into the ammo slot first, even when there's stacks in the inventory already? Because if so, that's annoying as all hell and I want to figure out the pros and cons of removing that one too >_>
 

Dragonpriest4

Skeletron Prime
When I consume the item you're supposed to get an item all of the time. But for somereason when I open up the item I get nothing.
this is the items code:
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Items
{
    public class SuperMagicalChest : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Super Magical Chest";
            item.maxStack = 1;
            item.consumable = true;
            item.width = 24;
            item.height = 24;
            item.useTime = 10;
            item.useAnimation = 10;
            item.useStyle = 4;
            item.toolTip = "Left click to open";
            item.rare = 10;
            item.useSound = mod.GetSoundSlot(SoundType.Item, "Sounds/Item/Legendaryget");
        }
        public override bool UseItem(Player player)
        {
            if (Main.rand.Next(2) == 0)
            {
            player.QuickSpawnItem(mod.ItemType("SparkyCard"));
            }
            else if (Main.rand.Next(2) == 1)
            {
            player.QuickSpawnItem(mod.ItemType("LumberJacksAxe"));
            }
            else if (Main.rand.Next(2) == 2)
            {
            player.QuickSpawnItem(mod.ItemType("PrincessesBow"));
            }
            return true;
           
        }
    }
}
 

Jeckel

Terrarian
public override bool UseItem(Player player)
{
if (Main.rand.Next(2) == 0)
{
player.QuickSpawnItem(mod.ItemType("SparkyCard"));
}
else if (Main.rand.Next(2) == 1)
{
player.QuickSpawnItem(mod.ItemType("LumberJacksAxe"));
}
else if (Main.rand.Next(2) == 2)
{
player.QuickSpawnItem(mod.ItemType("PrincessesBow"));
}
return true;

}
[/CODE]
It is because you are rolling the dice each time you are checking it. The first time will not always be 0, so no SparkyCard, the second time will not always return 1, so no LumberJacksAxe, and the third time will NEVER be 2, because Next() returns 0 to n - 1, ie Next(2) will return 0 or 1.

Call Next(3) once and store it in a variable, ie int result = Main.rand.Next(3);, and then check that variable in your if statements.
 

Dragonpriest4

Skeletron Prime
It is because you are rolling the dice each time you are checking it. The first time will not always be 0, so no SparkyCard, the second time will not always return 1, so no LumberJacksAxe, and the third time will NEVER be 2, because Next() returns 0 to n - 1, ie Next(2) will return 0 or 1.

Call Next(3) once and store it in a variable, ie int result = Main.rand.Next(3);, and then check that variable in your if statements.
I'm sorry for asking this but how do I set that up?
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Items
{
    public class SuperMagicalChest : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Super Magical Chest";
            item.maxStack = 1;
            item.consumable = true;
            item.width = 24;
            item.height = 24;
            item.useTime = 10;
            item.useAnimation = 10;
            item.useStyle = 4;
            item.toolTip = "Left click to open";
            item.rare = 10;
            item.useSound = mod.GetSoundSlot(SoundType.Item, "Sounds/Item/Legendaryget");
        }
        public override bool UseItem(Player player)
        {
            (Main.rand.Next(3) == int result Main.rand.Next(3));,
            if (int result Main.rand.Next(3); == 0)
            {
            player.QuickSpawnItem(mod.ItemType("SparkyCard"));
            }
            else if (int result Main.rand.Next(3); == 1)
            {
            player.QuickSpawnItem(mod.ItemType("LumberJacksAxe"));
            }
            else if (int result Main.rand.Next(3); == 2)
            {
            player.QuickSpawnItem(mod.ItemType("PrincessesBow"));
            }
            return true;
           
        }
    }
}
 

dinidini4000

Skeletron Prime
I'm sorry for asking this but how do I set that up?
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Items
{
    public class SuperMagicalChest : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Super Magical Chest";
            item.maxStack = 1;
            item.consumable = true;
            item.width = 24;
            item.height = 24;
            item.useTime = 10;
            item.useAnimation = 10;
            item.useStyle = 4;
            item.toolTip = "Left click to open";
            item.rare = 10;
            item.useSound = mod.GetSoundSlot(SoundType.Item, "Sounds/Item/Legendaryget");
        }
        public override bool UseItem(Player player)
        {
            (Main.rand.Next(3) == int result Main.rand.Next(3));,
            if (int result Main.rand.Next(3); == 0)
            {
            player.QuickSpawnItem(mod.ItemType("SparkyCard"));
            }
            else if (int result Main.rand.Next(3); == 1)
            {
            player.QuickSpawnItem(mod.ItemType("LumberJacksAxe"));
            }
            else if (int result Main.rand.Next(3); == 2)
            {
            player.QuickSpawnItem(mod.ItemType("PrincessesBow"));
            }
            return true;
          
        }
    }
}
i normally use right click but thats just me
he means something like this

------------------------------------------------------------ this is the right click function
public override bool CanRightClick()
{
return true;
}

public override void RightClick(Player player)
------------------------------------------------------------
{
int f = Main.rand.Next(0, 5);
if(f >= 0 && f <= 0)
{
player.QuickSpawnItem(mod.ItemType("item1"));
}
else if(f >= 1 && f <= 1)
{
player.QuickSpawnItem(mod.ItemType("item2"));
}
else if(f >= 2 && f <= 2)
{
player.QuickSpawnItem(mod.ItemType("item3"));
}
else if(f >= 3 && f <= 3)
{
player.QuickSpawnItem(mod.ItemType("item4"));
}
else if(f >= 4 && f <= 4)
{
player.QuickSpawnItem(mod.ItemType("item5"));
}
}
 

Kazzymodus

Moderator
Staff member
Moderator
i normally use right click but thats just me
he means something like this

------------------------------------------------------------ this is the right click function
public override bool CanRightClick()
{
return true;
}

public override void RightClick(Player player)
------------------------------------------------------------
{
int f = Main.rand.Next(0, 5);
if(f >= 0 && f <= 0)
{
player.QuickSpawnItem(mod.ItemType("item1"));
}
else if(f >= 1 && f <= 1)
{
player.QuickSpawnItem(mod.ItemType("item2"));
}
else if(f >= 2 && f <= 2)
{
player.QuickSpawnItem(mod.ItemType("item3"));
}
else if(f >= 3 && f <= 3)
{
player.QuickSpawnItem(mod.ItemType("item4"));
}
else if(f >= 4 && f <= 4)
{
player.QuickSpawnItem(mod.ItemType("item5"));
}
}
Why are you not just checking f for equality (f == 0)? Isn't that a lot easier?
I'm sorry for asking this but how do I set that up?
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace EpicnessModRemastered.Items
{
    public class SuperMagicalChest : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Super Magical Chest";
            item.maxStack = 1;
            item.consumable = true;
            item.width = 24;
            item.height = 24;
            item.useTime = 10;
            item.useAnimation = 10;
            item.useStyle = 4;
            item.toolTip = "Left click to open";
            item.rare = 10;
            item.useSound = mod.GetSoundSlot(SoundType.Item, "Sounds/Item/Legendaryget");
        }
        public override bool UseItem(Player player)
        {
            (Main.rand.Next(3) == int result Main.rand.Next(3));,
            if (int result Main.rand.Next(3); == 0)
            {
            player.QuickSpawnItem(mod.ItemType("SparkyCard"));
            }
            else if (int result Main.rand.Next(3); == 1)
            {
            player.QuickSpawnItem(mod.ItemType("LumberJacksAxe"));
            }
            else if (int result Main.rand.Next(3); == 2)
            {
            player.QuickSpawnItem(mod.ItemType("PrincessesBow"));
            }
            return true;
       
        }
    }
}
Good start, but I'll explain where and why you went wrong.

What you need to do is to create a variable at the start of UseItem, and then you can do whatever you want with that variable until UseItem is finished (then it's discarded). So first, to declare a variable, you need to use the format <type - identifier - assignment (optional)>. This means, from left to right, what kind of variable you want, what it's called, and what value you want it to start it with respectively.

Because you want an integer (whole number) called result, you should type int result;. But because you want to put a random number in it, you have to assign (=) the result of the game's random number generator (Main.rand.Next(5), which means you are generating one of five different numbers (0, 1, 2, 3 and 4)). So that becomes:
Code:
int result = Main.rand.Next(5);
Now you have that value, you can check your if-statements against it, like so:
Code:
if (result == 0)
{
  // Stuff.
}
else if (result == 1)
{
  // Stuff.
}
// And so on.
You don't have to use int anymore, because the script remembers that result is an integer; if you use int again, the code thinks you're trying to make a new variable with the same name, which isn't allowed. You also don't have to use Main.rand.Next() anymore, because you only need to assign that random value once.

Hope that clears things up for you. :)
 

Solo-Ion

Dungeon Spirit
The world I want to use on vanilla Terraria only has 3 files for some reason (.twld, .twld.bak, and wld.bak). The .wld file is missing. All my other worlds made in TModLoader have .wld files.
Something must have happened to the *.wld file, but thankfully you have a backup. Copy the *.wld.bak file to the vanilla worlds folder and remove .bak from the filename. Hopefully that will work.

When I compile I get the error "error CS0117: 'Terraria.ModLoader.ModNPC' does not contain a definition for 'Center'"
I'm guessing a bit here because I can't see the context, but I think you need 'ModNPC.npc.Center' not 'ModNPC.Center'. The ModNPC is kind of a parent class to the npc, so you need to refer to the child npc class.
 

petizero

Terrarian
An unexpected error has occurred.
here: Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
here: Terraria.ModLoader.Mod.Autoload()
here: Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
Fix????
 

Nimta

Duke Fishron
I think I'm doing everything right...

"A problem was encountered while installing!
java.nio.file.AccessDeniedException: C:\Program Files\Steam\steamapps\common\Terraria\Terraria.exe"

Help?
 

Lolkat

Skeletron Prime
Something must have happened to the *.wld file, but thankfully you have a backup. Copy the *.wld.bak file to the vanilla worlds folder and remove .bak from the filename. Hopefully that will work.


I'm guessing a bit here because I can't see the context, but I think you need 'ModNPC.npc.Center' not 'ModNPC.Center'. The ModNPC is kind of a parent class to the npc, so you need to refer to the child npc class.
I'm doing a spin-off EOC boss, just playing around with vanilla AIs to get more comfortable with AI stuff.
Notably these lines:
if (base.Center.X > Main.player[npc.target].Center.X)
{
num277 *= -1f;
}
if (base.Center.Y > Main.player[npc.target].Center.Y)
{
num276 *= -1f;
}
 

Radenium

Spazmatism
They just pushed the smallest little do-nothing update they ever have. TmodLoader breaks again.... >:|

edit: On the other hand, ticking to the new version should be super easy.
 

powpowitsme

Steampunker
They just pushed the smallest little do-nothing update they ever have. TmodLoader breaks again.... >:|

edit: On the other hand, ticking to the new version should be super easy.
It seems to work fine for me with the new update. I updated, installed gamelauncher and tmodloader and it was fine.
 
Top Bottom