tModLoader Official tModLoader Help Thread

You have try before say that?
player.setBonus = "50% chance to not consume thrown item";


If you never try, you cannot learn :p
 
Last edited:
For active medusa stone:
player.stoned = true;
Or:
player.headPosition = Vector2.Zero;
player.bodyPosition = Vector2.Zero;
player.legPosition = Vector2.Zero;
player.controlJump = false;
player.controlDown = false;
player.controlLeft = false;
player.controlRight = false;
player.controlUp = false;
player.controlUseItem = false;
player.controlUseTile = false;
player.controlThrow = false;
player.gravDir = 1f;
player.releaseMount = false;
if (player.mount.Active) player.mount.Dismount(player);

For stop all mouvement and mount. Then for texture, i have not found but if you install Visual studio or a IDE, you can found. Sorry<
 
Last edited:
Hmm, doesn't seem like this ore generation code in the NPCLoot() function worked:

Code:
public override void NPCLoot()
 {
 if (Main.expertMode)
 {
 npc.DropBossBags();
 }
 else
 {
 Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VirulentKatana"));
 Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Malevolence"));
 if (Main.rand.Next(2) == 0)
 {
 Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MepheticSprayer"));
 }
 if (Main.rand.Next(4) == 0)
 {
 Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PestilentDefiler"));
 }
 if (Main.rand.Next(6) == 0)
 {
 Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheHive"));
 }
 }
 if (CalamityWorld.uelibloomSpawns < 3)
 {
 Main.NewText("New pockets of ore have been energized in the underground jungle!", Color.Lime.R, Color.Lime.G, Color.Lime.B);
 CalamityWorld.uelibloomSpawns += 1;
 for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 11E-05); k++)
 {
 int x = Main.maxTilesX;
 int y = Main.maxTilesY;
 if (Main.tile[x, y].type == TileID.Mud)
 {
 int i2 = WorldGen.genRand.Next(0, x);
 int j2 = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .8f));
 WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(3, 4), WorldGen.genRand.Next(3, 8), (ushort)mod.TileType("UelibloomOre"));
 }
 }
 }
 }

Could anyone tell me what's wrong with this?
 
Roh, i cannot Dislike. (Because, in Bmod, you are the lead coder, so, if i help you, this is funny)

Else, so, no, i have not found error in your code. But, Modloader have not problem with Npcloot? You have try move the code in a GlobalNPC?
Code:
    public class NPCloot : GlobalNPC
    {

        public override void NPCLoot(NPC npc)
        {
if(npc.type == mod.type("boss"){}
}
}
Or use BossLoot for that (I prefer use that, me than Npcloot if this is a Boss, and use never npcloot method also, because problem with multi, i believe)
public override void BossLoot(ref string name, ref int potionType)


After, i have never touch ore generation, so, if my answer do not help you, i cannot help you after.
 
Roh, i cannot Dislike. (Because, in Bmod, you are the lead coder, so, if i help you, this is funny)

Else, so, no, i have not found error in your code. But, Modloader have not problem with Npcloot? You have try move the code in a GlobalNPC?
Code:
    public class NPCloot : GlobalNPC
    {

        public override void NPCLoot(NPC npc)
        {
if(npc.type == mod.type("boss"){}
}
}
Or use BossLoot for that (I prefer use that, me than Npcloot if this is a Boss, and use never npcloot method also, because problem with multi, i believe)
public override void BossLoot(ref string name, ref int potionType)


After, i have never touch ore generation, so, if my answer do not help you, i cannot help you after.

Thank you for your suggestion, but I've heard from @jopojelly that the NPCLoot() method has to be used for ore generation. All of my other bosses (Scourge, Slime God, Calamitas, and DoG) have the same thing with the exception that I'm trying to get the ore to spawn only in Mud blocks with this code.

All of my other boss ore generations work perfectly fine.
 
Well, i have found:
int x = Main.maxTilesX;
int y = Main.maxTilesY;
if (Main.tile[x, y].type == TileID.Mud)

You check always the same tile. No? Ok, Maybe , ok xD
 
Does anyone know what is going on? The texture and the .cs have the same name, they are both there and then I try to build the mod, then this happens
The process cannot access the file 'C:\Users\quint\Documents\My Games\Terraria\ModLoader\Mods\compile_temp\Terraria.Libraries.JSON.NET.Newtonsoft.Json.dll' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.Create(String path, Int32 bufferSize)
at Terraria.ModLoader.ModCompile.CompileMod(BuildingMod mod, List`1 refMods, Boolean forWindows, Byte[]& dll, Byte[]& pdb)
at Terraria.ModLoader.ModCompile.Build(BuildingMod mod, IBuildStatus status)
at Terraria.ModLoader.ModCompile.Build(String modFolder, IBuildStatus status)
at Terraria.ModLoader.ModLoader.<>c.<BuildMod>b__41_0(Object _)
I am running Windows 10 and am new to modding/coding so I don't know what I am doing wrong ;-;
 
Just close your file and rebuild ^^. (Also, when you save your file, he can take a time before 100% save, so, you cannot use this file, this is normal, you are more fast than the save!)
 
Just close your file and rebuild ^^.
I did, now this happens, the files are both there and have the same name, trust me
Missing mod: ExampleMod/Dusts/Bubble
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.AddDust(String name, ModDust dust, String texture)
at Terraria.ModLoader.Mod.AutoloadDust(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
 
Paste your begin code: For see.
namespace
{
public class
{



Missing mod, it do not found ExampleMod. You try in the ExampleMod?
 
namespace: ExampleMod.Dusts
public class:Bubble : ModDust
namespace ExampleMod.Dusts
{
public class Bubble : ModDust
{
public override bool Autoload(ref string name, ref string texture)
{
texture = "Bubble";
return base.Autoload(ref name, ref texture);
}
....
....
}
}

Try that, maybe, if he do not found texture.
 
Was the problem because: public override bool Update : (Dust dust)?
https://github.com/bluemagic123/tModLoader/wiki/ModDust
public virtual bool Update(Dust dust)
Allows you to customize how you want this type of dust to behave. Return true to allow for vanilla dust updating to also take place; will return true by default. Normally you will want this to return false.

I think need of other coder for your problem, sorry ^^'.
 
Sorry to bother everyone again, but how would I go about preventing a modded NPC from spawning while a certain amount of friendly town NPCs are present?
 
Sorry to bother everyone again, but how would I go about preventing a modded NPC from spawning while a certain amount of friendly town NPCs are present?

In the method CanSpawn, you call a bool who is created in a method who is not call each frame(better, i think) where you counts each townNPC. (You can count with if(npc.TownNPC), probably)

Or just use player.townNPCs who is probably number of townnpc of the player.


How can I make a projectile that acts like the Razor Blade Typhoon? The homing and bouncing.
Homing projectile, this is very easy, and i do not need say how because you can just search with the button search with write "homing"
For Bouncing,
edit: You put a AiType and a Aistyle of a bouncing projectile. (Boomerang, per example)
 
Last edited:
Back
Top Bottom