MoveToIfUnloaded - ObjectReference

From Creation Kit
Jump to: navigation, search

Member of: ObjectReference Script

Moves this reference to the location of the target reference, with the specified offset, if this reference is currently unloaded (has no 3D). If it is loaded, it does nothing.

Syntax

bool Function MoveToIfUnloaded(ObjectReference akTarget, float afXOffset = 0.0, float afYOffset = 0.0, float afZOffset = 0.0)

Parameters

  • akTarget: The target reference to move this one to.
  • afXOffset: How much to offset the move in the X direction.
    • Default: 0.0
  • afYOffset: How much to offset the move in the Y direction.
    • Default: 0.0
  • afZOffset: How much to offset the move in the Z direction.
    • Default: 0.0

Return Value

True if the object was moved, false if not.

Examples

; Move the box to the shelf, but only if it is unloaded
if Box.MoveToIfUnloaded(Shelf)
  Debug.Trace("Moved the box")
endIf


; Move the box above the shelf, but only if it is unloaded
if Box.MoveToIfUnloaded(Shelf, 0.0, 0.0, 1.0)
  Debug.Trace("Moved the box above the shelf")
endIf

See Also