• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • 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.
  • Begin your search for Journey's End information here and here. Please report bugs and issues for Journey's End here.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

Standalone [1.3] tModLoader - A Modding API

KADEMILLIRONS

Terrarian
Ok so, me and my friend have been playing multiplayer a while together but recently whenever I send him a invite and he tries to join, his game freezes when saying "Syncing Mods"
 
Last edited:

Arct1cMelon

Terrarian
Can somebody please fix my mod, i keep getting namespace errors and it's annoying.

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

namespace Melonsmod.NPCS.Sportsman //We need this to basically indicate the folder where it is to be read from, so you the texture will load correctly
{
public class CustomTownNPC : ModNPC
{
public override bool Autoload(CustomTownNPC, Sportsman.png, ref string[] altTextures)
{
name = "Sportsman";
return mod.Properties.Autoload;
}
public override void SetDefaults()
{
npc.name = "Sportsman"; //the name displayed when hovering over the npc ingame.
npc.townNPC = true; //This defines if the npc is a town Npc or not
npc.friendly = true; //this defines if the npc can hur you or not()
npc.width = 18; //the npc sprite width
npc.height = 46; //the npc sprite height
npc.aiStyle = 7; //this is the npc ai style, 7 is Pasive Ai
npc.defense = 25; //the npc defense
npc.lifeMax = 250;// the npc life
npc.HitSound = SoundID.NPCHit1; //the npc sound when is hit
npc.DeathSound = SoundID.NPCDeath1; //the npc sound when he dies
npc.knockBackResist = 0.5f; //the npc knockback resistance
Main.npcFrameCount[npc.type] = 25; //this defines how many frames the npc sprite sheet has
NPCID.Sets.ExtraFramesCount[npc.type] = 9;
NPCID.Sets.AttackFrameCount[npc.type] = 4;
NPCID.Sets.DangerDetectRange[npc.type] = 150; //this defines the npc danger detect range
NPCID.Sets.AttackType[npc.type] = 3; //this is the attack type, 0 (throwing), 1 (shooting), or 2 (magic). 3 (melee)
NPCID.Sets.AttackTime[npc.type] = 30; //this defines the npc attack speed
NPCID.Sets.AttackAverageChance[npc.type] = 10;//this defines the npc atack chance
NPCID.Sets.HatOffsetY[npc.type] = 4; //this defines the party hat position
animationType = NPCID.Guide; //this copy the guide animation
}
public override bool CanTownNPCSpawn(int numTownNPCs, int money) //Whether or not the conditions have been met for this town NPC to be able to move into town.
{
if (NPC.downedBoss1) //so after the EoC is killed
{
return true;
}
return false;
}
public override bool CheckConditions(int left, int right, int top, int bottom) //Allows you to define special conditions required for this town NPC's house
{
return true; //so when a house is available the npc will spawn
}
public override string TownNPCName() //Allows you to give this town NPC any name when it spawns
{
switch (WorldGen.genRand.Next(6))
{
case 0:
return "Rick";
case 1:
return "Denis";
case 2:
return "Heisenberg";
case 3:
return "Jack";
case 4:
return "Blue Magic";
case 5:
return "Blue";
default:
return "Walter";
}
}

public override void SetChatButtons(ref string button, ref string button2) //Allows you to set the text for the buttons that appear on this town NPC's chat window.
{
button = "Buy Potions"; //this defines the buy button name
}
public override void OnChatButtonClicked(bool firstButton, ref bool openShop) //Allows you to make something happen whenever a button is clicked on this town NPC's chat window. The firstButton parameter tells whether the first button or second button (button and button2 from SetChatButtons) was clicked. Set the shop parameter to true to open this NPC's shop.
{

if (firstButton)
{
openShop = true; //so when you click on buy button opens the shop
}
}

public override void SetupShop(Chest shop, ref int nextSlot) //Allows you to add items to this town NPC's shop. Add an item by setting the defaults of shop.item[nextSlot] then incrementing nextSlot.
{
if (NPC.downedSlimeKing) //this make so when the king slime is killed the town npc will sell this
{
shop.item[nextSlot].SetDefaults(ItemID.RecallPotion); //an example of how to add a vanilla terraria item
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.WormholePotion);
nextSlot++;
}
if (NPC.downedBoss3) //this make so when Skeletron is killed the town npc will sell this
{
shop.item[nextSlot].SetDefaults(ItemID.BookofSkulls);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ClothierVoodooDoll);
nextSlot++;
}
shop.item[nextSlot].SetDefaults(ItemID.IronskinPotion);
nextSlot++;
shop.item[nextSlot].SetDefaults(mod.ItemType("CustomSword")); //this is an example of how to add a modded item
nextSlot++;

}

