Difference between revisions of "MoveTo"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Scruggs
(add moveToMarker alias.)
imported>Dev akm
(→‎Notes: link MoveTo Oddities)
Line 20: Line 20:
* To adjust the object relative to the players heading (i.e. place it in front of the player), you'll need to offset it's position. See [[Summon Object]] for full code sample.
* To adjust the object relative to the players heading (i.e. place it in front of the player), you'll need to offset it's position. See [[Summon Object]] for full code sample.
* Script functions that make one actor target another (like [[SayTo]] or [[StartCombat]]) will not work when MoveTo is used on the target in the same frame, even when the target is moved only by a few inches.
* Script functions that make one actor target another (like [[SayTo]] or [[StartCombat]]) will not work when MoveTo is used on the target in the same frame, even when the target is moved only by a few inches.
* MoveTo can be very problematic in some situations. See [[Common_Bugs#MoveTo_Oddities|MoveTo Oddities]].


==See Also==  
==See Also==  

Revision as of 14:15, 31 March 2009

Syntax:

MoveTo MarkerID, [x, y, z] (optional) 
MoveToMarker MarkerID, [x, y, z] (optional) 

Example:

MoveToMarker HiddenCaveMarker 
MoveTo player, 512, 0, 0 

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

Notes

  • MoveTo and PositionCell perform the same function, but use different parameters (PositionCell uses coordinates while MoveTo uses a reference).
  • If this function is used to move the player, it will also act as a Return function -- no following lines of the script will be processed.
  • 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
  • Note however, that if the moved object is moved to a new cell, it may snap back to its original cell after quit/reload (while keeping the new x,y,z coordinates). This seems to not happen as much when moving between Tamriel subspaces, but definitly happens when moving to and between Shivering Isles and Oblivion worldspaces. If the object being moved is only supposed to be a marker, consider using a marker actor instead. (See Teleport Recall.) (Actors do not suffer from worldspace snapback, and should react correctly to closing of an Oblivion gate.)
  • To adjust the object relative to the players heading (i.e. place it in front of the player), you'll need to offset it's position. See Summon Object for full code sample.
  • Script functions that make one actor target another (like SayTo or StartCombat) will not work when MoveTo is used on the target in the same frame, even when the target is moved only by a few inches.
  • MoveTo can be very problematic in some situations. See MoveTo Oddities.

See Also