Jump to content

Alternatives to the 'MoveTo' Command


ArxVallium

Recommended Posts

The dreaded MoveTo command, a very high risk and crash-prone command. It is something that has plagued previous mods of mine but also something that I find myself utilizing a lot (especially in my new project). The question? What are the alternatives to it?

 

So far, I find myself using Automatic Doors as a great way to counter the moveto command. However, this only works in tight spaces where an automatic door can be spawned into the world in a proximity that is close enough to quickly grab the player and teleport them to the next area. It is altogether a great solution to the moveto command but, like I said, is a very "specialized" solution. It can become tedious because I always tag my automatic doors and leave them disabled until I need them. Then I script them to spawn at the exact moments that they are needed. Basically, it rapidly becomes a lot of ABFireplaceDoorREF.disable and ABFireplaceDoorREF.enable.

 

I would like to dedicate this discussion to finding alternatives to MoveTo. If anybody has ideas, insights or experiences I'd love to hear them. The goal is to find anything that teleports the player, an NPC or an object to another cell / world space or same-cell area with as little glitches tacked on as possible.

Edited by ArxVallium
Link to comment
Share on other sites

The obvious 'alternatives' are PositionCell/PositionWorld. Within the same cell you can also use SetPos/SetAngle.

Interesting, I saw these commands but thought they were specific to same-cell movements. I'll check them out.

Link to comment
Share on other sites

  • 2 weeks later...

Setpos and SetAngle is for objects in the same cell. It is the same as your own coordinates or any cooirdinates but only within the same cell.

 

If you ever need to use them, which I do often to decorate in the game, you have to use getpos first to see where the object really is, like:

Getpos x

Getpos y

Getpos z

 

I never had problems with moveto player as I use that on my companions daily, lots of times too.

Link to comment
Share on other sites

  • 3 weeks later...
Instead of moving objects you could place similar objects and enable/disable them as needed. And for npc moving, the obvious best choice in most scenarios is just to give the appropriate AI packages so they move in a normal way. Of course, if your goal is to teleport them, then AI is prob undesirable.
Link to comment
Share on other sites

When I move objects, I usually do that to other cells. Like placing X Rat Markers inside a dungeon, without polluting it, without touching the dungeon with my filthy mouse arrow in CSE... :wink: After that I can let the rat eiter spawn new mobs or let existing mobs move to it. The X Rat is Inviss, hidden and have loads of health in case and a package that makes it stay put.

 

I call it X Rat as I use them instead of XMarkers or XMarkerHeadings. Works perfct in ALL conditions, with the static XMarkers does not.

 

A static Xmarker cannot spawn stuff... :wink:

 

Damn, even my own house is infested with rats. Inviss, but their poo stinks... ;)

Edited by Pellape
Link to comment
Share on other sites

Also be aware that PositionCell and PositionWorld use radians for the rotation value:

[reference.]PositionCell x,y,z, zRot, CellID

So "zRot" does not work with a simple "GetAngle" function, if you want to move something dynamically.

float xCoord
float yCoord
float zCoord
float zRot
ref rToMove
ref rTarget
ref rRefCurCell
 
Let rToMove := ;=> A reference you want to move.
Let rTarget := ;=> A possibly dynamic thing where you want to move the reference above.
Let xCoord := rTarget.GetPOS X
Let yCoord := rTarget.GetPOS Y
Let zCoord := rTarget.GetPOS Z
Let zRot := rTarget.GetAngle Z
Let zRot *= 0.01745 ;=> To convert it to radians for the Postion-function
rTarget.Disable
if rTarget.IsInInterior
  Let rRefCurCell := rTarget.GetParentCell
  rToMove.PositionCell xCoord, yCoord, zCoord, zRot, rRefCurCell
else
  Let rRefCurCell := rTarget.GetParentWorldspace
  rToMove.PositionWorld xCoord, yCoord, zCoord, zRot, rRefCurCell
endif

This script merely replaces the rTarget reference with the rToMove reference.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...