How would I make a weapon apply a buff? (solved)

Lewjar6

Official Terrarian
I have created a custom buff and I would like to make my weapon apply it to the player on alt function.
It isn't applying the buff and I made a separate item to test if the buff is the problem, but that applied it so I'm not sure what I'm doing wrong.
This is my code for the alt function:
public override bool AltFunctionUse(Player player)
{
return true;
}


public override bool CanUseItem(Player player) {
if (player.altFunctionUse == 2) {
Item.UseSound = SoundID.Item12;
Item.useTime = 100000;
Item.damage = 100000;
Item.useAnimation = 20;
Item.shootSpeed = 50f;
Item.shoot = ProjectileID.CultistRitual;
Item.useStyle = ItemUseStyleID.HoldUp;
Item.buffType = ModContent.BuffType<Items.Empowered>();
Item.buffTime = 5400;
}
else {
Item.UseSound = SoundID.Item1;
Item.damage = 1048;
Item.shoot = ModContent.ProjectileType<EnergySlice>();
Item.useTime = 15;
Item.shootSpeed = 20f;
Item.useAnimation = 15;
Item.useStyle = ItemUseStyleID.Swing;
Item.buffTime = 0;
}
return base.CanUseItem(player);
}
Thanks
 
Use the Player.AddBuff() Method to add a buff to the Player. In your case, use: player.AddBuff(ModContent.BuffType<Items.Empowered>(), 5400); when you do the alt use.
 
Thanks ive been looking everywhere for this lol
 
Back
Top Bottom