In the code for when the bomb explodes, loop through Main.player and see if any of the players are within some radius of the centre of the projectile, if they are then
player.statLife += healAmount; // Gives Health
player.HealEffect(healAmount, true); // Healing effect
Hello, I'm trying to make an NPC, and I don't know how I would make the actual hitbox of the NPC smaller than the sprite?
I know I can change npc.width and npc.height, but I'm hesitant to in case that breaks the animation. Plus I'm wanting the hitbox offset from (0, 0) on the sprite anyway.
item.name is not a thing - there is no 'name' variable in Item. Also, there is no AddTooltip method in ModItem.
Delete those and do this:
public override void SetStaticDefaults()
Tooltip.SetDefault("A plate equipped with tech stuff");
// Override UseItem in ModItem
public override bool UseItem(Player player)
player.AddBuff(Terraria.ID.BuffID.Hunter, 360); // Add the Hunter buff to the player for 6 seconds
player.AddBuff(Terraria.ID.BuffID.Horrified, 360); // Add the Horrified buff the the player for 6 seconds...
You can probably locate the vanilla sprites in Main (assuming you have access to the source code) and then in your mod, I guess in your mod's Load() method? you can replace those sprites with your own, for example: Main.dukeFishronTexture = ModContent.GetTexture("ModFolder/pathToImage");
In your magic weapon item's class, you'll need to override the Shoot method like so:
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
// Check for that 10% chance
I can certainly try to help you with any questions you have, but the best way to learn is to just jump into it. Do have at least a quick look at a C# tutorial (tutorialspoint has a good one I think) as I had no idea how to code when I started modding, and didn't have a look at any tutorials, and...
You seem to be checking if player.miscEquips is true, but it's an Item array, and it can't convert that to a boolean. What exactly is the if(player.miscEquips) meant to be checking?
tModLoader doesn't have a decompiler (that I'm aware of), so you're going to have to use something like ilspy...
Probably be useful to create a Helper class with some commonly used/useful functions in, like hasInInventory and hasEquippedAccessory
You can probably change that in GlobalTile, but I wouldn't know how sorry