#Mana Regen Formula
1 messages · Page 1 of 1 (latest)
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?
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.
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
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.
Can't you create your own formula
baseValue = baseValue + baseValue*percent
then add it with constant mana regen bonus?
you could but why would you when there is already a total percentage property?
to do that you'd still need to make it custom anyway
I think this is what I want, mana_regen_multiplier
my guy did you even read what i wrote?
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
I'm not sure if I understand, it is being called, no?
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
ah, I see
its just a number that gets read by the code, it doesnt do anything on its own
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?
What do you mean with item passive?
Something like aeon disk or what?
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)
What do you mean with "trigger"?
Do you just want your item to give some stat(s)?
yes
- In
DeclareFunctionsyou declare which properties your buff modifies. - Then you implement the corresponding method.
For example MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT and GetModifierAttackSpeedBonus_Constant:
https://github.com/SteamDatabase/GameTracking-Dota2/blob/561016c193e08effce3d651e9fd7903893ae35fa/game/dota_addons/cavern/scripts/vscripts/modifiers/modifier_attack_speed_bonus.lua#L4
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...
is there any item in this example on github on npc_items_custom that applies this AS modifier?
thanks
@keen canopy highly recommend reading and following the tutorial by Elfansoer.
A repository for creating Dota 2 Lua abilities. Contribute to Elfansoer/dota-2-lua-abilities development by creating an account on GitHub.
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?
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.
Technically that naming scheme is just a valve convention and isn't required for custom items
That's actually wrong, Valve expectsitem_in the name, otherwise a bunch of functionalities break
which is absolutely dumb but at least it helps keep the convention so
¯_(ツ)_/¯
ah, I see, so basically any item functionality should have the item_ prefix
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.
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
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
What do mean with stat?
Do you mean the attributes? Then hero:GetStrength(), hero:GetIntellect()...
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
the percentage one is for percentage of mana, no?
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?
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
I think its that one:
MODIFIER_PROPERTY_MANA_REGEN_TOTAL_PERCENTAGE
and if I get multiple items it does like 0.8 + 0.4 + 0.4 + 0.4
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?
Nice!
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)
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
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
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
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.