Providing Help for Accessories

I knew some of the accessory codes from a TConfig guide still work and I was wondering the same thing about this. Sorry if I annoyed you
The reason that these codes still work is because some of the codes that this guide uses are from the base game itself, for example, player.statLife is a poperty from the base game's player class and its instance variable of statLife, which is an int. A difference between tAPI and tModLoader is how the hooks are constructed.
 
I know this is an accessories help thread but I need help making a vanity mask that goes a layer behind the hair its self. Like how the mime mask gets covered by what ever hair you have.
 
i tried making an accessory and i got this error:
Code:
c:\Users\Owen\Documents\My Games\Terraria\ModLoader\Mod Sources\swordmod\Items\Accessories\WitheredSkull.cs(9,7) : error CS0246: The type or namespace name 'TAPI' could not be found (are you missing a using directive or an assembly reference?)
can you tell me how to fix it?
 
I see various bonuses for melee, ranged, magic, and minion damage, but nothing for "throwing" damage!? How do I make an accessory that tweaks the amount of throwing damage a grenade or other thrown weapon does?
 
I see various bonuses for melee, ranged, magic, and minion damage, but nothing for "throwing" damage!? How do I make an accessory that tweaks the amount of throwing damage a grenade or other thrown weapon does?
Um, so.

This was made for tAPI.
tAPI was made for 1.2.
1.2 throwing weapons had ranged damage.
It's also probably an inaccurate guide because of that, too.
 
I have a problem with double jumping here is my code

public override void UpdateAccessory(Player player, bool hideVisual = false)
{
player.noFallDmg = true;
player.jumpSpeedBoost = 28;
player.jumpBoost = true;
player.canCarpet = true;
player.autoJump = true;
player.justJumped = true;
player.doubleJump = true;
player.doubleJump2 = true;
player.doubleJump3 = true;
player.doubleJump4 = true;
player.balloon;
}

can anyone help me

the error:
<br class="Apple-interchange-newline"><div></div>

3411/5000

c: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ TheGalacticaMod.cs (13,7): warning CS0105: The instructions for use for Terraria.ModLoader have previously appeared in this namespacec: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ TutorialWorld.cs (13,7): warning CS0105: The user instructions for System.IO have previously appeared in this namespacec: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ TutorialPlayer.cs (18.21): warning CS0114: TheGalacticaMod.TutorialPlayer.ResetEffects () hides the inherited member Terraria.ModLoader.ModPlayer. ResetEffects (). To allow the current member to override this implementation, add the Override keyword. Otherwise, add the keyword New.c: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ TutorialPlayer.cs (27,30): warning CS0672: Member TheGalacticaMod.TutorialPlayer.SetupStartInventory (System.Collections.Generic.IList <Terraria. ) overschrijft verouderd lid Terraria.ModLoader.ModPlayer.SetupStartInventory(System.Collections.Generic.IList).">Item>) overrides obsolete member Terraria.ModLoader.ModPlayer.SetupStartInventory (System.Collections.Generic.IList <Terraria.Item>). ). ">Add the Obsolete attribute to TheGalacticaMod.TutorialPlayer.SetupStartInventory (System.Collections.Generic.IList <Terraria.Item>).c: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ Items \ Accessories \ HardMode \ TechnicBalloon.cs (41,20): error CS1061: Terraria.Player does not contain a definition for doubleJump and there is no definition for doubleJump. no doubleJump extension method was found to accept the first Terraria.Player type argument (there may be a usage statement or an assembly reference missing)c: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ Items \ Accessories \ HardMode \ TechnicBalloon.cs (42,20): error CS1061: Terraria.Player does not contain a definition for doubleJump2 and there is no extension method doubleJump2 found to accept the first Terraria.Player type argument (there may be a usage statement or an assembly reference missing)c: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ Items \ Accessories \ HardMode \ TechnicBalloon.cs (43,20): error CS1061: Terraria.Player does not contain a definition for doubleJump3 and there is no definition no extension method doubleJump3 found that accepts the first argument of the Terraria.Player type (there may be a usage statement or an assembly reference missing)c: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ Items \ Accessories \ HardMode \ TechnicBalloon.cs (44,20): error CS1061: Terraria.Player does not contain a definition for doubleJump4 and there is no extension method doubleJump4 found that accepts the first argument of the Terraria.Player type (there may be a user manual or assembly reference missing)c: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ Items \ Accessories \ HardMode \ TechnicBalloon.cs (45,13): error CS0201: Only expressions for commands, calls, elevations, decreases, wait and new objects can be used as instructionc: \ Users \ User \ Documents \ My Games \ Terrarium \ ModLoader \ Mod Sources \ TheGalacticaMod \ NPCs \ PreHardmodeMobs \ SnowMan.cs (109,13): warning CS0162: Unreachable code has been detected

