tModLoader I'm trying to have an accessory give more regen but I am stuck

AvergeAxis

Terrarian
I've been trying to get an accessory to give more regen but I cant figure it out
 
This is the code to the accessory that I am trying to implement to have more Regen


using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.Creative;

namespace TheCookieMod.Items.Accessories
{
public class Lring : ModItem
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Cookie Ring");
// Tooltip.SetDefault("5% increased CookieDamge");
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
}

public override void SetDefaults()
{
Item.width = 28;
Item.height = 28;
Item.accessory = true;
Item.rare = 4;
Item.value = Item.buyPrice(gold: 2);
}

public override void UpdateAccessory(Player player, bool hideVisual)
{
player.AddBuff(BuffID.Shine, 2);
player.moveSpeed += 0.2f;
player.GetDamage(ModContent.GetInstance<CookieDamage>()) += 0.1f;
player.liferegen += 0.3f;
}

public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ModContent.ItemType<Items.Placeables.VanillaOre>(), 3);
recipe.AddIngredient(ItemID.LightShard, 1);
recipe.AddTile(TileID.Furnaces);
recipe.Register();
}
}
}
 
Use the UpdateLifeRegen hook on ModPlayer instead. Have your accessory set a modplayer bool to true, then check that in the hook and increase life regen if it's true.
 
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.AddBuff(BuffID.Shine, 2);
player.moveSpeed += 0.2f;
player.GetDamage(ModContent.GetInstance<CookieDamage>()) += 0.1f;
player.liferegen += 0.3f;
}
Use the UpdateLifeRegen hook on ModPlayer instead. Have your accessory set a modplayer bool to true, then check that in the hook and increase life regen if it's true.
Does the method the user tried only apply for 1/60 seconds after entering the world then resetting the regen stat?
 
how would i do that im somewhat new at coding
 
nvm thank you
 
Back
Top Bottom