public override string GetChat() //Allows you to give this town NPC a chat message when a player talks to it.
{
int wizardNPC = NPC.FindFirstNPC(NPCID.Wizard); //this make so when this npc is close to Wizard
if (wizardNPC >= 0 && Main.rand.Next(4) == 0) //has 1 in 3 chance to show this message
{
return "Yes " + Main.npc[wizardNPC].displayName + " is a wizard.";
}
int guideNPC = NPC.FindFirstNPC(NPCID.Guide); //this make so when this npc is close to the Guide
if (guideNPC >= 0 && Main.rand.Next(4) == 0) //has 1 in 3 chance to show this message
{
return "Sure you can ask " + Main.npc[guideNPC].displayName + " how to make Ironskin potion or you can buy it from me..hehehe.";
}
switch (Main.rand.Next(4)) //this are the messages when you talk to the npc
{
case 0:
return "You wanna buy something?";
case 1:
return "What you want?";
case 2:
return "I like this house.";
case 3:
return "<I'm blue dabu di dabu dai>....OH HELLO THERE..";
default:
return "Go kill Skeletron.";

}
}
public override void TownNPCAttackStrength(ref int damage, ref float knockback)// Allows you to determine the damage and knockback of this town NPC attack
{
damage = 40; //npc damage
knockback = 2f; //npc knockback
}

public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) //Allows you to determine the cooldown between each of this town NPC's attack. The cooldown will be a number greater than or equal to the first parameter, and less then the sum of the two parameters.
{
cooldown = 5;
randExtraCooldown = 10;
}
//------------------------------------This is an example of how to make the npc use a sward attack-------------------------------
public override void DrawTownAttackSwing(ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset)//Allows you to customize how this town NPC's weapon is drawn when this NPC is swinging it (this NPC must have an attack type of 3). Item is the Texture2D instance of the item to be drawn (use Main.itemTexture[id of item]), itemSize is the width and height of the item's hitbox
{
scale = 1f;
item = Main.itemTexture[mod.ItemType("CustomSword")]; //this defines the item that this npc will use
itemSize = 56;
}

public override void TownNPCAttackSwing(ref int itemWidth, ref int itemHeight) // Allows you to determine the width and height of the item this town NPC swings when it attacks, which controls the range of this NPC's swung weapon.
{
itemWidth = 56;
itemHeight = 56;
}

//----------------------------------This is an example of how to make the npc use a gun and a projectile ----------------------------------
/*public override void DrawTownAttackGun(ref float scale, ref int item, ref int closeness) //Allows you to customize how this town NPC's weapon is drawn when this NPC is shooting (this NPC must have an attack type of 1). Scale is a multiplier for the item's drawing size, item is the ID of the item to be drawn, and closeness is how close the item should be drawn to the NPC.
{
scale = 1f;
item = mod.ItemType("GunName");
closeness = 20;
}
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)//Allows you to determine the projectile type of this town NPC's attack, and how long it takes for the projectile to actually appear
{
projType = ProjectileID.CrystalBullet;
attackDelay = 1;
}

public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)//Allows you to determine the speed at which this town NPC throws a projectile when it attacks. Multiplier is the speed of the projectile, gravityCorrection is how much extra the projectile gets thrown upwards, and randomOffset allows you to randomize the projectile's velocity in a square centered around the original velocity
{
multiplier = 7f;
// randomOffset = 4f;

} */

}
}
 

Code Talker