note: google translate switcht Terraria with Terrarium
 
I have noticed a lack in interest in the accessories part of Terraria modding. Doesn't it get tiring just creating weapons all day, every day?
Where is the Gravity Coil Mod? Where is the Backpack Mod? Not in the weapons section. So I have a big list of effects I have tested and am sure work.
If one does not work for you, don't hesitate to tell me and I will look into it. So without further ado,

ALL THE VARIOUS PLAYER EFFECTS​
These are all the player effects that can be added to accessories and armor. Some have changed from bools to floats to make some effects more interesting. If you have no idea what I just said, here is a key to help you.
-------------------------------------------------------------------
INT = Integer (Numerical value, e.g. p.breathMax = 400)
BOOL = Boolean (True or False, e.g. p.ignoreWater = true)
FLOAT = Float (Multiplier, e.g. p.meleeDamage = 2f)
--------------------------------------------------------------------
-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]
END OF EFFECTS LIST​


Some people learn better by example rather than by information. Here is an example of an accessory CS file:
Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace InternalModName.Items //replace InternalModName with the internal name of your mod
{
   public class ItemName : ModItem //replace ItemName with the name of your accessory
   {
  public override void Effects(Player p) //Where it says "p" is the variable used to represent "player". In this case, every p stands for player. This is called when the accessory is on.
     {
       p.noFallDmg = true;  //This is where an effect from the list goes.
     }
    public override void DamageNPC(Player p, NPC n, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult) //This is called when the player attacks an NPC
     {
       p.statLife += 5; //any effect goes here, this gives the player 5 life upon attack of any NPC
     }
     public override void DamagePlayer(NPC n, Player p, int hitDir, ref int damage, ref bool crit, ref float critMult) //This is called when the player is damaged by an NPC
     {
       p.panic = true; //This would give the player the panic buff when hit by the NPC
     }
   }
}

There are probably simpler ways of performing some things in this list (like putting "defense": 6 into the JSON rather than p.statDefense += 6)
And some effects are missing because they can be obtained through the p.AddBuff method.
Next up is creating a projectile / dust. Make sure that if it isn't using a statement that restricts firing speed of this projectile, that it's timeLeft is extremely low, or it will cause lag.
Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using TAPI;
using Terraria;

namespace InternalModName.Items
{
    public class ItemName : ModItem
    {
        public override void Effects(Player p)
        {
            if(p.statLife <= (int)p.statLifeMax/5) //If life is less than 1/5th of max...
            {
                if (Main.rand.Next(250) == 0) //On a 1/250 chance every tick, it'll spawn a projectile (to prevent lag)
                {
                    Projectile.NewProjectile(p.position.X, p.position.Y, 0f, 0f, ProjDef.byName["InternalModName:ProjectileName"].type, 5, 0f, p.whoAmI, 0f, 0f); //Parameters are in this order: (Projectile Origin Position X Coordinate, Projectile Origin Position Y Coordinate, Speed in the X Direction, Speed in the Y Direction, Projectile ID or name, Damage, Knockback, unknown Vector2, unknown float, unknown float)
                    Dust.NewDust(p.position.X, p.position.Y, 0f, 0f, Dust ID,
                }
            }
        }
    }
}
This can also be added into other hooks, such as DamagePlayer and DamageNPC to spawn a projectile when you hit an NPC or get hit.



This is very helpful, examples are much better for my small monkey brain. How would I go around making an accessory hurt enemies around me? Likw when they hit my character it will hit them back? I want to make an accessory that has very high knockback but low damage so it will keep enemies off you so you don't get swarmed. This accessory will be for a supportive team based tank build.
Have fun creating accessories!
 
Greetings i'm new here. I'm working on my first big mod and was curious as i could not make it work on my own. how would i go about making an accessory heal the player if said player had a specific debuff? any help would be appreciated as I've hit a wall.
 
Greetings i'm new here. I'm working on my first big mod and was curious as i could not make it work on my own. how would i go about making an accessory heal the player if said player had a specific debuff? any help would be appreciated as I've hit a wall.
I can actually help if you are still working on said mod
 
Well, this was useful but I did some testing and got lazy. So i'll put my finds here.

Some Armor set effects from the base terraria can be triggered as long as you know the effect name.
 

Attachments

  • effects.txt
    19.4 KB · Views: 111
Back
Top Bottom