Standalone [1.3] tModLoader - A Modding API

Help, how would I add 10% lifesteal to an accessory?

edit: figured it out, but now there is an error

c:\Users\keega\Documents\My Games\Terraria\ModLoader\Mod Sources\NecroticIncantations\Items\NecroClass\Accessories\NecroticBone.cs(40,23) : error CS0266: Cannot implicitly convert type 'float' to 'int'. An explicit conversion exists (are you missing a cast?)

code:
using Terraria.ModLoader;
using NecroticIncantations.Items.NecroClass;

namespace NecroticIncantations.Items.NecroClass.Accessories
{
public class NecroticBone : ModItem
{
public float health;

public override void SetStaticDefaults()
{
Tooltip.SetDefault("10% increased necrotic damage" +
"\n1% lifesteal from enemies");
}

public override void SetDefaults()
{
item.Size = new Vector2(34);
item.rare = 2;
item.accessory = true;
}

public override void UpdateAccessory(Player player, bool hideVisual)
{
NecroticDamagePlayer modPlayer = NecroticDamagePlayer.ModPlayer(player);
modPlayer.NecroticDamage += 0.1f;
//add lifesteal effect
}

public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
health = damage * .1f;
player.statLife += health + 1.0f;
}
}
}

I can't say for certain, but I think your problem is the line "player.statLife += health + 1.0f;". player.statLife is an integer (int for short) and you can't just add a float to an int. Both 'health' and '1.0f' are floats (putting a f on the end of a number makes it a float) so they must be explicitly converted to ints. Here's what that line should look like.

player.statLife += (int)(health + 1);

I removed .0f because there's no point defining an int as a float and then immediately converting to an int anyway.
 
hey uhh people have been claimed that tmodloader.64 bit is a thing now and fury forged says he has it, does anyone know if i couof get one and if i could, where could i get one?
 
Hi, is there any function calling on when an NPC is killed by a certain item? Also, how would I make a weapon that when you right click it takes your health but gives you mana?
 
All, I'm trying to download a few mods to play alongside a youtuber (toxic timewaster). I downloaded tmodloader and then all mods, but for some reason I either get an error or it loads without mods at all. I've tried new char, new worlds, reloading mods and reloading game, nothing fixes it. Has anyone else had this problem or knows how to fix this for me? List of mods below.

"Antisocial",
"BettertakeaPowerTool",
"BossChecklist",
"CalamityMod",
"CheezeMod",
"CrystiliumMod",
"ElementalBoots",
"ElementsAwoken",
"ExperienceAndClasses",
"Fargowiltas",
"imkSushisMod",
"JoostMod",
"Loot",
"MagicStorage",
"MaxStackPlus",
"MoreChestLoot",
"OmniSwing",
"Pumpking",
"RecipeBrowser",
"ShorterRespawn",
"SimpleAutoChests",
"TheLuggage",
"ThoriumMod",
"Tremor",
"VexQoL",
"WMITF",
"ZoaklenMod"
 
hi! I'm a new modder and I don't have the code down, so could i get some help? this keeps giving me an error so could somebody correct it and repost? thanks.
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
public class TutorialShield : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("TutorialShield");
Tooltip.SetDefault("This is a badass shield.");
}
public override void SetDefaults()
{
item.damage = 9999999;
item.defense = 9999999; item.accessory = true; item.width = 400;
item.height = 400;



item.knockBack = 9999999;
item.value = 10000;
item.rare = 11;
item.UseSound = SoundID.Item1;
item.autoReuse = true; item.crit = 9999999; }

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void UpdateEquip(Player player) { player.statManaMax2 += 9999999; player.statLifeMax2 += 9999999; } }
}
 
hi! I'm a new modder and I don't have the code down, so could i get some help? this keeps giving me an error so could somebody correct it and repost? thanks.
using Terraria.ID;
using Terraria.ModLoader;

namespace TutorialMod.Items
{
public class TutorialShield : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("TutorialShield");
Tooltip.SetDefault("This is a badass shield.");
}
public override void SetDefaults()
{
item.damage = 9999999;
item.defense = 9999999; item.accessory = true; item.width = 400;
item.height = 400;



item.knockBack = 9999999;
item.value = 10000;
item.rare = 11;
item.UseSound = SoundID.Item1;
item.autoReuse = true; item.crit = 9999999; }

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void UpdateEquip(Player player) { player.statManaMax2 += 9999999; player.statLifeMax2 += 9999999; } }
}
I’m not certain, but I think it’s because of all of those integers (numbers) are far too long. If this doesn’t work, look at example mod. That’s where I learned most of my code.
 
I’m not certain, but I think it’s because of all of those integers (numbers) are far too long. If this doesn’t work, look at example mod. That’s where I learned most of my code.
so I based this off of the tutorialmod sword and found out that the highest acceptable integer is 9999999 (7 nines). it worked until I added the life and mana boosts bit it keeps saying that "type or namespace name 'player' could not be found. (are you missing a using directive or an assembly reference?)" but I don't understand what the heck the techspeak means.
 
