Difference between revisions of "ForceActorValue"

From GECK

m (Robot: Automated text replacement (-\[\[Category:(.*?)\(GECK 1.0\)\]\] +Category:\1(GECK 1.1)))
 
Line 1: Line 1:
'''Syntax:'''
+
{{Function
  [''ActorID''.]ForceActorValue ''StatName'' ''value''
+
  |CSWikiPage = ForceActorValue
  [''ActorID''.]ForceAV ''StatName'' ''value''
+
  |origin = GECK1
'''Example:'''
+
  |summary = ForceActorValue modifies the current stat to the specified value (not to be confused with SetActorValue, which changes the BASE value of the stat).
  ForceActorValue Health 50
+
|name = ForceActorValue
 
+
|alias = ForceAV
ForceActorValue modifies the current stat to the specified value (not to be confused with SetActorValue, which changes the BASE value of the stat). The equivalent of:  
+
|returnType = void
 +
|referenceType = [ActorRefID]
 +
|arguments =
 +
  {{FunctionArgument
 +
  |Name = [[ActorValue]]
 +
  |Type = string
 +
  }}{{FunctionArgument
 +
  |Name = Value
 +
  |Type = int
 +
  }}
 +
|example = ForceActorValue Health 50
 +
The equivalent of:  
 
  Short modParameter
 
  Short modParameter
 
  Set modParameter to ( 50 - GetActorValue Health )
 
  Set modParameter to ( 50 - GetActorValue Health )
Line 13: Line 24:
 
   
 
   
 
Note that like ModActorValue, when used in a script this change is permanent. See [[ModActorValue]] for discussion of how this works.
 
Note that like ModActorValue, when used in a script this change is permanent. See [[ModActorValue]] for discussion of how this works.
 +
}}
  
 
==Notes==
 
==Notes==
Line 33: Line 45:
 
*[[RestoreActorValue]]
 
*[[RestoreActorValue]]
 
*[[SetActorValue]]
 
*[[SetActorValue]]
 
  
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 08:32, 15 January 2011

Link to TES4 Construction Set Wiki: ForceActorValue.

A function included in the GECK version 1.1.0.36.

Description

ForceActorValue modifies the current stat to the specified value (not to be confused with SetActorValue, which changes the BASE value of the stat).

Syntax

[ActorRefID].ForceActorValue ActorValue:string Value:int 

Or:

[ActorRefID].ForceAV ActorValue:string Value:int

Example

ForceActorValue Health 50 

The equivalent of:

Short modParameter
Set modParameter to ( 50 - GetActorValue Health )
ModActorValue Health, modParameter

Because the GetActorValue function returns the current state, including all effects, damage, and other ModActorValue numbers, ForceActorValue will produce different ModActorValue results at different times.

Note that like ModActorValue, when used in a script this change is permanent. See ModActorValue for discussion of how this works.

Notes

  • Should never be used on the player, as it will seriously screw up that actor value when combined with other mods or scripts that adjust it or depend on it.
  • Instead, use ModAV to adjust the stat to the required value. If several mods make changes to the same value at the same time, and one of them uses ForceAV the stat is likely to end up irrevocably altered. For example:
    • An actor has a starting Strength of 6.
    • Mod 1 records 6 as the starting strength, and uses ForceAV Strength 8 to increase their strength by 2.
    • Mod 2 uses ModAV Strength 2 to further increase their strength by 2, to 10.
    • Mod 1's effect ends, and it uses ForceAV Strength 6 to return the actor's strength to the recorded starting value of 6.
    • Mod 2's effect ends, and it uses ModAV Strength -2 to remove the 2 strength it added. This gives a total value of 4.
    • The actor now has Strength 4, and neither Mod 1 nor Mod 2 will fix it.

See Also

Personal tools