Calculating enchanted weapon value

Post » Sat Feb 19, 2011 2:57 am

I'm hoping that someone here will be able to help me out!
For some mod work I'm doing, I'm trying to figure out how to calculate the value of a weapon, including any enchantments. This is so I can properly value modded enchanted weapons!

With help from various sites I've been able to come close to the formula. So far I have:
Value of enchanted weapon = Value of base weapon + (((base enchantment cost) / 10 * (magnitude in pts) ^ 1.28 * (duration in sec) * (area in ft) * 0.45) + (number of charges) * 0.4)

For example: a Longsword of Storms (Daedric longsword with shock damage 20 pts and 1600 charges) is:
Value of weapon = Value of plain Daedric Longsword + (Shock Damage base cost of 7.8 ) / 10 * (20 pts) ^ 1.28 * (1sec duration) * (1ft) * 0.45) + (1600 charges) * 0.4
Value of weapon = 3100 + ((7.8 / 10 * 20 ^ 1.28 * 1 * 1 *0.45) + 1600) * 0.4
Value of weapon = 3746

So here's my problem. This formula almost gives the in-game value of 3754...it's off by a measly 8 gold. This formula's a little bit under for every enchanted weapon in fact. I don't think it's a rounding issue. Does anyone have any idea what I'm missing?
User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Sat Feb 19, 2011 1:25 am

The formula for determining the value of an enchantment can be found http://www.uesp.net/wiki/Oblivion:Enchanting#Value_of_Enchanted_Items
User avatar
Paula Rose
 
Posts: 3305
Joined: Fri Feb 16, 2007 8:12 am

Post » Sat Feb 19, 2011 2:50 am

The formula for determining the value of an enchantment can be found http://www.uesp.net/wiki/Oblivion:Enchanting#Value_of_Enchanted_Items


Yep, UESP is the primary source I used for this. I just can't figure out where the VERY small discrepancy is coming from, and UESP at least doesn't address it..
User avatar
Mark Hepworth
 
Posts: 3490
Joined: Wed Jul 11, 2007 1:51 pm

Post » Sat Feb 19, 2011 12:57 pm

UESP has repeatedly disappointed me in the math department. Frequently their formulas appear to be based only on in-game observations, with no game setting experimentation.

The full formula for determining the autocalc value of a magic effect is:

EffectBaseCost * fMagicDurMagBaseCostMult * (MAGNITUDE ^ fMagicCostScale) * (AREA * fMagicAreaBaseCostMult) * (DURATION)

Target-range spells are further multiplied by fMagicRangeTargetCostMult.

If any of the three clauses in parentheses is less than 1, discard it. This is especially relevant to AREA. Furthermore, the final value of the effect is truncated to an integer (i.e., always rounded down).

By default:
fMagicDurMagBaseCostMult = 0.1
fMagicCostScale = 1.28
fMagicAreaBaseCostMult = 0.15
fMagicRangeTargetCostMult = 1.5

For your enchantment, the outcome of this calculation would be:

7.8 * 0.1 * (20 ^ 1.28) * (1 * 0.15) * (0) =
0.78 * (46.272) * (0.15) * (0)
Area and Duration are less than 1, and discarded.
0.78 * 46.272 = 36.09, truncates to 36.

To find the gold value of an enchanted weapon, the value above is multiplied fEnchantmentEffectPointsMult, default 0.4. (NOT 0.45!) As above, this is truncated. Then, the current charges of the weapon are multiplied by fEnchantmentPointsMult, default 0.4, result once again truncated. The Points and EffectPoints values are added together, then added to the value of the weapon.

36 * 0.4 = 14.4, truncates to 14.
1600 * 0.4 = 640.

640 + 14 + 3100 = 3754.
User avatar
Jack Bryan
 
Posts: 3449
Joined: Wed May 16, 2007 2:31 am

Post » Sat Feb 19, 2011 12:29 pm

Or, if you use OBSE, just use GetFullGoldValue.
User avatar
jessica robson
 
Posts: 3436
Joined: Mon Oct 09, 2006 11:54 am

Post » Sat Feb 19, 2011 7:10 am

Or, if you use OBSE, just use GetFullGoldValue.


Perfect! Thank you both. It looks like my only mistakes were the 0.45 factor, and checking to see if Area was >= 1 BEFORE it was multiplied by 0.15. Once I made those corrections then everything matched up as it should!
User avatar
Katie Samuel
 
Posts: 3384
Joined: Tue Oct 10, 2006 5:20 am

Post » Sat Feb 19, 2011 11:04 am

I think you were also multiplying the value of the effect by the 0.4 factor for charge, whereas they're actually two completely separate values added independently to the item's price.

But anyway, if this is for script purposes, yeah... Waruddar's got the easy answer. ;)
User avatar
Matt Bee
 
Posts: 3441
Joined: Tue Jul 10, 2007 5:32 am

Post » Sat Feb 19, 2011 1:14 pm

Yeah, I'm starting to think I should just use Warudder's approach!

Even with the above, I'm still missing something. The formula corrections we've talked about so far fixed the Daedric longsword example, but there's still a lot of weapons off by just 1 or 2 gold. For example:

Warhammer of Feeding (Ebony Warhammer with Absorb Health 4pts for 4sec):
= 2800 + integer( 0.4 * 16 EffectBaseCost * 0.1 * 4pts ^ 1.28 * 4sec) + integer ( 0.4 * 1600 charges)
= 2800 + integer( 2.56 * 4 ^ 1.28) + 640
= 2800 + 15 + 640
= 3455

Unfortunately, a Warhammer of Feeding is worth 3854, a pitiful 1 gold difference. This happens on 50 or so of the Vanilla weapons when the above formula is applied - some are 1 over, some are 1 under, most are spot on.

I thought at first that this might be due to Oblivion only carrying 1 or 2 decimal places through the calculation--that is, rounding while calculating--but I can't seem to get that to fix the problem either. Any suggestions?
User avatar
Catherine Harte
 
Posts: 3379
Joined: Sat Aug 26, 2006 12:58 pm


Return to IV - Oblivion