Tes3Mod:SetPos

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search


SetPos

                SetPos, Axis, Position

       Where:   Axis     = World axis to set the object's position (X, Y, or Z)
                Position = Position in game units to set (float). In Tribunal the function can accept
                           variable floats as well as literal values.

        Type:   Movement

     Returns:   none

     Example:   SetPos, X, 45.0
                "Act_banner_Tel_Vos"->SetPos, Z, -1002.0
                SetPos, Y, GetStartingPos, Y
                SetPos, Y, fValue                       (Tribunal only)

     Scripts:   shrineGnisisSecret
                PlagueRock1

Sets the position of the object in game units (70 units per meter) using the given world axis. In Tribunal the function also accepts local float variables in addition to literal values (does not accept globals). This function does modify the player's position. Unfortunately there are problems when you use SetPos to change the current cell. The cell's contents are not always loaded correctly. In this case you may need to use the COE (CenterOnExterior) function to change the current cell and then the SetPos to modify the player's position. An easier method is to use a FixMe function call after the player's position has changed.

A related problem is in exteriors the function will only work in the currently loaded area (the current cell plus 2-3 cells around the current cell). It can't be used to move something to an arbitrary exterior cell.

It's also worth noting that an object's new x,y,z co-ordinates are not stored in save game files. Any scripts that need to permanently alter an object's position in the game world need to store the new co-ordinates in local variables and update the object's position accordingly.

See Also: GetPos