This is a bit of a (long-winded) long shot, not sure if anyone is willing to help me with this issue, since I know a lot of us don't like math too much. But I'll post it here anyway, since I have spent too many hours trying to figure this out, and perhaps one of you might be patient or intrepid enough to try and help me out.
I am trying to figure out the formula used by the game to calculate the "total charges" granted to new player-enchanted weapons, or technically the amount of charges those weapons consume per hit, depending how you want to look at it (the latter is the value actually used by the game)
When you enchant a weapon using a grand soul gem, the weapon has a total "charge" of 3000 (you can type player.getavinfo rightitemcharge into the console to see this while wielding the weapon if you want). The weapon will consume a standardized amount of that 3000 charges per hit. So for instance, if it consumes 30 charges per hit, the game will tell you the weapon has 100 charges when you're crafting it at the enchanting table.
Why do I care, you ask? Well, to spare you some of the gorey details, basically, there's a really annoying bug that causes all enchanted items to consume much more charges and have their price quite heavily inflated after you save and reload the game from the desktop. I'm hoping to release a fix for this via SKSE plugin (and its mostly working already), but due to other ridiculous game engine tomfoolery, I need to be able to reverse engineer the formula used to calculate charges if I want it to work as accurately as it should for some particular enchantments.
The current formula posted on the UESP wiki is:
charges per use = 3 * (base enchantment cost * magnitude / maximum magnitude)1.1 * skill cost multiplier
where skill cost multiplier = 1 - sqrt(enchantment skill level/200)
This formula gives rough estimates of the charges created, but it is not really accurate. The results from the formula seem to vary +/- 5 the actual value of charges per use. After several hours of trying to figure out a proper formula, I have a strong suspicion the problem lies in the skill cost multiplier part of the equation. The part raised to the 1.1 power seems to be confirmed by the data, since it is always proportionately accurate.
In any case, if you've read this far, I'm already surprised. If anyone could come up with the formula you would have my eternal gratitude.
Here's a ton of test data I compiled, all from using frost damage enchantments on an iron dagger, at various enchanting levels and magnitudes. for Frost Damage, "base enchantment cost" equals 13, as seen in the C.K.
FROST DAMAGE ENCHANTMENT applied to an iron daggerlevel mag/max value charge use total charges----- ------- ----- ---------- -------------100 31/31 466 12.71 236100 30/31 466 12.24 245100 26/31 450 10.49 286100 24/31 442 9.58 313100 20/31 426 7.85 382100 16/31 418 6.13 489100 10/31 394 3.66 820100 8/31 386 2.86 1048100 4/31 378 1.33 2248 50 26/26 538 21.74 138 50 25/26 530 20.83 144 50 20/26 498 16.30 184 50 15/26 458 11.85 253 50 13/26 450 10.14 296 50 10/26 426 7.58 396 50 5/26 394 3.53 849 40 25/25 602 30.00 100 40 20/25 554 23.44 128 40 15/25 506 17.05 176 40 10/25 450 10.91 275 40 5/25 410 5.09 589 20 25/25 658 37.04 81 20 20/25 594 29.13 103 20 15/25 538 21.13 142 20 10/25 474 13.51 222 20 5/25 418 6.30 476NOTES: - "level" == my character's enchanting level when I made these enchantments - "mag/max" == magnitude I chose while enchanting the effect, vs the maximum possible magnitude I could have chosen (max possible value is important for the formula, it seems) - "value" == gold value of the item, the actual value of the enchantment would be this value minus 10 (since the iron dagger I enchanted these onto is worth 10 gold) - "charge use" is just calculated by taking (3000 / total charges) - 3000 is the amount of total charge capacity granted to a weapon when you use a grand soul gem (as I did here). Technically the game truncates the decimal remainder from this for newly enchanted items, and they consume a whole number of charges each hit.