My mod is 99% done, but I'm stuck - Argh!

Post » Sat May 28, 2011 9:32 am

I have to admit I'm pretty frustrated by this point.
I released a mod some time ago called "BFG's Armor Health Scales Enchantments". Basically, the mod changes the strength of enchantments on armor based on the health (condition) of the armor.
Unfortunately, I learned through in-game testing that my old method doesn't always work. I've completely revamped the approach to correct this problem but, after 8 hours of work, I can't seem to overcome the final obstacle!


OLD METHOD:
I used GetNthActiveEffectEnchantObject and SetNthActiveEffectMagnitude to search through the Active Effects on the player (the magic effects displayed on the last tab of the Magic Menu) and modify the armor-specific enchantments. Unfortunately, even though the Active Effects page would update with the new magnitude, the new magnitude often didn't actually work. For example, if I modified a piece of armor that gives Resist Magic 20% to Resist Magic 50%, the Active Effects would say 50%, but it would only block 20% in-game.


CURRENT METHOD:
I am using SetNthEffectItemMagnitude to directly change the magnitude on the armor (the armor wasn't touched in the old method). The magnitude (as displayed in that armor's enchantments list in inventory) does change. For example, the piece of armor mentioned above does read Resist Magic 50% when I select it in inventory. But the Active Effect page does not update, and the game still only uses Resist Magic 20% (the old magnitude).

But unequipping and reequipping the armor does update the Active Effects page, and also causes the game to use Resist Magic 50%. In other words, the game apparently only looks at armor enchantments at the moment it's equipped.


HYBRID APPROACH:
I also tried changing the magnitudes both on the armor directly, and in the player's Active Effects. That didn't work consistently, unfortunately.




THE PROBLEM:
Since the game normally only updates enchantments when armor is equipped, I have to find a way either (1) to force the armor to unequip and reequip in a way that is invisible to the player, or (2) force the game to update the player's Active Effects at times other than when the armor is equipped.

I've tried the first approach, with the following commands:
Player.UnequipItem ArmorObj
Player.EquipItem ArmorObj
The armor does unequip but then it fails to reequip. (I get a "This enchanted item cannot be equipped right now" message.)

And I have no idea how to do the second approach.


Any help is appreciated! This is the only thing I need to work out before I can release the mod! Thanks in advance.
User avatar
Shaylee Shaw
 
Posts: 3457
Joined: Wed Feb 21, 2007 8:55 pm

Post » Sat May 28, 2011 4:03 am

Well, I think I figured it out. I set the script up so that the game would way until the next GameMode frame to reequip the armor. That seems to work well enough. Unfortunately, it also plays the "equip armor" sound every time, which is rather annoying. Any answers to the above questions, or suggestions on how to prevent the "Equip Armor" sound from playing, would be appreciated!
User avatar
Sunnii Bebiieh
 
Posts: 3454
Joined: Wed Apr 11, 2007 7:57 pm

Post » Sat May 28, 2011 3:27 pm

Maybe have it play your own sound, i think that should over ride it, it does it with magic anyway. Just use a mini soundless sound, but first test with any other sound first.

Someone else might come up with a better idea maybe
User avatar
Cartoon
 
Posts: 3350
Joined: Mon Jun 25, 2007 4:31 pm


Return to IV - Oblivion