Talk:ModActorValue2

Active discussions

I am hearing rumours that modAV2 does not work as advertised, particularly for NPC's, and should be avoided in mods to prevent compatibility problems, particularly with leveling mods. These rumours sound totally unfounded to me and I have never experienced any problems with modAV2. Can we dispell these rumors, or is there some real basis for them? Example rumor thread here. -- ABO 06:26, 13 February 2009 (EST)

I think they're referring to ModAV, not ModAV2.
Dragoon Wraith TALK 13:56, 13 February 2009 (EST)
I think I've found the root of these rumors. There are some funnys around how modAV2 works on actors other than the player. For fatigue, it always works exactly as advertised. For other attributes you can modAV2 them way past their max, but any following modAV2 will reset them back to their max, This means "modAV2 health 1000" on an actor with health 200 and healthMax 256 will boost health to 1200, but then doing "ModAV2 health <N>" with any value of N will reset health back to 256. This means you should do "ModAV2 <attribute> 0" after "ModAV2 <attribute> 10000" if you want to set the attribute to it's max. This behaviour also applies to encumbrance, and extra encumbrance is like burden and counts as "wornWeight" that will slow movement. In theory this strange behavior could be exploited in mods to apply temporary attribute/encumbrance "boost" effects, but the "reset to max on next modAV2" means that it could only be used by one mod, as its effects would be reset by any other mod attempting to use this technique. -- ABO 21:19, 5 August 2009 (EDT)

Getting and Modifying AttributesEdit

The following is something I posted on the forums that probably deserves a more permanent record. Feel free to move this somewhere else if this is not the right place -- ABO 21:38, 5 August 2009 (EDT)

Thought I'd throw in my 2c; there are several different layers that contribute to an attribute;

  1. base + ability modifications = getBaseAV, changed by setAV. Scripts can find out the total combined magnitude contributed by abilities. You should only use setAV for "permanent effects", and in some cases it's probably better to use AdvancePCSkill as described in http://cs.elderscrolls.com/constwiki/index...:AdvancePCSkill
  2. "drain/fortify" modifications to the base by modAV or drain/fortify spells. These adjust the maxium value the attribute can be restored to by heal/restore spells. Scripts can find out the combined magnitude of these applied by spells, but it's not easy to find out the combined modAV effects. This is for temporary but unhealable damage or fortify effects.
  3. "damage/restore" modifications on top of the base and "drain/fortify" modification done by "damage/restore" spells or modAV2. These cannot restore an attribute beyond it's 1)+2) value. These damage/heal changes by spells (or modAV2) are effectively instantaneous so its not meaningful to talk about how much is applied by spells vs modAV2.

getAV returns the combination of 1)+2)+3). You can find out the total fatigue damaged and modAV drained by doing the following. You can do this with any attribute, but you'll need to modify the OBSE spell effect function calls appropriately.

 ; Get the current fatigue. set fatigue to getAV fatigue  ; "Heal" all the type 3) damage to take it out of the equation and workaround the strange modAV2 behavior for NPCs. modAV2 fatigue 10000 modAV2 fatigue 0  ; Get the current max you can heal fatigue up to. set fatigueMax to getAV fatigue  ; Get the base including ability effects. set fatigueBase to getBaseAV fatigue  ; Get the total damage done by running/resting, fighting, spells, etc, and modAV2. set fatigueDamage to fatigueMax - fatigue  ; Get the total drains applied by spells and modAV2. set fatigueDrain to fatigueBase - fatigueMax  ; Get the total fortify effect from abilities. set fatigueAbilityFortifies to (GetTotalAEAbilityMagnitude FOFA) - (GetTotalAEAbilityMagnitude DRFA)  ; Get the total drain effect from non-ability spells. set fatigueSpellDrains to (GetTotalAENonAbilityMagnitude DRFA) - (GetTotalAENonAbilityMagnitude FOFA)  ; the base not including ability affects set fatigueRawBase to fatigueBase - fatigueAbilityFortifies  ; Get the drains done only by mods using modAV. set fatigueModDrains to fatigueDrain - fatigueSpellDrains  ; set fatigue back to what it originally was modAV2 -fatigueDamage

Note that doing 'modAV2 encumbrance -N' will apply a feather effect and reduces "wornWeight" which will increase movement speed. The encumbranceMax is the actual carried equipment weight, so 'modAV2 encumbrance 10000' followed by 'modAV2 encumbrance 0' will undo any feather effects and reset encumbrance to the carried equipment weight.

Personally I find modAV's most disturbing feature the "leftover drain" when your mod is deactivated... as a mod developer making it painless and safe to just deactivate your mods saves heaps of time helping people fixing it. In RealisticFatigue I switched to using repeated application of modAV2 to apply a "drain fatigue" like effect because that meant it just recovered when people deactivate my mod.

