Difference between revisions of "Talk:ModActorValue2"
imported>ABO |
imported>ABO |
||
Line 47: | Line 47: | ||
; the base not including ability affects | ; the base not including ability affects | ||
set fatigueRawBase to fatigueBase - fatigueAbilityFortifies | set fatigueRawBase to fatigueBase - fatigueAbilityFortifies | ||
; Get the drains done only by mods using modAV. | ; Get the drains done only by mods using modAV. | ||
set fatigueModDrains to fatigueDrain - fatigueSpellDrains | set fatigueModDrains to fatigueDrain - fatigueSpellDrains |
Revision as of 20:39, 5 August 2009
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 Attributes
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;
- 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
- "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.
- "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.