Morrowind Mod:Position
< Mod / Morrowind: Morrowind Mod: Alphabetical Functions / Categorical FunctionsPosition
PositionCell
Position, X, Y, Z, ZRot PositionCell, X, Y, Z, ZRot, "CellID" Where: X,Y,Z = Exterior/interior location to move to the object to (float). ZRot = World Z-axis orientation of the object (degrees for the player, minutes otherwise (0=North, clockwise), float) CellID = Interior cell name Type: Movement Returns: none Example: Player->Position, -1005, 165018, 100 "Salyni Nelvayn"->PositionCell, 106, 1241, -105, "Assurdirapal, Shrine" PositionCell, 8090, 698, -500, 270, "Vivec, St. Olms Haunted Manor" Scripts: CharGen gardingScript
Sets the position of the calling object to the given exterior (Position) or interior (PositionCell) location. If you try to teleport to an unsafe place (clipping with an object or out in the void), you will instead be placed at the next safe location. Some people have noticed bugs using the Position function (NPCs disappearing) and recommend using the PositionCell function instead, which can be outside if an exterior cell name is given.
Note that you must specify ZRot in minutes (1 degree = 60 minutes; north = 0, east = 5400, south = 10800, west = 16200) except for when you position the player, then degrees must be used (north = 0, east = 90, south = 180, west = 270). See "Morrowind Scripting for Dummies (9th Edition)"[1] pages 50 and 54 for reference.
If you PositionCell something you have never met into your current cell then its local script will not start running (until you leave the area and return anyways).
A common application of this function is to create a teleportation item (though, since variables are not accepted, you can only teleport to set locations), for example:
Begin TestTeleport_Script short button short messageOn short reset short OnPcEquip if ( OnPCEquip == 0 ) set reset to 0 endif if ( reset == 1 ) return endif if ( OnPCEquip == 1 ) if ( reset == 0 ) Set OnPCEquip to 0 MessageBox "Use the Mazedband to teleport where?" "Vivec" "Mournhold" "Sotha Sil" "Nowhere" set messageOn to 1 endif endif if ( messageOn == 1 ) set button to GetButtonPressed if ( button >= 0 ) set messageOn to 0 endif ; Vivec if ( button == 0 ) playsound "conjuration hit" Player->PositionCell 12, 219, -501, 0 "Vivec, High Fane" set reset to 1 ; Mournhold elseif ( button == 1 ) playsound "conjuration hit" Player->PositionCell 0, -478, -645, 0 "Mournhold Temple: High Chapel" set reset to 1 ; Sotha sil elseif ( button == 2 ) playsound "conjuration hit" Player->PositionCell 3976, 4179, 12310, 0 "Sotha Sil, Dome of Sotha Sil" set reset to 1 return ; Nothing elseif ( button == 3 ) set reset to 1 return endif endif End
You should not use either function from dialogue results as it can cause the game to crash. Instead, create a script to peform the teleporting and use a StartScript to start it from the dialogue result.
See Also: PlaceItem, PlaceItemCell