Background for Skyrim SE
Member of the ReferenceAlias script
voidfunctionForceRefTo(ObjectReferenceakNewRef)Native

Description

Wiki Description

Forces this alias to use the specified reference.

Documentation Comment

Forces this alias to use the specified reference


Caveats

CK Wiki - Notes

  • Use of this function causes this actor (and all other actors in any current running scene in the quest) to re-Actor.EvaluatePackage() their packages. Calling this multiple times in a row can result in actors in running scenes to lose their scene package permanently and result in brokenness. Do not call this multiple times in a row while a scene is running in the quest whose alias you are forcing to.
  • This function does not allow you to clear an alias by forcing it to None. Instead, use the ReferenceAlias.Clear() function.
  • ForceRefTo() does not yield and wait for the alias's reference to reflect the that of the new forced value
  • Calling this function means the reference will be forced rapidly, not immediately
  • Repeated calls to the same alias, even with different objectreference criteria will execute in call order(approximate), one after another.
  • Can still fail under certain conditions, though it does appear to bypass many if not most CK fill conditions
  • See discussion for state assurance examples

Parameters

ObjectReferenceakNewRef

CK Wiki Description

The ObjectReference to tell this alias to use


Examples

; Force the alias to use us as the reference (if script extends ObjectReference)
Alias_JohnDoe.ForceRefTo(self)

Auto-Generated Example

ObjectReference myObjectReference__akNewRef

myReferenceAlias__toCallFunctionOn.ForceRefTo(myObjectReference__akNewRef)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.