Difference between revisions of "ModActorValue"
Jump to navigation
Jump to search
→Warning
imported>Doppelganger m |
imported>Smeister |
||
|
= Warning =
There appears to be a serious issue with [[ModActorValue]] to manipulate health when the player also acquires a Restore Health effect. It is documented in a [http://www.elderscrolls.com/forums/index.php?showtopic=334595 thread in the forums] and exhibited by a [http://www.tessource.net/files/file.php?id=2274 test case modification].
== Developer Response ==
ModActorValue behaves differently if you're using it in a Script vs using it in the Console. When you (or the game) uses GetActorValue, you are getting a sum of the base actor value plus three modifiers: the Game Modifier, the Magic Modifier and the Script Modifier. If you use ModActorValue in a script, the Script Modifier is adjusted, and ONLY a script can adjust it back. In other words, if you have a script do
'''player.modav health 100'''
you are also responsible for doing
'''player.modav health -100'''
or that 100 points will *always* be in the Script modifier.
The Game Modifier is used for "permanent" effects such as Damage and Restore, while the Magic Modifier is used for "temporary" effects such as Drain and Fortify. The Game Modifier will also not allow actor values to go above their base, while the Magic Modifier will. So if you use ModActorValue in the console, a negative value can be "corrected" with a Restore, while a positive value will only bring the Game Modifier up to a maximum of zero.
The reason for the difference is that ModActorValue in consoles was used for testing purposes, while its use in scripts is for temporary effects that cannot be adjusted by using magic spells or internal game systems. If you want to make a permanent change to an actor value in a script, you must either use SetActorValue or apply a magic spell that modifies the actor value you're interested in. A good way to do this is to create an Ability and use AddSpell to add it to your reference's spell list.
--[[User:Smeister|Smeister]] 17:51, 3 April 2006 (EDT)
==See Also==
| |||