tModLoader Need a bit of help for my mod

Hmm, you need another texture called "HeroChestplate" that will be what you see when the item is in your inventory. The error message is saying that you are missing HeroChestplate_Body which is weird because you already have it. Assuming that your namepaces are correct then I guess the error message is just displaying weirdly.

So I would try just adding the other texture you need then if the error is still there then tell me.

Example of the texture you need:

View attachment 351698

I will try to respond faster text time.
Oh oops I forgot bout that
1640033481918.png
This work?
 

Attachments

  • 1640033403881.png
    1640033403881.png
    17.5 KB · Views: 51
I added the shadow dodge buff but I don't know how to make it turn off when you're attacked and then reappear.
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace PowerRising.Items.Armor
{
    [AutoloadEquip(EquipType.Head)]
    public class HeroHelmet : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("This is a piece of the legendary Hero Armor.");
        }

        public override void SetDefaults()
        {
            item.width = 18;
            item.height = 18;
            item.value = 1;
            item.rare = 8;
            item.defense = 23;
        }

        public override bool IsArmorSet(Item head, Item body, Item legs)
        {
            return body.type == mod.ItemType("HeroChestplate") && legs.type == mod.ItemType("HeroLeggings");
        }

        public override void UpdateArmorSet(Player player)
        {
            player.meleeDamage *= 1.18f;
            player.AddBuff(BuffID.ShadowDodge, 1);
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.BeetleHelmet);
            recipe.AddIngredient(mod.ItemType("DragonEssence"));
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
 
Last edited:
I added the shadow dodge buff but I don't know how to make it turn off when you're attacked and then reappear.
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace PowerRising.Items.Armor
{
    [AutoloadEquip(EquipType.Head)]
    public class HeroHelmet : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("This is a piece of the legendary Hero Armor.");
        }

        public override void SetDefaults()
        {
            item.width = 18;
            item.height = 18;
            item.value = 1;
            item.rare = 8;
            item.defense = 23;
        }

        public override bool IsArmorSet(Item head, Item body, Item legs)
        {
            return body.type == mod.ItemType("HeroChestplate") && legs.type == mod.ItemType("HeroLeggings");
        }

        public override void UpdateArmorSet(Player player)
        {
            player.meleeDamage *= 1.18f;
            player.AddBuff(BuffID.ShadowDodge, 1);
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.BeetleHelmet);
            recipe.AddIngredient(mod.ItemType("DragonEssence"));
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

OK, I have been trying to figure this out but I have a few questions. Do you want the effect to work like the titanium armour/1.4 hallowed armor? If so then that might be complicated to pull off. If not, how do you want the effect to work? Thanks!
 
Like the titanium and 1.4 hallowed

Ok, this might take me a bit to figure out. The titanium armor works (Well, I think it works) when you hit an enemy there is a chance you can get shadow doge for 30 seconds, then when you are hit the debuff goes away. Assuming that that is what you want the armor to do I will try to find a good way to implement this as fast as I can.
 
Ok, this might take me a bit to figure out. The titanium armor works (Well, I think it works) when you hit an enemy there is a chance you can get shadow doge for 30 seconds, then when you are hit the debuff goes away. Assuming that that is what you want the armor to do I will try to find a good way to implement this as fast as I can.
Yeah I want the armor to do that, thanks!
 
also, how do I make a full set of armor give you bonus walkspeed and melee critical chance?

player.moveSpeed = whatever; and player.meleeCrit = whatever;

Put those in the same place you put player.meleeDamage *= 1.18f; and player.AddBuff(BuffID.ShadowDodge, 1);

Also, you can do replace "=" with "*= " to make it multiply by the value instead of just setting the value.

Also, here is a whole list of player accessory fields:

-accCompass [Displays information at top left, how far you are from spawn horizontally] [INT]
-accDepthMeter [Displays information at the top left, tells you your elevation] [INT]
-accDivingHelm [Greatly extends breath as long as the diving helmet does] [BOOL]
-accFishingLine [Untested] [BOOL]
-accFlipper [Lets you swim] [BOOL]
-accMerman [Lets you turn into merfolk when entering water] [BOOL]
-accTackleBox [Decreases chance of losing bait when fishing, higher the number, the less likely] [INT]
-accWatch [Displays the time at the top left of the screen] [INT]
-activeNPCs [Modifies the amount of slots NPCs take up. Lower the multiplier, and more enemies can spawn. Make it very high, and none can spawn] [FLOAT]
-adjHoney [If set to true, you can craft items that require you to be near Honey anywhere when used with adjTile] [BOOL]
-adjLava [Untested] [BOOL]
-adjWater [Untested] [BOOL]
-adjTile [Use in the JSON, makes the game think the player is near a tile] ["adjTile": { "Tile Name" }]
-aggro [Untested] [INT]
-AddBuff [Gives the player a buff, FORMAT: p.AddBuff(ID,DURATION,BOOL)]
-ammoBox [Gives the Ammo Box buff, or 20% chance not to consume ammo] [BOOL]
-ammoCost75 [Gives the player a 25% chance to not consume ammo with any ranged weapon] [BOOL]
-ammoCost80 [Gives the player a 20% chance to not consume ammo with any ranged weapon] [BOOL]
-ammoPotion [Gives the player the ammo potion buff] [BOOL]
-anglerQuestsFinished [Makes the game think you have done the assigned integer of angler quests] [INT]
-archery [Gives the player the Archery buff, which increases arrow damage and speed by 20%] [BOOL]
-armorStealth [Gives the player the Shroomite Armor bonus, which lets you turn invisible after standing still and drastically increases ranged damage] [BOOL]
-arrowDamage [Sets a multiplier for damage of arrow-based weapons] [FLOAT]
-attackCD [Makes your attacks useless unless underwater, unless the value is 0] [INT]
-autoJump [Allows you to keep jumping by holding down the Space Bar] [BOOL]
-autoPaint [Gives the player the Paint Sprayer effect, which automatically paints all blocks placed with any paint in your inventory in order] [BOOL]
-back [Assigns a back texture onto the player] [SBYTE] [SBYTE is just an INT with a max number]
-balloon [Assigns a balloon texture onto the player] [SBYTE]
-bank [Untested] [CHEST] [Not sure what format CHEST is]
-bank2 [Untested] [CHEST]
-bee [Untested] [BOOL]
-beetleBuff [Untested] [BOOL]
-beetleCountdown [Untested] [INT]
-beetleCounter [Untested] [FLOAT]
-beetleDefense [Untested] [BOOL]
-beetleFrame [Untested] [INT]
-beetleFrameCounter [Untested] [INT]
-beetleOffense [Untested] [BOOL]
-beetleOrbs [Untested] [INT]
-blackBelt [Black Belt effect] [BOOL]
-blackout [Blackout debuff] [BOOL]
-bleed [Bleeding debuff] [BOOL]
-blind [Blind debuff] [BOOL]
-blockRange [Sets how far the player can place blocks] [INT]
-blueFairy [Untested, blue fairy bell pet?] [BOOL]
-body [Assigns a shirt texture to the player] [INT]
-bodyRotation [Makes the body rotate at a certain speed] [FLOAT]
-boneArmor [Replaces hurt sounds with skeleton hurt sounds, like Necro Armor] [BOOL]
-breath [Permanently sets breath to value, 200 is max] [INT]
-breathCD [How fast your breath decreases; the higher the number, the faster] [INT]
-breathMax [Sets the maximum amount of breath you can have to value, 400 is double] [INT]
-breathTickMod [Untested] [FLOAT]
-brokenArmor [Sets a multiplier for defense] [FLOAT]
-buffImmune [DOES NOT GO IN CS FILE, GOES IN JSON! FORMAT:[BUFF ID]]
-bulletDamage [Sets a multiplier for damage of bullet-based weapons] [FLOAT]
-bunny [Untested, collector's edition bunny summon?] [BOOL]
-burned [Burned debuff(Gotten from standing on meteorite and hellstone)] [BOOL]
-burnedMoveSpeedMod [Modifies your movement speed while having the burned debuff] [FLOAT]
-calmed [Reduced enemy spawn rate] [BOOL]
-canCarpet [When used in affiliation with p.carpet, it allows for infinite use of Magic Carpet] [BOOL]
-canRocket [When used in affiliation with Rocket Boots, it allows for infinite propulsion] [BOOL]
-carpet [Grants the player the Magic Carpet effect] [BOOL]
-carpetTime [How long you can fly with the Magic Carpet accessory] [INT]
-cartFlip [Untested] [BOOL]
-cartRampTime [Untested] [INT]
-changeItem [Untested] [INT]
-channel [Untested] [BOOL]
-chaosState [Using the Rod of Discord hurts] [BOOL]
-chatShowTime [How long a chat message shows] [INT]
-chatText [Message the chat says] [STRING]
-chest [Makes the player think it's at the chest's ID when you open a chest] [INT]
-chestX [Untested] [INT]
-chestY [Untested] [INT]
-coins [Lucky Coin effect, makes enemies drop more loot and chance to drop coins on attack] [BOOL]
-coldDash [Untested] [BOOL]
-confused [Confused debuff] [BOOL]
-ClearBuff [Clears a debuff] [Use like this: p.ClearBuff("Buff Name", "InternalModName:BuffName", or INT);
-crateChance [Increases the chance of getting a crate while fishing] [FLOAT]
-crimsonRegen [Grants the Crimson armor set bonus, increased life regen] [BOOL]
-crystalLeafDelay [Untested] [INT]
-cSapling [Untested] [BOOL]
-dangersense [Highlights traps] [BOOL]
-dash [Set to any value, and will grant the Tabi effect, double tap A or D to dash] [INT]
-dashDelay [Sets the amount of time you have between each dash, 0 for no limit] [INT]
-dashTime [Sets how long the dash is] [INT] detectCreature [Hunter potion effect, makes enemies glow in darkness] [BOOL]
-dead [If set to false, it will revive the player if applied by an outside source while dead, with all the body parts elsewhere] [BOOL]
-delayUseItem [Untested] [BOOL]
-detectCreature [Highlights enemies] [BOOL]
-difficulty [If 0, softcore death. If 1, mediumcore death but all items disappear. If 2, hardcore death.] [BYTE]
-dino [Untested, dinosaur pet] [BOOL]
-discount [Sets price multiplier for shops] [FLOAT] doubleJump [Cloud in a Bottle effect] [BOOL]
-discountApplied [Untested] [BOOL]
-dJumpEffect [Untested] [BOOL]
-dJumpEffect2 [Untested] [BOOL]
-dJumpEffect3 [Untested] [BOOL]
-dJumpEffect4 [Untested] [BOOL]
-doubleJump [Cloud in a Bottle effect] [BOOL]
-doubleJump2 [Blizzard in a Bottle effect] [BOOL]
-doubleJump3 [Sandstorm in a Bottle effect] [BOOL]
-doubleJump4 [Fart in a Bottle effect] [BOOL]
-drawAfterimage [Draws an afterimage of the player as he moves] [BOOL]
-drawAura [Draws an aura around the player] [BOOL]
-drawGlow [Sparkles the player, like Mythril armor] [BOOL]
-dripping [Water Gun debuff] [BOOL]
-drippingSlime [Slime Gun effect] [BOOL]
-eater [Untested, eater pet] [BOOL]
-editedChestName [Untested] [BOOL]
-endurance [Sets enemy damage with a multiplier, and setting it negative will NOT make them heal you] [FLOAT]
-enemySpawns [Battle potion effect] [BOOL]
-extraFall [Untested] [INT]
-eyeSpring [Untested, eyeball spring pet?] [BOOL]
-face [Assigns a face texture] [SBYTE]
-fallStart [Untested] [INT]
-fallStart2 [Untested] [INT]
-findTreasure [Spelunker effect, treasure glows in the dark] [BOOL]
-fireWalk [Ability to walk on meteorite and hellstone] [BOOL]
-fishingSkill [Sets your fishing power] [INT]
-flameRingRot [Untested] [FLOAT]
-flameRingScale [Untested] [FLOAT]
-flapSound [Untested] [BOOL]
-front [Untested] [SBYTE]
-frostArmor [Frost armor set bonus] [BOOL]
-frostBurn [Frostburn debuff] [BOOL]
-frozen [Frozen debuff] [BOOL] Do you wanna build a
-fullRotation [Rotation speed for whole body] [FLOAT]
-gem [Untested] [INT]
-gemCount [Untested] [INT]
-gfxOffY [Untested] [FLOAT]
-ghost [Turns the player into a ghost as if they died in hardcore, to undo remove effect from acessory/armor] [BOOL]
-ghostDir [Untested] [FLOAT]
-ghostDamage [Sets multiplier for damage done by Spectre Mask armor bonus] [FLOAT]
-ghostFade [Untested] [FLOAT]
-ghostHeal [Spectre Hood armor set, heal 1/10th of magic damage done] [BOOL]
-ghostHurt [Spectre Mask armor set, summons homing orbs that do damage] [BOOL]
-gills [Gills potion effect, unlimited breath underwater, limited breath above water] [BOOL]
-grapCount [Untested] [INT]
-gravControl [Control gravity with W] [BOOL]
-gravControl2 [Gravity globe effect, can only switch gravity after touching a surface] [BOOL]
-gravity [Sets a multiplier for player gravity, set to 0, jump, and never come back down] [FLOAT]
-greenFairy [Untested, green fairy bell pet?] [BOOL]
-grinch [Untested] [BOOL]
-gross [Stinky debuff] [BOOL]
-hair [Sets player's hairstyle] [INT]
-hairDye [Sets hair color] [BYTE]
-handoff [Untested] [SBYTE]
-handon [Untested] [SBYTE]
-hbLocked [Locks the hotbar] [BOOL]
-head [Assigns a helmet texture to player] [INT]
-headRotation [Sets a rotation speed for your head] [FLOAT]
-heldProj [Untested] [INT]
-honey [Increased life regeneration] [BOOL]
-hornet [Untested, hornet pet?] [BOOL]
-hornetMinion [Untested, hornet minion summon?] [BOOL]
-iceBarrier [Frozen Turtle Shell effect[
-iceSkate [Ice Skate ability or decreases ice slippiness, faster movement on ice, and falling on ice won't break it] [BOOL]
-ichor [-20 defense] [BOOL]
-ignoreWater [Mobility is not hindered underwater, but jumping underwater is much higher] [BOOL]
-immune [When set to true, you cannot be attacked, infinite Cross Necklace effect] [BOOL]
-immuneAlpha [Untested, immunity transparency?] [INT]
-immuneTime [Set how long you are invincible after being attacked] [INT]
-impMinion [Untested, imp minion summon?] [BOOL]
-invis [Makes the player invisible, armor is still visible and enemies can still see you] [BOOL]
-itemAnimation [Untested] [INT]
-itemAnimationMax [Untested] [INT]
-itemFlameCount [Untested] [INT]
-itemTime [Changes all items useTime's to a set value, the lower the faster] [INT]
-itemHeight [Untested] [INT]
-itemRotation [Untested] [FLOAT]
-itemWidth [Untested] [INT]
-jump [Set to 0 to reduce jumping, set to 1 to infinitely jump once in mid-air] [INT]
-jumpAgain [Untested] [BOOL]
-jumpAgain2 [Untested] [BOOL]
-jumpAgain3 [Untested] [BOOL]
-jumpAgain4 [Untested] [BOOL]
-jumpBoost [Shiny Red Balloon effect, increases jump range from 5 blocks to 8] [BOOL]
-jumpSpeedBoost [Modifies how fast you rise when you jump, and therefore jumping distance increases] [FLOAT]
-justJumped [When paired with any bottle accessories, infinite double jumping] [BOOL]
-killGuide [Can attack guide] [BOOL]
-killClothier [Can attack clothier] [BOOL]
-knockbackMeleeMod [Modifies how much knockback melee weapons deal] [FLOAT]
-knockbackMeleeModApplied [Untested] [BOOL]
-knockbackMod [Modifies how much knockback any weapon deals] [FLOAT]
-knockbackResist [Modifies how much knockback you take from mobs, the higher, the more knockback you take] [FLOAT]
-lastMouseInterface [Untested] [BOOL]
-lavaCD [Untested] [INT]
-lavaMax [Lava charm effect, makes you immune to lava for set time, 60 is one second, lava charm effect has this value as 420, if you want it to stack with that put p.lavaMax += INT] [INT]
-lavaImmune [Makes the player take no damage from lava] [BOOL]
-lavaRose [Modifies how much damage players take from lava] [FLOAT]
-lavaRoseApplied [Untested] [BOOL]
-lifeForce [Increases life by 20%] [BOOL]
-lifeMagnet [Increases pick-up range for life hearts to 22 blocks] [BOOL]
-lifeRegen [Modifies life regeneration] [INT]
-longInvince [Cross Necklace effect, doubled invicibility period after an attack] [BOOL]
-luckMax [Sets a multiplier for the max amount of money acquired from the Lucky Coin effect] [FLOAT]
-luckMin [Sets a multiplier for the minimum amount of money acquired form the Lucky Coin effect] [FLOAT]
-magicCrit [Sets the chance for magic weapons to crit, better as "p.magicCrit += INT"] [INT]
-magicCritMult [Sets a multiplier for how much damage a critical hit on a magic weapon does, default is 2f] [FLOAT]
-magicCuffs [Magic Cuffs effect, increases max mana by 20 and regens mana when hurt] [BOOL]
-magicDamage [Sets a multiplier for how much damage magic weapons deal] [FLOAT]
-magicQuiver [Magic Quiver effect, increases arrow damage and speed by 10%, and gives a 20% chance not to consume arrows] [BOOL]
-magmaStone [Magma Stone effect, varying fire effects from melee attacks] [BOOL]
-male [Sets gender to male permanently if true, sets gender to female permanently if false, can be changed with a buff like p.ghost] [BOOL]
-manaCost [Sets multiplier for how much mana magic weapons use up] [FLOAT]
-manaFlower [8% reduced mana usage and automatic drinking of mana potions, Mana Flower Effect] [BOOL]
-manaMagnet [Increases pick-up range for mana stars to 22 blocks] [BOOL]
-manaRegen [Modify mana regeneration] [INT] maxFallSpeed [Sets a multiplier for terminal velocity] [FLOAT]
-maxMinions [Use p.maxMinions += INT to add to the number of max minions] [INT]
-meleeCrit [Sets the crit chance for melee weapons, better as "p.meleeCrit += INT"] [INT]
-meleeCritMult [Sets a multiplier for how much damage a melee weapon does on a crit, 2f is default] [FLOAT]
-meleeDamage [Sets a multiplier for how much damage melee weapons deal] [FLOAT]
-meleeSpeed [Sets a multiplier for how fast you swing melee weapons] [FLOAT]
-minionDamage [Sets a multiplier for summoner minion damage] [FLOAT]
-moveSpeed [Sets a multiplier for player movement speed] [FLOAT]
-moveSpeedMax [Sets a multiplier for player top speed] [FLOAT]
nightVision [Night Vision buff] [BOOL]
-noFallDmg [Lucky Horseshoe effect, fall damage won't be an issue] [BOOL]
-noItems [Cursed effect, no items can be used] [BOOL]
-onHitDodge [Titanium Armor bonus, has a chance to activate Shadow Dodge upon hit] [BOOL]
-onHitPetal [Orichalcum Armor bonus, petals fly in and attack upon attack] [BOOL]
-onHitRegen [Palladium Armor Bonus, chance to regen health quickly upon hit] [BOOL]
-pickSpeed [Sets a multiplier for how fast pickaxes mine] [FLOAT]
-rangedCrit [Sets the chance for ranged weapons to crit, better as "p.rangedCrit += INT"] [INT]
-rangedCritMult [Sets a multiplier for how much damage ranged weapons do on a crit] [FLOAT]
-rangedDamage [Sets a multiplier for how much damage ranged weapons do] [FLOAT]
-rocketBoots [Set to 1 for Rocket Boots, 2 for Spectre Boots] [INT]
-rocketDamage [Sets a multiplier for rocket-based weapon damage] [FLOAT]
-rulerAcc [Ruler effect, makes everything a grid for easier building] [BOOL]
-scope [Ability to see off screen] [BOOL]
-slotsMinions [Sets multiplier for the amount of slots minions take, the lower the multiplier, the more minions] [FLOAT]
-slowFall [Feather-falling effect, press S to fall quicker] [BOOL]
-spikedBoots [Set to 1 for slide-down walls, Set to 2 for hang-on walls] [INT]
-starCloak [Star Cloak effect, stars fall down upon being damaged] [BOOL]
-statDefense [Use p.statDefense += INT to add to player's defense] [INT]
-statLife [Restrains life to that number, does not impact max] [INT]
-statLifeMax2 [Use p.statLifeMax2 += INT to add to player's max life] [INT]
-statManaMax2 [Use p.statManaMax2 += INT to add to player's max mana] [INT]
-thorns [Multiplies the damage enemies deal to you and deal it back upon contact, 0.3f for thorns potion and 1f for turtle armor effect] [FLOAT]
-tileRangeX [Sets how far you can mine horizontally] [INT]
-tileRangeY [Sets how far you can mine vertically] [INT]
-waterWalk [Lets you walk on water AND lava] [BOOL]
-waterWalk2 [Lets you walk on water, but not lava] [BOOL]
-zoneBlood [Makes game think you are in the Crimson] [BOOL]
-zoneDungeon [Makes game think you are in the Dungeon] [BOOL]
-zoneEvil [Makes game think you are in the Corruption] [BOOL]
-zoneHoly [Makes game think you are in the Hallow] [BOOL]
-zoneJungle [Makes game think you are in the Jungle] [BOOL]
-zoneMeteor [Makes game think you are in a Meteor Biome] [BOOL]
-zoneSnow [Makes game think you are in a Snow Biome] [BOOL]
 
For some reason melee crit is causing this
1640046323951.png

player.meleeDamage *= 1.18f;
player.meleeSpeed *= 1.14f;
player.moveSpeed *= 1.14f;
player.meleeCrit *= 1.14f;
Also, how do I make multiple recipes for an item?
 

Attachments

  • 1640046302203.png
    1640046302203.png
    209.2 KB · Views: 48
For some reason melee crit is causing thisView attachment 351726
player.meleeDamage *= 1.18f;
player.meleeSpeed *= 1.14f;
player.moveSpeed *= 1.14f;
player.meleeCrit *= 1.14f;
Also, how do I make multiple recipes for an item?
This should work for you!

You need to remove the f in player.meleeCrit *= 1.14f; and player.meleeCrit *= 1.14f; can not = a value with a decimal.

So this would not work: player.meleeCrit *= 1.14f;

But this would work: player.meleeCrit *= 2;
You can basically copy and paste the recipe you already made but for the second and any following recipes you will have to remove "ModRecipe" from "ModRecipe recipe = new ModRecipe(mod);"

Here is an example of multiple recipes:
C#:
public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod); //The first recipe must have ModRecipe at the beggining of recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddTile(TileID.Whatever);
            recipe.SetResult(this);
            recipe.AddRecipe();

            recipe = new ModRecipe(mod); //Recipes after the firt one should not
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddTile(TileID.Whatever);
            recipe.SetResult(this);
            recipe.AddRecipe();

            recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddTile(TileID.Whatever);
            recipe.SetResult(this);
            recipe.AddRecipe();

            recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddIngredient(ItemID.Whatever);
            recipe.AddTile(TileID.Whatever);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
 
Back
Top Bottom