tModLoader Official tModLoader Help Thread

Hi!

My friend tried to install tModLoader on his mac, but whenever he opens Terraria it's just normal Terraria.
He says he did everything he was supposed to do, but it's just plain old Terraria.

Any help would be greatly appreciated!
 
How do I make my custom NPC spawn only on a grass block/dirt block.

Or how do I make my NPC spawn in the Forest biome, and ZonePurity isn't there.
 
Same Issue. The mod browser is not loading properly and it often ends up as offline, but at times it's random when the mod browser works. Help would be appreciated.
 
Ok, I need help with a few things...
  • Does anyone know how to make a town NPC be like the 'Cobbler' from Thorium, as in there is an option to give the player a buff?

  • How do I make my custom NPC spawn only on a grass block/dirt block.
    Or how do I make my NPC spawn in the Forest biome, and ZonePurity isn't there.

  • When I talk to my custom NPC, it mostly doesn't say anything, not even the text box comes up, here is the code, I think it has to do with the 'cases' https://hastebin.com/urovigutoy.cs
 
Ok, I need help with a few things...
  • Does anyone know how to make a town NPC be like the 'Cobbler' from Thorium, as in there is an option to give the player a buff?

  • How do I make my custom NPC spawn only on a grass block/dirt block.
    Or how do I make my NPC spawn in the Forest biome, and ZonePurity isn't there.

  • When I talk to my custom NPC, it mostly doesn't say anything, not even the text box comes up, here is the code, I think it has to do with the 'cases' https://hastebin.com/urovigutoy.cs
Look at ExampleMod.cs for some helper functions for NoZone you might like.

The Chat code looks fine to me, not sure.

For the buff thing, I don't know exactly what the Cobbler does, but you can do something like Main.LocalPlayer.AddBuff(BuffID.OnFire, 30) in ModNPC.OnChatButtonClicked
 
I cannot get my custom throwing weapon to work. I have the projectile in ModDictionary/Projectiles

Code:
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AncientSecrets.Items.Weapons
{
  public class BerserkerAxe : ModItem
  {
  public override void SetDefaults()
  {
  item.name = "Berserker's Throwing Axe";
  item.damage = 50;
  item.noMelee = true;
  item.width = 34;
  item.height = 30;
  //item.toolTip = "Attack speed increases as health decreases, up to a maximum of 200%";
  item.useTime = 48;
  item.useAnimation = 17;
  item.useStyle = 1;
  item.knockBack = 1;
  item.value = 25000;
  item.rare = 7;
  item.autoReuse = true;
  item.shoot = mod.ProjectileType("BerserkerAxeP");
  item.shootSpeed = 8f;
  item.useTurn = true;
  item.noUseGraphic = true;
  projOnSwing = true;
  }

  //public override bool UseItem(Player player)
  //{
  //  float hpPerc =((float)player.statLife / (float)player.statLifeMax2) * 100;

  //  item.useTime = 16 + ((int)(hpPerc * 32));

  //  return true;
  //}

  public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
  {
  // Fix the speedX and Y to point them horizontally.
  //speedX = new Vector2(speedX, speedY).Length() * (speedX > 0 ? 1 : -1);
  //speedY = 0;
  // Add random Rotation
  Vector2 speed = new Vector2(speedX, speedY);
  speed = speed.RotatedByRandom(MathHelper.ToRadians(30));
  return true;
  }
  }
}

Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AncientSecrets.Projectiles
{
   public class BerserkerAxeP : ModProjectile
   {
     public override void SetDefaults()
     {
       projectile.name = "Berserker Axe";
       projectile.width = 34;
  projectile.melee = true;
       projectile.height = 30;
       projectile.aiStyle = 2;
       projectile.friendly = true;
       projectile.penetrate = 0;
  projectile.tileCollide = true;
       projectile.timeLeft = 600;
       projectile.alpha = 255;
       projectile.extraUpdates = 1;
  aiType = ProjectileID.ThrowingKnife;
     }
  }
}

Also is it possible to dynamically change a items use speed when it's in the middle of use?
 
I cannot get my custom throwing weapon to work. I have the projectile in ModDictionary/Projectiles