Terrarian
I think part of my problem is that I don't have Java 8 or higher (I'm not even sure what Java is). Didn't it say you required "Java 8 or higher"?
 

ProjectET

Spazmatism
Can somebody please fix my mod, i keep getting namespace errors and it's annoying.

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

namespace Melonsmod.NPCS.Sportsman //We need this to basically indicate the folder where it is to be read from, so you the texture will load correctly
{
public class CustomTownNPC : ModNPC
{
public override bool Autoload(CustomTownNPC, Sportsman.png, ref string[] altTextures)
{
name = "Sportsman";
return mod.Properties.Autoload;
}
public override void SetDefaults()
{
npc.name = "Sportsman"; //the name displayed when hovering over the npc ingame.
npc.townNPC = true; //This defines if the npc is a town Npc or not
npc.friendly = true; //this defines if the npc can hur you or not()
npc.width = 18; //the npc sprite width
npc.height = 46; //the npc sprite height
npc.aiStyle = 7; //this is the npc ai style, 7 is Pasive Ai
npc.defense = 25; //the npc defense
npc.lifeMax = 250;// the npc life
npc.HitSound = SoundID.NPCHit1; //the npc sound when is hit
npc.DeathSound = SoundID.NPCDeath1; //the npc sound when he dies
npc.knockBackResist = 0.5f; //the npc knockback resistance
Main.npcFrameCount[npc.type] = 25; //this defines how many frames the npc sprite sheet has
NPCID.Sets.ExtraFramesCount[npc.type] = 9;
NPCID.Sets.AttackFrameCount[npc.type] = 4;
NPCID.Sets.DangerDetectRange[npc.type] = 150; //this defines the npc danger detect range
NPCID.Sets.AttackType[npc.type] = 3; //this is the attack type, 0 (throwing), 1 (shooting), or 2 (magic). 3 (melee)
NPCID.Sets.AttackTime[npc.type] = 30; //this defines the npc attack speed
NPCID.Sets.AttackAverageChance[npc.type] = 10;//this defines the npc atack chance
NPCID.Sets.HatOffsetY[npc.type] = 4; //this defines the party hat position
animationType = NPCID.Guide; //this copy the guide animation
}
public override bool CanTownNPCSpawn(int numTownNPCs, int money) //Whether or not the conditions have been met for this town NPC to be able to move into town.
{
if (NPC.downedBoss1) //so after the EoC is killed
{
return true;
}
return false;
}
public override bool CheckConditions(int left, int right, int top, int bottom) //Allows you to define special conditions required for this town NPC's house
{
return true; //so when a house is available the npc will spawn
}
public override string TownNPCName() //Allows you to give this town NPC any name when it spawns
{
switch (WorldGen.genRand.Next(6))
{
case 0:
return "Rick";
case 1:
return "Denis";
case 2:
return "Heisenberg";
case 3:
return "Jack";
case 4:
return "Blue Magic";
case 5:
return "Blue";
default:
return "Walter";
}
}

public override void SetChatButtons(ref string button, ref string button2) //Allows you to set the text for the buttons that appear on this town NPC's chat window.
{
button = "Buy Potions"; //this defines the buy button name
}
public override void OnChatButtonClicked(bool firstButton, ref bool openShop) //Allows you to make something happen whenever a button is clicked on this town NPC's chat window. The firstButton parameter tells whether the first button or second button (button and button2 from SetChatButtons) was clicked. Set the shop parameter to true to open this NPC's shop.
{

if (firstButton)
{
openShop = true; //so when you click on buy button opens the shop
}
}

public override void SetupShop(Chest shop, ref int nextSlot) //Allows you to add items to this town NPC's shop. Add an item by setting the defaults of shop.item[nextSlot] then incrementing nextSlot.
{
if (NPC.downedSlimeKing) //this make so when the king slime is killed the town npc will sell this
{
shop.item[nextSlot].SetDefaults(ItemID.RecallPotion); //an example of how to add a vanilla terraria item
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.WormholePotion);
nextSlot++;
}
if (NPC.downedBoss3) //this make so when Skeletron is killed the town npc will sell this
{
shop.item[nextSlot].SetDefaults(ItemID.BookofSkulls);
nextSlot++;
shop.item[nextSlot].SetDefaults(ItemID.ClothierVoodooDoll);
nextSlot++;
}
shop.item[nextSlot].SetDefaults(ItemID.IronskinPotion);
nextSlot++;
shop.item[nextSlot].SetDefaults(mod.ItemType("CustomSword")); //this is an example of how to add a modded item
nextSlot++;

}

public override string GetChat() //Allows you to give this town NPC a chat message when a player talks to it.
{
int wizardNPC = NPC.FindFirstNPC(NPCID.Wizard); //this make so when this npc is close to Wizard
if (wizardNPC >= 0 && Main.rand.Next(4) == 0) //has 1 in 3 chance to show this message
{
return "Yes " + Main.npc[wizardNPC].displayName + " is a wizard.";
}
int guideNPC = NPC.FindFirstNPC(NPCID.Guide); //this make so when this npc is close to the Guide
if (guideNPC >= 0 && Main.rand.Next(4) == 0) //has 1 in 3 chance to show this message
{
return "Sure you can ask " + Main.npc[guideNPC].displayName + " how to make Ironskin potion or you can buy it from me..hehehe.";
}
switch (Main.rand.Next(4)) //this are the messages when you talk to the npc
{
case 0:
return "You wanna buy something?";
case 1:
return "What you want?";
case 2:
return "I like this house.";
case 3:
return "<I'm blue dabu di dabu dai>....OH HELLO THERE..";
default:
return "Go kill Skeletron.";

}
}
public override void TownNPCAttackStrength(ref int damage, ref float knockback)// Allows you to determine the damage and knockback of this town NPC attack
{
damage = 40; //npc damage
knockback = 2f; //npc knockback
}

public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) //Allows you to determine the cooldown between each of this town NPC's attack. The cooldown will be a number greater than or equal to the first parameter, and less then the sum of the two parameters.
{
cooldown = 5;
randExtraCooldown = 10;
}
//------------------------------------This is an example of how to make the npc use a sward attack-------------------------------
public override void DrawTownAttackSwing(ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset)//Allows you to customize how this town NPC's weapon is drawn when this NPC is swinging it (this NPC must have an attack type of 3). Item is the Texture2D instance of the item to be drawn (use Main.itemTexture[id of item]), itemSize is the width and height of the item's hitbox
{
scale = 1f;
item = Main.itemTexture[mod.ItemType("CustomSword")]; //this defines the item that this npc will use
itemSize = 56;
}

