Jump to content

Photo

Alternatives to the 'MoveTo' Command

scripting oblivion tesiv construction set modding mod

  • Please log in to reply
6 replies to this topic

#1
ArxVallium

ArxVallium

    Fan

  • Supporter
  • PipPipPip
  • 438 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, 31 January 2022 - 10:32 PM.


#2
qwertyasdfgh

qwertyasdfgh

    Old hand

  • Members
  • PipPipPip
  • 793 posts
The obvious 'alternatives' are PositionCell/PositionWorld. Within the same cell you can also use SetPos/SetAngle.

#3
ArxVallium

ArxVallium

    Fan

  • Supporter
  • PipPipPip
  • 438 posts

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.



#4
Pellape

Pellape

    Faithful poster

  • Members
  • PipPipPipPip
  • 2,071 posts

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.



#5
ArmlessWunder

ArmlessWunder

    Regular

  • Supporter
  • PipPip
  • 90 posts
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.

#6
Pellape

Pellape

    Faithful poster

  • Members
  • PipPipPipPip
  • 2,071 posts

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, 05 March 2022 - 12:52 PM.


#7
JustChill

JustChill

    Script kiddie

  • Premium Member
  • 676 posts

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.







Also tagged with one or more of these keywords: scripting, oblivion, tesiv construction set, modding, mod

IPB skins by Skinbox
Page loaded in: 1.047 seconds