Code:
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AncientSecrets.Items.Weapons
{
  public class BerserkerAxe : ModItem
  {
  public override void SetDefaults()
  {
  item.name = "Berserker's Throwing Axe";
  item.damage = 50;
  item.noMelee = true;
  item.width = 34;
  item.height = 30;
  //item.toolTip = "Attack speed increases as health decreases, up to a maximum of 200%";
  item.useTime = 48;
  item.useAnimation = 17;
  item.useStyle = 1;
  item.knockBack = 1;
  item.value = 25000;
  item.rare = 7;
  item.autoReuse = true;
  item.shoot = mod.ProjectileType("BerserkerAxeP");
  item.shootSpeed = 8f;
  item.useTurn = true;
  item.noUseGraphic = true;
  projOnSwing = true;
  }

  //public override bool UseItem(Player player)
  //{
  //  float hpPerc =((float)player.statLife / (float)player.statLifeMax2) * 100;

  //  item.useTime = 16 + ((int)(hpPerc * 32));

  //  return true;
  //}

  public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
  {
  // Fix the speedX and Y to point them horizontally.
  //speedX = new Vector2(speedX, speedY).Length() * (speedX > 0 ? 1 : -1);
  //speedY = 0;
  // Add random Rotation
  Vector2 speed = new Vector2(speedX, speedY);
  speed = speed.RotatedByRandom(MathHelper.ToRadians(30));
  return true;
  }
  }
}

Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AncientSecrets.Projectiles
{
   public class BerserkerAxeP : ModProjectile
   {
     public override void SetDefaults()
     {
       projectile.name = "Berserker Axe";
       projectile.width = 34;
  projectile.melee = true;
       projectile.height = 30;
       projectile.aiStyle = 2;
       projectile.friendly = true;
       projectile.penetrate = 0;
  projectile.tileCollide = true;
       projectile.timeLeft = 600;
       projectile.alpha = 255;
       projectile.extraUpdates = 1;
  aiType = ProjectileID.ThrowingKnife;
     }
  }
}

Also is it possible to dynamically change a items use speed when it's in the middle of use?
I know it's possible to change an item's reuse delay dynamically, so changing the shoot speed should also work. It's just a matter of where you change the shoot speed. I'd suggest you try the HoldItem hook, which is called each frame while being held. I'd expect that the following should work and let you see what's going on, though I havn't tested it.
Code:
public override void HoldItem(Player player)
{
    float hpPerc =((float)player.statLife / (float)player.statLifeMax2);
        item.useTime = 16 + ((int)(hpPerc * 3200));

    Main.NewText("useTime: " + item.useTime); //outputs the useTime to chat
}
 
How do I make a shield that gives you +2 defence if the players health is a quarter of its full health? I've already done the shield part, I just need the 'if (player.MaxLife something)'
 
I know it's possible to change an item's reuse delay dynamically, so changing the shoot speed should also work. It's just a matter of where you change the shoot speed. I'd suggest you try the HoldItem hook, which is called each frame while being held. I'd expect that the following should work and let you see what's going on, though I havn't tested it.
Code:
public override void HoldItem(Player player)
{
    float hpPerc =((float)player.statLife / (float)player.statLifeMax2);
        item.useTime = 16 + ((int)(hpPerc * 3200));

    Main.NewText("useTime: " + item.useTime); //outputs the useTime to chat
}
This functionally works fine, however the players arm doesn't change speed, so the projectile is being created out of sync with the player's arm movements
 
I have a problem setting up my server. My worlds folder is C:\Users\windows7\Documents\My Games\Terraria\ModLoader\Worlds. but the server console serches the worlds in the C:\Users\windows7\Documents\My Games\Terraria\Worlds. How do I change the pathway that the connsole is looking for, because I don't want to copy the world file to the normal folder because than, terraria will look for the worlds still, in C:\Users\windows7\Documents\My Games\Terraria\Worlds and the updated world wont be there. :/
pls help ;-;
 
I have a problem setting up my server. My worlds folder is C:\Users\windows7\Documents\My Games\Terraria\ModLoader\Worlds. but the server console serches the worlds in the C:\Users\windows7\Documents\My Games\Terraria\Worlds. How do I change the pathway that the connsole is looking for, because I don't want to copy the world file to the normal folder because than, terraria will look for the worlds still, in C:\Users\windows7\Documents\My Games\Terraria\Worlds and the updated world wont be there. :/
pls help ;-;
are you sure you are launching tmodloaderserver.exe?
 
A tutorial on youtube told me to use start-tModLoaderServer :/
[doublepost=1489349347,1489349163][/doublepost]Its still doesn't show up. I tried cpying all the tmodloader files to another seporate folder (not the terraria folder) as the tutorial told me, and I tried opening both of the sever files, and i also tried to open thees files in my terraria folder. the world never showed up.
 
Oh, Thank you!
[doublepost=1489350270,1489350208][/doublepost]wait, should I open the bat file in the terraria folder, or in another folder?
 
Im sorry, I don't understand. I have 3 folders. I have My main terraria folder, in - D:\SteamLibrary\steamapps\common\Terraria, I have my other terraria folder - C:\Users\windows7\Documents\My Games\Terraria, and I have a folder on my desktop that has tmodloader in it. (I also Copied thees tmodloader files into my main terraria folder). so, my modded world, is in - C:\Users\windows7\Documents\My Games\Terraria\ModLoader\Worlds, but the console looks for the worlds somwhere, but there are no worlds showing up. basicly I want it to look for my folders in - C:\Users\windows7\Documents\My Games\Terraria\ModLoader\Worlds.
What file should I open to run the server?
Where is the Serverconfig file?
can I please get some more spesific instructions?
sorry for wasting your time, I just really need to get this to work :/
 
Back
Top Bottom