@@ 20,6 20,17 @@ Magicka Based Skill Progression - ncgdMW Compatibility Version
Original by HotFusion4, edited by me to work with ncgdMW.
http://www.nexusmods.com/morrowind/mods/44973/?
+* New in Version 3.3 *
+======================
+
+Attribute calculations have been changed in order to account for OpenMW storing
+attributes and skills as floats instead of ints.
+
+This would previously cause the "unexpected value" dialogue to display when it
+shouldn't have.
+
+Many thanks to Atahualpa for implementing the fix for this!
+
* New in Version 3.2 *
======================
@@ 4,6 4,8 @@ short doOnce
short counter
long temp
long temp2
+float floatTemp
+float floatTemp2
short attributeMult
short decayRate
@@ 3850,11 3852,28 @@ if (counter >= 3)
; Recalculate attributes, as needed
elseif (recalcSTR > 0) ; Checks if Strength needs to be recalculated
- ; Find base Strength
- set temp to player->getStrength
+ ; Find base Strength (floating-point value!)
+ set floatTemp to player->getStrength
player->setStrength 1000
- set temp2 to player->getStrength - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getStrength - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ ; Get the first decimal of the floating-point result
+ ; by multiplying the value by 10, converting it to an integer,
+ ; and using the (integer) formula: lastDigitOfN = N - N/10 * 10
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ ; Round the result depending on the first decimal
+ ; to get the actual base Strength
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
; Shows error message if base Strength is different from expected, but keeps running regardless
if (baseSTR != temp2)
@@ 3959,10 3978,22 @@ if (counter >= 3)
set recalcSTR to 0 ; Done checking Strength
elseif (recalcINT > 0)
- set temp to player->getIntelligence
+ set floatTemp to player->getIntelligence
player->setIntelligence 1000
- set temp2 to player->getIntelligence - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getIntelligence - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
if (baseINT != temp2)
if (recalcINT == 1)
@@ 4082,10 4113,22 @@ if (counter >= 3)
set recalcINT to 0
elseif (recalcWIL > 0)
- set temp to player->getWillpower
+ set floatTemp to player->getWillpower
player->setWillpower 1000
- set temp2 to player->getWillpower - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getWillpower - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
if (baseWIL != temp2)
if (recalcWIL == 1)
@@ 4201,10 4244,22 @@ if (counter >= 3)
set recalcWIL to 0
elseif (recalcAGI > 0)
- set temp to player->getAgility
+ set floatTemp to player->getAgility
player->setAgility 1000
- set temp2 to player->getAgility - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getAgility - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
if (baseAGI != temp2)
if (recalcAGI == 1)
@@ 4310,10 4365,22 @@ if (counter >= 3)
set recalcAGI to 0
elseif (recalcSPE > 0)
- set temp to player->getSpeed
+ set floatTemp to player->getSpeed
player->setSpeed 1000
- set temp2 to player->getSpeed - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getSpeed - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
if (baseSPE != temp2)
if (recalcSPE == 1)
@@ 4423,10 4490,22 @@ if (counter >= 3)
set recalcSPE to 0
elseif (recalcEND > 0)
- set temp to player->getEndurance
+ set floatTemp to player->getEndurance
player->setEndurance 1000
- set temp2 to player->getEndurance - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getEndurance - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
if (baseEND != temp2)
if (recalcEND == 1)
@@ 4536,10 4615,22 @@ if (counter >= 3)
set recalcEND to 0
elseif (recalcPER > 0)
- set temp to player->getPersonality
+ set floatTemp to player->getPersonality
player->setPersonality 1000
- set temp2 to player->getPersonality - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getPersonality - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
if (basePER != temp2)
if (recalcPER == 1)
@@ 4655,10 4746,22 @@ if (counter >= 3)
set recalcPER to 0
elseif (recalcLUK > 0)
- set temp to player->getLuck
+ set floatTemp to player->getLuck
player->setLuck 1000
- set temp2 to player->getLuck - 1000
- set temp2 to temp - temp2
+ set floatTemp2 to player->getLuck - 1000
+ set floatTemp2 to floatTemp - floatTemp2
+
+ set temp to floatTemp2 * 10
+ set temp2 to temp / 10
+ set temp to temp2 * 10
+ set temp2 to floatTemp2 * 10
+ set temp2 to temp2 - temp
+
+ if (temp2 > 4)
+ set temp2 to floatTemp2 + 1
+ else
+ set temp2 to floatTemp2
+ endif
if (baseLUK != temp2)
if (recalcLUK == 1)
@@ 5518,4 5621,4 @@ else
set counter to counter + 1
endif
-End NCGD_Main
+End NCGD_Main<
\ No newline at end of file