tModLoader Official tModLoader Help Thread

1)a) If you want say than a enemy can spawn only after defeating a certain enemy/boss, you need just add a condition on the canspawn of the enemy (after, if this is a vanilla enemy, no idea ^^)
1)b) if this is than you want spawn a enemy just after defeating a npc, you put just a npc spawn in the npcloot of the boss/enemy.(do not forgot test in multi also)

2) You need use method useItem and just put a heal effect. You can use button search in this subject (or the other help subject) and VisualStudio.
yeah... I dont know how to do this (I know I'm a real noob at coding but im trying XD)
and I also cannot install visualstudio for some reason

EDIT: I know what you mean with the first one but I dont get along with the second one
 
Last edited:
1)a) If you want say than a enemy can spawn only after defeating a certain enemy/boss, you need just add a condition on the canspawn of the enemy (after, if this is a vanilla enemy, no idea ^^)
1)b) if this is than you want spawn a enemy just after defeating a npc, you put just a npc spawn in the npcloot of the boss/enemy.(do not forgot test in multi also)

2) You need use method useItem and just put a heal effect. You can use button search in this subject (or the other help subject) and VisualStudio.

example pls, havent found anything
 
Why example? You need just add a spawn npc in the npcloot of the boss/npc.... and stop say than you found nothing, examplemod have two boss who contains that...

For the second, i have found many answer, so no, you search very bad.
 
Can someone tell me how to make a sword shine/glow with a certain color? (Specifically, make it glow sort of a moon-ish color, but if there isn't a way to make it glow a specific color, then just say how to make it glow)
 
Can someone tell me how to make a sword shine/glow with a certain color? (Specifically, make it glow sort of a moon-ish color, but if there isn't a way to make it glow a specific color, then just say how to make it glow)
I'm assuming that you want to make the sword glow when it is being used or when it is lying in the world. I havn't tested this, but this should work when added to the code of your item.
Code:
public override void UseStyle(Player player) //while the player is using this item
{
    //add a light at the center of my player with a brightness of %50
    Lighting.AddLight(player.Center, 0.5f, 0.5f, 0.5f);
}

public override void Update(ref float gravity, ref float maxFallSpeed) //when this item is lying in the world
{
    //add a light at the center of this item with a brightness of %50
    Lighting.AddLight(item.position + item.Size / 2, 0.5f, 0.5f, 0.5f);
}
 
Why example? You need just add a spawn npc in the npcloot of the boss/npc.... and stop say than you found nothing, examplemod have two boss who contains that...

For the second, i have found many answer, so no, you search very bad.
I MEAN AFTER U DEFEAT A BOSS THE MOB CAN SPAWN
BEFORE THE BOSS ISNT DEFEATED THE NPC WONT SPAWN
ARRRRRRRRRRRRRRRRGGGGGGGGHHHHHHHHHHHHH


also how do i increase the range of a tool?? (im working on crazy range pickaxes)
 
Purity Spirit have a "save int" in the examplemod.cs, 0 if never defeat , when you defeat the boss, you change this value per 1. (You change in Bossloot) Now, when the player left and reenter, this value is always 1.

In the method canspawn of your customnpc, you add a condition, if the boss is defeat or not (so if (variable == 1))
 
Hey, umm i had a simple question... Upon downloading TModloader 8.3.1, Windows 10 said 'Windows found malware, and is removing it now.' as soon as i tried playing Modded Terraria, i had a Failed to Start window pop up, and it had alot of stuff on it, including this. "at Microsoft.xna.Framework.Game.RunGame(Boolean useBlockingRun)" Please help!
 
Purity Spirit have a "save int" in the examplemod.cs, 0 if never defeat , when you defeat the boss, you change this value per 1. (You change in Bossloot) Now, when the player left and reenter, this value is always 1.

In the method canspawn of your customnpc, you add a condition, if the boss is defeat or not (so if (variable == 1))
thx
[doublepost=1470002377,1470002328][/doublepost]but i want it to spawn after Plantera is down
 
He exist a variable for that. Look the vanilla code in NPC, this is the bool downedPlantBoss.
You put just if(NPC.downedPlantBoss)
 
I'm assuming that you want to make the sword glow when it is being used or when it is lying in the world. I havn't tested this, but this should work when added to the code of your item.
Code:
public override void UseStyle(Player player) //while the player is using this item
{
    //add a light at the center of my player with a brightness of %50
    Lighting.AddLight(player.Center, 0.5f, 0.5f, 0.5f);
}

public override void Update(ref float gravity, ref float maxFallSpeed) //when this item is lying in the world
{
    //add a light at the center of this item with a brightness of %50
    Lighting.AddLight(item.position + item.Size / 2, 0.5f, 0.5f, 0.5f);
}
Oh thank you very much :D Is there any specific place that I need to add it, or just anywhere after the item.damage, item.name, item.width, item.height, all that?
 
ugh, guys there seems to be a problem with Tmodloader (or idk wats wrong)
this hamaxe i made appearently has 750% Axe power (but i want 150%)
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace SacredTools.Items
{
    public class NovaHamaxe : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Nova Hamaxe";
            item.damage = 60;
            item.melee = true;
            item.width = 32;
            item.height = 32;
            item.useTime = 27;
            item.useAnimation = 27;
            item.axe = 150;
            item.hammer = 100;
            item.useStyle = 1;
            item.knockBack = 5;
            item.value = Item.sellPrice(0, 5, 0, 0);
            item.rare = 10;
            item.useSound = 1;
            item.autoReuse = true;
            item.useTurn = true;
            //item.tileBoost++++;
        }
        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "FragmentNova", 14);
            recipe.AddIngredient(ItemID.LunarBar, 12);
            recipe.AddTile(TileID.LunarCraftingStation);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}


