#How can i create a modifier that feed from a kv file?

1 messages · Page 1 of 1 (latest)

lilac basin
#

Hi there!
This is a really noob question but i cannot figure it out, im trying to create a modifier and i want to feed the values OnCreated, this modifier is not linked with an ability is there a way to achieve that? Thanks a lot! ^^

proper iris
#

I typically prefer using non-KV files and instead setting up lua tables. Because it is not an ability, you are not forced to use KV and also don't get the benefits of KV (e.g. the very usefu GetAbilitySpecialValueFor func)

So instead you can just write a lua file that sets up modifier values, and you can require the file on the modifier file to have access to it.

#

It's a different approach but it should work

#

If you insist to work with KVs still, then you'll want the LoadKeyValues() function, which you pass the path to the KV file that you want to load, then it would be loaded into lua tables (which reinforces that the above approach is better, imo)

sonic solar
#

Using KV to store values purely for a modifier adds a step you dont need

lilac basin
#

thanks a lot! I really appreciate any help, Its kind of a weird modifier that get levels based on the type of heroes that you have near or on your team, if they have beard or if they are female for example, and based on the level (that number of teammates with that trait) the values are different, i got them working setting them up on the modifier but i want to be able to retrieve that information for the tooltip so i can explain whats going on, probably i need to get into panorama i dont really know xD

sonic solar
#

How many values do you need to display on the tooltip? Modifiers have 2 properties that can return custom number values to be used in the mosifier tooltip, plus you can use any of the normal number properties in the tooltip

lilac basin
#

yeah, i was able to use Tooltip1 and 2, but i did one that have like 5 values or so

#

i was like super happy because once you get into the api is incredible, in my mind if i created the files correctly i was going to be able to read the values, i was so mistaken xD

sonic solar
#

Well you werent mistaken, its just not parsed to the client

lilac basin
#

sorry for my english btw

sonic solar
#

Since the localisation is all done in engine, it only reads specific parts of the modifier, so its disjointed from the modifier class itself
What I mean is, the addon_language files dont have a direct reference to the class that its creating the tooltip for, it only has the values given via KV (for abilities) or values given via properties (for modifiers)

#

Which is why if you have a modifier.value, you cant display that in the tooltip using the addon_english file

lilac basin
#

yeah i was thinking of that, because with the properties and tooltip its a breeze so what you are saying have total sense now

sonic solar
#

You can use panorama to fix this and display whatever you want

lilac basin
#

ill check panorama them, hiding the modifiers and appling the icon and tooltip with panorama, time to learn... again xD