Warning: using drain abilities can cause problems too... I've seen one mod using a big drain ability to reduce an attribute to zero. It relied on the "truncating effect" that big drain abilities have to not drain below zero. However this makes it impossible for levelling mods to correctly identify how much an ability has contributed to modifying the getBaseAV value... the ability is not fully applied, so you don't know if that "drain stealth 100" ability drained it down to zero all the way down from 100, or just drained it down from 40.

Drain/Fortify effects with enchanted tokensEdit

I've created an alternative to MMM's actor diversification feature (which are located in OnLoadCS* scripts) that uses enchanted tokens rather than ModAVs.

And I find that GetBaseAV doesn't seem to take into account Drain and Fortify effects from enchanted tokens.

Here's a ConScribe output that details this:

Bandit Bowman FF0456F9 zzMMMOnLoadCSNPC
fStat 49.00
;an enchanted token with a drain health effect of +49 is added to the inventory at this point.
;below is the health of the npc before the enchanted token is equipped.
Bandit Bowman FF0456F9 pre-equip health 116 / 116.00
;below is the health of the npc after the enchanted token is equipped.
Bandit Bowman FF0456F9 post-equip health 165 / 116.00
;below is the output of my ActorDetails.esp on the npc:
Bandit Bowman Bandit Bowman
inventory:
0: Oblivion.esm: Iron Arrow: 00017829 x 19
...
8: kuertee MMM OnLoadCS health effects only.esp: kFortifyHealth40C: 69002AC2 x 1
9: kuertee MMM OnLoadCS health effects only.esp: kFortifyHealth5C: 69001BD0 x 1
10: kuertee MMM OnLoadCS health effects only.esp: kFortifyHealth4C: 69002ABF x 1
11: Mart's Monster Mod.esm: Blood Plus Wounding Token: 04017BDF x 1
12: Mart's Monster Mod.esm: Flee Token: 0401898F x 1
13: Vows and Covenants.esp: Death Tracking Token: 5A0046B2 x 1
14: nGCD.esp: <no name>: 4400B914 x 1
15: Mart's Monster Mod - Extra Wounding.esp: Process Token: 2A00BCC3 x 1
16: Willful Resistance.esp: Willful Widget: 4C001CAF x 1
17: SM Combat Hide.esp: Token: 3A000ED5 x 1
18: kuerteeBattleFatigueAndInjuries.esp: kRIToken: 68000826 x 1
19: Vows and Covenants.esp: Mercy Token: 5A00C1B2 x 1
20: kuerteeAttributeAndSkillBasedDamageModifiers.esp: Attribute-based weakness to magic: 60000804 x 1
spells:
0: Willful Resistance.esp: Willpower: 4C004CCF
1: RealisticFatigue.esp: Realistic Fatigue Effects: 56000810
2: Mart's Monster Mod.esm: CSNPC OnLoad: 04000D20
active effects:
0: Willful Resistance.esp: Willpower: 4C004CCF code 1.09558e+009 magnitude 5
1: kuertee MMM OnLoadCS health effects only.esp: <no name>: 69002AA1 code 1.16237e+009 magnitude 4
2: kuertee MMM OnLoadCS health effects only.esp: <no name>: 69002AAF code 1.16237e+009 magnitude 40
3: kuertee MMM OnLoadCS health effects only.esp: <no name>: 69001BC1 code 1.16237e+009 magnitude 5
4: Oblivion.esm: Redguard Disease Resistance: 00047AE6 code 1.22921e+009 magnitude 75
5: Oblivion.esm: Redguard Poison Resistance: 00047AE5 code 1.33066e+009 magnitude 75
6: RealisticFatigue.esp: Realistic Fatigue Effects: 56000810 code 1.17901e+009 magnitude 0
factions:
0: Oblivion.esm: Bandit Faction: 000177E3: 0

Here's a description of what actually happens above:

  1. An NPC receives +49 health from MMM's actor diversifaction system.
  2. My alternative esp applies this bonus by adding and equipping enchanted tokens: 1 with a Fortify Health of 40, another with a +5 and another with a +4.
  3. Before the items are equipped, the NPC reports a Health of 116 / 116 - as per expected.
  4. However, the frame after the items are equipped, the NPC reports a Health of 165 / 116.
  5. This suggests that the Fortify Health effects works, but that GetBaseAV has not taken them into its calculations.

Does this mean that when we use GetBaseAV, we'll need not only to subtract Fortify effects and to add Drain effects (as per the GetBaseActorValue page: http://cs.elderscrolls.com/constwiki/index.php/GetBaseActorValue) but also to check whether the origin of Drain and Fortify effects are from enchantments and not spells and abilities?

I.e.: true base AV = GetBaseAV - (fortify effects from abilities and spells only) + (drain effects from abilities and spells only)--Kuertee 22:51, 6 November 2009 (EST)

EDIT: or is it: true base AV = GetBaseAV - (fortify effects from ABILITIES only) + (drain effects from ABILITIES only)? because effects from spells are similar to enchantments and are active in-game only - and not on the base object.--Kuertee 22:51, 6 November 2009 (EST)

Return to "ModActorValue2" page.