Standalone [1.3] tModLoader - A Modding API

Then you can do it like I said.
Head over to your Terraria steam folder and copy+paste all files (excluding the readme and the installer that is) into that folder (even if you're not on mac, you'll still want to copy the TerrariaMac.exe over (really, just everything excluding the two files mentioned earlier)).
It worked but my characters and worlds are gone
 
It worked but my characters and worlds are gone
If you want to use your vanilla characters/world you'll have to copy them over to the tModLoader save folders (these are created seperately so you can switch back 'n forth between tModLoader and vanilla without problems).
If you go to C:\Users\USERNAME\Documents\My Games\Terraria you'll see folders named Worlds, Players, and ModLoader. You'll want to copy all files of the character/world you want to use from their respective folders into the folder that are named the same, but are in the ModLoader folder (I hope that's clear).
 
Made an account just to let you know that modded NPC's/Enemies disappearing upon taking damage in multiplayer has happened to at least two other players, me and my friend, who is hosting the server. Modded enemies work perfectly in dealing damage, walking around, etc. but when they take damage they instantly disappear. They don't drop anything, have any animation, or do anything but just vanish. Hope this confirms that bug.
 
Is there a way that I can remove all drops except for one that I add?
Drops from vanilla NPCs I'm guessing?
You can have a class derive from GlobalNPC, override PreNPCLoot, spawn your item and return false (to stop vanilla loot to spawn):
Code:
public override bool PreNPCLoot(NPC npc)
{
    if(npc.type == NPCID.SkeletronHead)
    {
        Item.NewItem(blablabla);
        return false;
    }
    return false;
}
 
Drops from vanilla NPCs I'm guessing?
You can have a class derive from GlobalNPC, override PreNPCLoot, spawn your item and return false (to stop vanilla loot to spawn):
Code:
public override bool PreNPCLoot(NPC npc)
{
    if(npc.type == NPCID.SkeletronHead)
    {
        Item.NewItem(blablabla);
        return false;
    }
    return false;
}
If say I wanted the EoC to drop a dirt block, but nothing else at all.
 
If say I wanted the EoC to drop a dirt block, but nothing else at all.
You'll want to modify that code:
Code:
public override bool PreNPCLoot(NPC npc)
{
    if(npc.type == NPCID.EyeofCthulhu)
    {
        Item.NewItem(npc.position.X, npc.position.Y, npc.width, npc.height, ItemID.DirtBlock);
        return false;
    }
    return true;
}
 
You'll want to modify that code:
Code:
public override bool PreNPCLoot(NPC npc)
{
    if(npc.type == NPCID.EyeofCthulhu)
    {
        Item.NewItem(npc.position.X, npc.position.Y, npc.width, npc.height, ItemID.DirtBlock);
        return false;
    }
    return true;
}
Thanks. It seems to work.
 
All the documentation for this tool says that there is a ModSources folder in My Games/Terraria/ModLoader. However when I tried to access it, there was no such folder. Please Help.
 
All the documentation for this tool says that there is a ModSources folder in My Games/Terraria/ModLoader. However when I tried to access it, there was no such folder. Please Help.
The "Mod Sources" folder should be created there when you click the mod Sources menu. Have you tried the open mod Sources folder button?
 
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Hypaxi.Items
{
public class ExampleGun : ModItem
{
public override void SetDefaults()
{
item.name = "Specter Rifle";
item.damage = 20;
item.ranged = true;
item.width = 40;
item.height = 20;
item.toolTip = "This is a modded gun.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 4;
item.value = 10000;
item.rare = 2;
item.useSound = 11;
item.autoReuse = true;
item.shoot = 10;
item.shootSpeed = 16f;
item.useAmmo = ProjectileID.Bullet;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}
}

Alright not trying to be annoying but I tried to fix the code with the advice given but it still is having some problems.
 
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Hypaxi.Items
{
public class ExampleGun : ModItem
{
public override void SetDefaults()
{
item.name = "Specter Rifle";
item.damage = 20;
item.ranged = true;
item.width = 40;
item.height = 20;
item.toolTip = "This is a modded gun.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 4;
item.value = 10000;
item.rare = 2;
item.useSound = 11;
item.autoReuse = true;
item.shoot = 10;
item.shootSpeed = 16f;
item.useAmmo = ProjectileID.Bullet;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(this);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}
}

Alright not trying to be annoying but I tried to fix the code with the advice given but it still is having some problems.
What is exactly the problem? Can we have the error message?
 
It says

The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments
Argument 1: cannot convert from 'Hypaxi.Items.ExampleGun' to 'Terraria.ModLoader.Mod'
 
It says

The best overloaded method match for 'Terraria.ModLoader.ModRecipe.ModRecipe(Terraria.ModLoader.Mod)' has some invalid arguments
Argument 1: cannot convert from 'Hypaxi.Items.ExampleGun' to 'Terraria.ModLoader.Mod'
In the AddRecipes function, instead of
Code:
ModRecipe recipe = new ModRecipe(this);
You'll want to put
Code:
ModRecipe recipe = new ModRecipe(mod);
 
Just asking does anyone else have a problem with lag or out of memory error when loading 13+ mods? the mods i have enabled are Imksushis mod, Ersion, Longbows FTW, Tremor, More Accessories+, Summoners Association, Quality of life Standard, Helpful Hotkeys, Imksushi mod: Drops Addon, MaxStackPlus, Thorium, Infinity, and battle hardened NPCs... but when I try to load anymore than those ones I get MAJOR lag and have to use task manager to force close terraria or I get out of memory error and this really bugs me Because there are a few other mods I would love to add like the ZoaklenMod or Boss Expertise but I enable one of those and my game freaks out when I try to load a world.
 
namespace Hypaxi.Items
{
public class SpecterRifle : ModItem
{
public override void SetDefaults()
{
item.name = "Specter Rifle";
item.damage = 20;
item.ranged = true;
item.width = 40;
item.height = 20;
item.toolTip = "This is a modded gun.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 4;
item.value = 10000;
item.rare = 2;
item.useSound = 11;
item.autoReuse = true;
item.shoot = 10;
item.shootSpeed = 16f;
item.useAmmo = ProjectileID.Bullet;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}
}

Alright so this is what i've tried now.
here are the errors

error CS1514: { expected
error CS1519: Invalid token ':' in class, struct, or interface member declaration
error CS1519: Invalid token '{' in class, struct, or interface member declaration
 
namespace Hypaxi.Items
{
public class SpecterRifle : ModItem
{
public override void SetDefaults()
{
item.name = "Specter Rifle";
item.damage = 20;
item.ranged = true;
item.width = 40;
item.height = 20;
item.toolTip = "This is a modded gun.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 4;
item.value = 10000;
item.rare = 2;
item.useSound = 11;
item.autoReuse = true;
item.shoot = 10;
item.shootSpeed = 16f;
item.useAmmo = ProjectileID.Bullet;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}
}

Alright so this is what i've tried now.
here are the errors

error CS1514: { expected
error CS1519: Invalid token ':' in class, struct, or interface member declaration
error CS1519: Invalid token '{' in class, struct, or interface member declaration
Is this all the code that is in your class? No using statements?
 
Back
Top Bottom