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
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