Jump to content

Script: Ways to teleport


Zorkaz

Recommended Posts

I just wanted a topic on teleports, since there are many ways and all have their pros and cons

 

 

So out of my mind I know about 3 ways to teleport the player (and or objects)

 

1. The basic door teleport

Pro: Easy to use

Con: Marker can't be interacted with. Requires updating the navmesh

 

 

2. Game.FastTravel(TeleportLocation)

Pro: Works great for NPCs

Con:

Uses the fast-travel system so time will pass (And the player get thirsty)

Also it's not possible while the player is over-encumbered

 

3. Moveto

Pro: Doesn't use the fast-travel system and works great for objects as well as the PlayerRef

Con: Won't work on NPCs at least not with basic scripts

 

 

Are there any other good teleport methods and or is my info wrong?

Link to comment
Share on other sites

Door Teleportation is static. While you could move the door via script, there is no way to relocate the marker.
The navmesh even less so.

FastTravel will also fail if the player is overencumbered. You have to put some spell on them which sets carry capacity to 9000 or so.

MoveTo won't teleport player followers. They still somehow follow sometimes, but not always.
The safe way is to loop through them and teleport them separately. Potentially also check distance to player to see if they followed already on their own.


NPCs won't use any kind of scripted teleportation on their own. They only teleport if the navmesh allows them to.

Link to comment
Share on other sites

Whilst companion and follower AI packages will automatically move them to keep within a radius of the player, e.g. if they get stuck on rocks and such, in survival a companion moves to homelocation if they happen to be bleeding out. For a full-fat solution after a player MoveTo;

Actor[] PlayerFollowers = Game.GetPlayerFollowers()
If (PlayerFollowers.Length > 0)
   Int iIndex = 0 
   While (iIndex < PlayerFollowers.Length)
      PlayerFollowers[iIndex].MoveTo(pPlayerREF)
      iIndex +=1
   EndWhile
EndIf 
Link to comment
Share on other sites

Here's a good topic about avoiding navmesh finalizing when making a door that works for NPCs too:

 

https://forums.nexusmods.com/index.php?/topic/4862395-alternative-to-finalizing-exterior-navmeshes/

Hm, so he's finalizing the navmesh in the interior, but not the exterior. And then uses your method #2 to move the player.

I imagine this would work for NPCs moving from the inside to the outside, but does the other way round work?

 

SKK's script should work, though I'd moveTo the followers to the teleportLocation marker, not the player.

It will be the same most of the times, but if you have a whole lot of followers and/or lots of script lag,

they might keep appearing around you after you moved away from the door.

 

Also, before actually moveTo'ing the follower, I'd check if they are nearby already.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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