and how do i increase its range?? (+4??)
 
Hi, I'm back and I've got some questions.
1) Is it possible to have an armor set bonus that makes all your attacks life steal?
2) How can I make a projectile that spawns where your cursor is?
3) How can I give a dash ability to armor/accessory?
4) How to make a projectile shoot homing like the magnet sphere?
tnx!
 
Oh thank you very much :D Is there any specific place that I need to add it, or just anywhere after the item.damage, item.name, item.width, item.height, all that?
The code that I gave you is just two hooks. They go inside your item's class, but outside of any other hooks you may have. I'd suggest you put them straight after your setDefaults hook. I also forgot to mention that the code I gave you will add a white light of 50% brightness to your item. If you want a different colour, just change the three 0.5f to different numbers between 0 and 1. The three numbers are how Red, Green and Blue (in that order) your light will be.

ugh, guys there seems to be a problem with Tmodloader (or idk wats wrong)
this hamaxe i made appearently has 750% Axe power (but i want 150%)
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace SacredTools.Items
{
    public class NovaHamaxe : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Nova Hamaxe";
            item.damage = 60;
            item.melee = true;
            item.width = 32;
            item.height = 32;
            item.useTime = 27;
            item.useAnimation = 27;
            item.axe = 150;
            item.hammer = 100;
            item.useStyle = 1;
            item.knockBack = 5;
            item.value = Item.sellPrice(0, 5, 0, 0);
            item.rare = 10;
            item.useSound = 1;
            item.autoReuse = true;
            item.useTurn = true;
            //item.tileBoost++++;
        }
        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "FragmentNova", 14);
            recipe.AddIngredient(ItemID.LunarBar, 12);
            recipe.AddTile(TileID.LunarCraftingStation);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}


and how do i increase its range?? (+4??)
For some reason, terraria multiplies the axe power by about 5. You simply need to set the axe power to one fifth of what you want the percentage to be. Also, item.tileBoost = 4; should give you the range boost that you want.
 
The code that I gave you is just two hooks. They go inside your item's class, but outside of any other hooks you may have. I'd suggest you put them straight after your setDefaults hook. I also forgot to mention that the code I gave you will add a white light of 50% brightness to your item. If you want a different colour, just change the three 0.5f to different numbers between 0 and 1. The three numbers are how Red, Green and Blue (in that order) your light will be.


For some reason, terraria multiplies the axe power by about 5. You simply need to set the axe power to one fifth of what you want the percentage to be. Also, item.tileBoost = 4; should give you the range boost that you want.
Thanks! It worked :D
 
Alright, so I've figured out most of my questions. Now I have new ones.
1) How can I make a projectile that orbits around the player but home in if there is an enemy?
2) How do I make a projectile spawn on the cursor?
I've been really stressed out as I have not figured out how I can do this :/
 
Alright, so I've figured out most of my questions. Now I have new ones.
1) How can I make a projectile that orbits around the player but home in if there is an enemy?
2) How do I make a projectile spawn on the cursor?
I've been really stressed out as I have not figured out how I can do this :/
1 is kind of tricky, but 2 is simple. Put the following code into your useItem hook.
Code:
if (Main.myPlayer == player.whoAmI)
{
    int proID = Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, speedX, speedY, type, item.damage, item.knockBack, player.whoAmI);
}
Replace speedX and speedY with whatever speed you want. Replace type with the ID of whatever you want to spawn. If you are spawning a modPorjectile, use mod.ProjectileType("insert class name of projectile here").
 
Back
Top Bottom