MoveTo

From the CreationKit Wiki
Jump to navigation Jump to search

Description[edit | edit source]

MoveTo Moves the object to the specified reference's location. The x, y, z are optional offsets from the target reference.

Syntax[edit | edit source]

[ObjectRef].MoveTo MarkerID, x, y, z (optional) 

Examples[edit | edit source]

BuddyRef.MoveTo HiddenCaveMarker

This will move Buddy to the hidden cave marker

BuddyRef.MoveTo player, 512, 0, 0 

This will move Buddy to the player, slightly offset from the target

Notes[edit | edit source]

  • If this function is used to move the player, the function will queue up a movement request for him/her which s/he then will process later instead of immediately stopping script execution.
  • If called on a reference inside a container, it will remove the ref from the container and move it to the specified location. Note that this only works on persistent references (which is fine in-game but means it may not always work from the console).
  • This function works as expected for Actors. For most other object types, like containers and activators, the object's coordinates are updated but its world art is not. Additional scripting may be necessary to ensure the object moves properly:
myObject.disable
myObject.moveTo [location]
myObject.enable
set xp to myObject.getPos x
myObject.setPos x xp


Papyrus Version[edit | edit source]

ObjectReference.MoveTo (Papyrus)