#Mana Regen Formula

1 messages · Page 1 of 1 (latest)

cyan harbor
keen canopy
#

so for example, if I want to add % mana regen on ability values of items, all I have to do is bonus_mana_regen_percentage?

cyan harbor
#

you cant change the functionality of valves existing items/abilities, only number changes and settings in the ability kv.
you'd have to remake them custom.

keen canopy
#

what I mean for example is that I already changed the values in a lot of the item stats in the game

#

I also removed some actives

#

I was just wondering if there's a value for % mana regen

cyan harbor
#

if you mean in the ability's abilityvalues or specialvalues then thats entirely dependent on the ability.
there arent any magic keys there, the keys are just whatever valve happened to name them for that ability.
if you just added "bonus_mana_regen_pecerntage" "1" when it wasnt previously there then it would never be read by anything.

radiant ermine
#

Can't you create your own formula

baseValue = baseValue + baseValue*percent

then add it with constant mana regen bonus?

keen canopy
#

this is for kaya

cyan harbor
keen canopy
#

I think this is what I want, mana_regen_multiplier

cyan harbor
#

if you just slap mana_regen_multiplier on an ability that doesnt read it in the code its not going to be read by anything

keen canopy
#

I'm not sure if I understand, it is being called, no?

cyan harbor
#

these abilityvalues keys are not standardized. it could be called "potato" by valve and still work for mana regen amp if they used it for that

#

just because this key used in Kaya is named "mana_regen_multiplier" doesnt mean you can use that anywhere. the ability needs to specifically call ability:GetSpecialValueFor("mana_regen_multiplier") for it to be read

keen canopy
#

ah, I see

cyan harbor
#

its just a number that gets read by the code, it doesnt do anything on its own

keen canopy
#

I've been watching / reading documentation for about 3 hours now, I think I understand

#

I understand how to make triggers with abilities, but how do I "trigger" something that is an item passive?

crude lotus
keen canopy
#

something that is just a base stat, always there

#

like, let's say I want to use kaya's mana regen modifier as a base stat onto the item

#

how do I make it trigger?

#

can also think of adding armor to ring of basilius' aura as well

#

(sorry if this is annoying btw, it's my first time working with it)

crude lotus
#

What do you mean with "trigger"?
Do you just want your item to give some stat(s)?

keen canopy
#

yes

crude lotus
#

Your item just needs to apply that modifier.
With GetIntrinsicModifierName for buffs that should be applied as long the unit has the ability/item.
Or with AddNewModifier...

keen canopy
#

is there any item in this example on github on npc_items_custom that applies this AS modifier?

keen canopy
#

thanks

vocal topaz
keen canopy
#

is there anything that I'm missing?

cyan harbor
#

Looks right to me.
Are there any errors in the console?
Do you see the modifier on the buff bar?
Is that Sage's Mask actually the correct item?

#

And did you try spending mana so you arent at 100% mana?

crude lotus
#

The class name in the lua file must be equal to the kv ability/item name.
Including the item_ at the start.

Technically that naming scheme is just a valve convention and isn't required for custom items.

vocal topaz
#

Technically that naming scheme is just a valve convention and isn't required for custom items
That's actually wrong, Valve expects item_ in the name, otherwise a bunch of functionalities break

#

which is absolutely dumb but at least it helps keep the convention so

#

¯_(ツ)_/¯

keen canopy
#

ah, I see, so basically any item functionality should have the item_ prefix

vocal topaz
#

Yeah. But regardless of that, you must have the name of the thing you define in KV be exactly the name of the function.

If your KV looks like this:

"my_amazing_ability_bro" {
   ... // stuff in KV
}

Then your lua must be:

my_amazing_ability_bro = class({})

function my_amazing_ability_bro:OnSpellStart() 
   -- things that happen once the ability is cast
end

function my_amazing_ability_bro:GetIntrinsicModifierName() 
    -- intrinsic modifier name
end

function my_amazing_ability_bro:GetManaCost()
    -- mana cost
end

The importan part is the first part of the function name must be the same as the KV, e.g. my_amazing_ability_bro in this case.

keen canopy
#

but isnt it like that already

#

or am I stupid

vocal topaz
#

No, your KV is "item_sobi_mask_584" and your code is sobi_mask_584 = class({})

#

your code needs to match the KV perfectly

#

I usually just copy paste so it's never an issue

keen canopy
#

ah wait I am dumb

#

yeyeye now it works

#

thank you <3

#

what is the function to retrieve a stat from my own hero?

#

I'm trying to do something like this

crude lotus
#

What do mean with stat?
Do you mean the attributes? Then hero:GetStrength(), hero:GetIntellect()...

keen canopy
#

ah, the problem is that my hero has 0 mana regen

#

I think mana regen from attributes doesnt count towards base mana regen

#

self:GetParent():GetManaRegen()

#

if I do like this it works

keen canopy
#

the percentage one is for percentage of mana, no?

crude lotus
#

What do you want to do exactly?
Do you want to give a flat amount of mana regen, a percentage mana regen, or amplify the mana regen?

keen canopy
#

I want to amplify the base mana regen

#

so for example if I have 0.8 mana regen, and I purchase an item that gives 50% mana regen

#

I want it to take this 0.8 and turn into 0.8 + 0.4

crude lotus
#

I think its that one:
MODIFIER_PROPERTY_MANA_REGEN_TOTAL_PERCENTAGE

keen canopy
#

and if I get multiple items it does like 0.8 + 0.4 + 0.4 + 0.4

crude lotus
#

Or that one:
MODIFIER_PROPERTY_MP_REGEN_AMPLIFY_PERCENTAGE

#

Seems more likely

keen canopy
#

why would they make it mp_regen

#

kek

#

naming conventions

#

it works only for the first item

#

I guess the problem is that I should make it stackable?

keen canopy
#

okay it works

#

I just did this

#

I'm so happy

vocal topaz
#

Nice!

keen canopy
#

what's the modifier for %health regen?

#

I'm assuming health regen has an equivalent to the % mana regen one that sage mask used to have

#

sage mask used MODIFIER_PROPERTY_MP_REGEN_AMPLIFY_PERCENTAGE

#

but for some reason MODIFIER_PROPERTY_HP_REGEN_AMPLIFY_PERCENTAGE doesn't give me the same results

#

value keeps diminishing by half

#

whereas MP_REGEN allows me to freely stack

#

(their classes are the same, all I changed was the modifier)

keen canopy
#

I assume that has something to do with the modifier itself because presumably some modifiers are dimishing and others are constant

#

so then the question becomes how do I turn that modifier flat

red timber
#

Specify more directly what you want by "health %" because there is:

  • health regeneration based on max health
  • health regeneration (flat)
  • health regeneration amplify
  • healing amplify
  • lifesteal amplify
  • whatever they added after that
keen canopy
#

I want to increase my health regen by a % of my base health regen

#

so for example if I have 3.0 health regen and my item has 50% health regen bonus it becomes 4.5, if I get 2 of these items I get 6.0, 3 items -> 7.5 and so forth

#

but currently for each item that I get the regen is halved

red timber
#

This will be harder than just using built in valve property because each source stacks with dimishing returns and have a cap

#

Health Regen Manipulation
Health regen manipulation affects all Health regeneration of a unit. All sources of health regen manipulation - whether incoming or outgoing - stack diminishingly, and have a higher and lower limit of 100% and -100% respectively.