public override void TownNPCAttackSwing(ref int itemWidth, ref int itemHeight) // Allows you to determine the width and height of the item this town NPC swings when it attacks, which controls the range of this NPC's swung weapon.
{
itemWidth = 56;
itemHeight = 56;
}

//----------------------------------This is an example of how to make the npc use a gun and a projectile ----------------------------------
/*public override void DrawTownAttackGun(ref float scale, ref int item, ref int closeness) //Allows you to customize how this town NPC's weapon is drawn when this NPC is shooting (this NPC must have an attack type of 1). Scale is a multiplier for the item's drawing size, item is the ID of the item to be drawn, and closeness is how close the item should be drawn to the NPC.
{
scale = 1f;
item = mod.ItemType("GunName");
closeness = 20;
}
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)//Allows you to determine the projectile type of this town NPC's attack, and how long it takes for the projectile to actually appear
{
projType = ProjectileID.CrystalBullet;
attackDelay = 1;
}

public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)//Allows you to determine the speed at which this town NPC throws a projectile when it attacks. Multiplier is the speed of the projectile, gravityCorrection is how much extra the projectile gets thrown upwards, and randomOffset allows you to randomize the projectile's velocity in a square centered around the original velocity
{
multiplier = 7f;
// randomOffset = 4f;

} */

}
}
can you show the folder where the class is located? A namespace error is typically when the directory cannot be located. Also when pasting code use the code block by using [-CODE][-/CODE] (without the dashes) as reading it without whitespace formatting makes it difficult.
 

Esnardo

