tModLoader Accessory which inflicts debuffs (like fire gauntlet)

Skull Smasher

Terrarian
I'm currently making a mod which adds some new items to the game but I'm having trouble putting an item like the fire gauntlet in. I attempted to do this:
Code:
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
            {
                  target.AddBuff(BuffID.CursedInferno, 300);
            }
but it didn't work for some fairly obvious reasons in hindsight. Anyone know how I can accomplish this, though? I haven't been able to find any tutorials.
 
I don't know the answer but I can say this: that line of code is used for weapons. Example: Iron sword with that line of code will inflict cursed inferno for 5 seconds
 
The way those accessories work is that the accessory just sets a ModPlayer bool to true when equipped. The logic for what happens when you hit things in then handled in your modplayer class, in the right hooks for hitting NPCs / hitting NPCs with a projectile.
 
Back
Top Bottom