Kittykitcatcat.png
Is this normal???
 
so I based this off of the tutorialmod sword and found out that the highest acceptable integer is 9999999 (7 nines). it worked until I added the life and mana boosts bit it keeps saying that "type or namespace name 'player' could not be found. (are you missing a using directive or an assembly reference?)" but I don't understand what the heck the techspeak means.
I think you missing a piece of code: using Terraria. Add this where you think it goes.
 
what do you mean? what looks abnormal to you?
[doublepost=1543010124,1543010104][/doublepost]
The tutorial for developing with Visual Studio on the wiki on Github contains a link that's supposed to be a separate guide for using VS Code instead, but the page doesn't actually exist yet. Was the original guide removed, or did you just put a link to a page that doesn't exist yet...?
it simply was never made (yet) no idea if it ever will be.
 
hey uhh people have been claimed that tmodloader.64 bit is a thing now and fury forged says he has it, does anyone know if i couof get one and if i could, where could i get one?
For a more useful answer, yes, it is a thing. It's not official, but it exists.
https://forums.terraria.org/index.php?members/dradonhunter11.20310/
Dradonhunter11 is making it, and it is in Beta currently (i.e. there is a large chance of things going wrong back up everything before attempting anything and expect mods to not always work correctly with it). I've not tried it myself, but from what I've heard, reports are it's surprisingly stable currently. It can be downloaded from his Discord, which he has linked in his latest profile post. As with anything unofficial, any damage caused to your savegames, crashing issues, maybe even computer bluescreening- none of that is covered by the tModLoader team. So be warned- results may vary, and if you try it, you do so at your own risk.

nope, it's not official
Official or not, it still deserves to be recognized as something which exists, and acknowledged to those specifically looking for it. It's incredibly technically impressive that changing it to 64 bit was even possible while (seemingly) maintaining compatability.

Until there is an official 64 bit version (which people have been asking for for years, but from what I've heard is still a long way away, if it's even in development at all) this can tide over the people who want that for various reasons, so long as they're made very aware that it isn't official or supported, and as such likely buggy and outdated (which Dradonhunter appears to have been very clear about).

So unless it's extremely against tModLoader's license to make that fork (in which case I imagine there would have been a lot more backlash against it in the first place) I see no reason for being so dismissive of it, especially when someone was asking about it.
 
Last edited:
For a more useful answer, yes, it is a thing. It's not official, but it exists.
https://forums.terraria.org/index.php?members/dradonhunter11.20310/
Dradonhunter11 is making it, and it is in Beta currently (i.e. there is a large chance of things going wrong back up everything before attempting anything and expect mods to not always work correctly with it). I've not tried it myself, but from what I've heard, reports are it's surprisingly stable currently. It can be downloaded from his Discord, which he has linked in his latest profile post. As with anything unofficial, any damage caused to your savegames, crashing issues, maybe even computer bluescreening- none of that is covered by the tModLoader team. So be warned- results may vary, and if you try it, you do so at your own risk.


Official or not, it still deserves to be recognized as something which exists, and acknowledged to those specifically looking for it. It's incredibly technically impressive that changing it to 64 bit was even possible while (seemingly) maintaining compatability.

Until there is an official 64 bit version (which people have been asking for for years, but from what I've heard is still a long way away, if it's even in development at all) this can tide over the people who want that for various reasons, so long as they're made very aware that it isn't official or supported, and as such likely buggy and outdated (which Dradonhunter appears to have been very clear about).

So unless it's extremely against tModLoader's license to make that fork (in which case I imagine there would have been a lot more backlash against it in the first place) I see no reason for being so dismissive of it, especially when someone was asking about it.
I never was dismissive, or said it didn't exist. I'm simply saying no, no idea how to get it as it's not official. You'll have to figure out the unofficial source to get it..
 
I never was dismissive, or said it didn't exist. I'm simply saying no, no idea how to get it as it's not official. You'll have to figure out the unofficial source to get it..
Apologies, I was hasty in my defense. I made a wrong assumption based on the short, blunt tone of your message.
It came across as trying to "sweep it under the rug" like: No, I won't give you information because it's not official and we don't like that.
I'm sincerely sorry that I saw the message in that light, when it wasn't intended, and reacted as kneejerk as I did.
It can be very difficult to gauge intent through text alone, but that is a poor excuse on my end.
 
When will have tModLoader for Terraria 1.4?
Probably a while after version 1.4 releases. I'd say that it's way too early to ask for tModLoader for Terraria 1.4 when we don't even know exactly when Terraria 1.3.6 will come out, while we know that that will come first.

Edit: Terraria's wiki thing even says that version 1.4 has not even started its actual development yet.
 
Back
Top Bottom