Terrarian
Ok so, me and my friend have been playing multiplayer a while together but recently whenever I send him a invite and he tries to join, his game freezes when saying "Syncing Mods"
make sure you both have the same mods, and the latest versions of mods, and the latest version of tmodloader. if that doesn't work, try joining eachother with no mods enabled. if that works, it's one of the mods causing the issue, enable them one by one to figure out which one it is. if it doesn't, try vanilla terraria. if vanilla works, gather all the files you think will help and submit a bug report. if vanilla fails, it's a problem with your internet, or your computer, or something else outside the developer's control
 

wappow

Terrarian
Is there any way I can add my own ammo ID, instead of using the item type? Like if i wanted a weapon to use bullets I would use item.useAmmo = AmmoID.Bullet, then the weapon would be able to use all bullets as ammo. At the moment I can only get my weapon to shoot one type of modded ammo at a time, as I am using item.useAmmo = mod.ItemType("ammo name"). Can I make an "ammo group" similar to the way I can make a recipe group, or is there some other way of doing this? Thanks! :)
 

Jofairden

Duke Fishron
tModLoader
Is there any way I can add my own ammo ID, instead of using the item type? Like if i wanted a weapon to use bullets I would use item.useAmmo = AmmoID.Bullet, then the weapon would be able to use all bullets as ammo. At the moment I can only get my weapon to shoot one type of modded ammo at a time, as I am using item.useAmmo = mod.ItemType("ammo name"). Can I make an "ammo group" similar to the way I can make a recipe group, or is there some other way of doing this? Thanks! :)
Yes, simply have all of the ammos use the same ID for the ammo field, then have the item's useAmmo field use that same ID.
 

RIsland

Terrarian
hola, no puedo jugar el mod, la versión en el mod es 1.3.5.2, pero en mi pc es 1.3.5.3, no puedo generar un mundo nuevo
 

Jofairden

Duke Fishron
tModLoader
hola, no puedo jugar el mod, la versión en el mod es 1.3.5.2, pero en mi pc es 1.3.5.3, no puedo generar un mundo nuevo
There should be no significant difference between the two versions, why can't you generate a world? Do you get an error? If so, we could use your client.log file, it's in your documents folder.

No debería haber una diferencia significativa entre las dos versiones, ¿por qué no puedes generar un mundo? ¿Le da un error? Si es así, podríamos usar su archivo client.log, está en su carpeta de documentos.
 

RIsland

Terrarian
[QUOTE = "Jofairden, publicación: 1947747, miembro: 14826"]
No debería haber una diferencia significativa entre las dos versiones, ¿por qué no puedes generar un mundo? ¿Le da un error? Si es así, podríamos usar su archivo client.log, está en su carpeta de documentos.

No debería haber una diferencia significativa entre las dos versiones, ¿por qué no puedes generar un mundo? ¿Le da un error? Si es así, podríamos usar su archivo client.log, está en su carpeta de documentos.
[QUOTE = "Jofairden, publicación: 1947747, miembro: 14826"]
No debería haber una diferencia significativa entre las dos versiones, ¿por qué no puedes generar un mundo? ¿Le da un error? Si es así, podríamos usar su archivo client.log, está en su carpeta de documentos.

No debería haber una diferencia significativa entre las dos versiones, ¿por qué no puedes generar un mundo? ¿Le da un error? Si es así, podríamos usar su archivo client.log, está en su carpeta de documentos.
[/CITAR]
later the see all mod, desactivate the mods with alterade the world, and check, the problem is a mod but idk the specific mod, so, just play now with someone mods, but thanks for respond my message, by the way, im mexican, for what a write weird

Por lo que escribo raro
 

MeowKyuun

Terrarian
Congrats on getting a steam workshop download with Terraria, I can't wait to see how it works and see all the new people finally getting into tmodloader once it's easier to download
 

Ambaire

Terrarian
I just discovered that if I swap to borderless windowed mode from regular windowed mode, it bugs out and still shows the taskbar. If I close and relaunch the tmodloader version, it works normally. The unmodded Steam version works as expected. See the bug below.

LU5W2qfNMY.png
 
Top Bottom