Difference between revisions of "Teleport Recall"

4,155 bytes added ,  19:29, 10 January 2008
m
imported>WGS Dev913
m
imported>Qazaaq
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[User:WGS_Dev913|WGS_Dev913]] 11:49 PM November 3 (EDT) I was wondering if anyone knows how to make a script to teleport the player from Tamriel or an interior cell, to a new worldspace, and back to the exact spot the player teleported from. I tried using X Marker References but for some reason each time I try to use the recall spell to bring the player back where he was, it sends him to the Coordinates he'd be standing in the Tamriel worldspace, but staying in the new worldspace. I dont know what the problem is. Is the X Marker not switching between worldspaces like it should? Or is it moving correctly and just a problem with the script? Heres an example of the scripts if that helps (sorry if its formatted wrong im not used to Wiki yet)
__TOC__
A teleport recall is quite popular for use with pocket dimensions, mobile tents, etc., but can also be used for mark/recall, multimark, etc. The basic solution is to define a persistent ref object, place it at the mark point, and then later use moveto to return the player to that point.


----------
===Two Sided Teleport===
Here's a two sided teleport spell -- rather than have a separate mark and recall spells, you have a single spell that marks the current spot and then teleports you to the previously marked spot. This is done by having two separate markers and alternating between them.
<pre>scn exTeleport2ME


scn Teleport
begin scriptEffectStart
    if exTeleport2G == 0
        exTeleport2Ref0.moveTo player
    else
        exTeleport2Ref1.moveTo player
    endif
end


Begin ScriptEffectStart
begin scriptEffectFinish
    playSound DRSOblivionGateOpen
    if exTeleport2G == 0
        set exTeleport2G to 1
        player.moveTo exTeleport2Ref1
    else
        set exTeleport2G to 0
        player.moveTo exTeleport2Ref0
    endif
end</pre>
To use this, you would also need to define the exTeleport2G global (a short with initial value of 0). You'll also need the casting spell which uses this spell effect script. The duration of the script effect should be at least one second to give the moveTo in the scripteffectstart time to complete. Finally, you'll need the marker references (exTeleport2Ref0 and exTeleport2Ref1). Previously, these were usually defined as instances of the static XMarker, but there are problems with these -- you should use a [[#Marker_Rats|marker creature]] instead.


if(GetInWorldSpace BlankRealm)
===Variations===
Player.MoveTo TeleportRef
Variation usually comes in how you trigger the teleport effect. a spell (such as above) is probably simplest to implement, but doors may be more fun, or have a better visual/logical appeal, and can be made less uber.  
else


Ref RecallRef
Rather than directly casting a spell, you might somehow establish a doorway in the external world (e.g., raise a tent, which includes a doorway, or else summon a portal). Then activating the doorway would perform the teleportation.  
;RecallRef for bringing the player back to where he was
RecallRef.MoveTo Player 0 0 5
Player.MoveTo TeleportRef 0 0 5
endIf


End
If you're using a tent or pocket dimension metaphor, you will likely have a fixed doorway in the "home" (tent or pocket dimension) cell. The external doorway should be a door object which is moved to the players location along with the external marker ref. (Note that the door should NOT be used as the external marker -- see below.) Using the external doorway would then cause a moveTo the marker in the home cell. (Alternatively you can use positionCell -- but its probably simpler to use a marker in the internal cell as well. Note: In this case a static XMarker will work fine.)


------
If you summon the external doorway, you'll probably want to place it in front of the player by a given distance. Since you can't do this directly with placeAtMe, you'll instead need to move the object to the player and then reposition it. For info on doing this, see [[Summon Object]].


scn Recall
For a working example of a pocket dimension with summoned doorway, see [http://wrye.ufrealms.net/Salans%20Cellar.html Salan's Cellar]. (Note: This does not yet use a marker rat for the exit. See [[#MarkerRats|below]].)


Begin ScriptEffectStart
===Shivering Isles===
If you're moving to/from Shivering Isles, you'll also need to switch reset a number of flags and quest variables while making the transition. For an example, see the entrance/exit doors in Shivering Isles, or the Shivering Gates in [http://wrye.ufrealms.net/Wrye%20Shivering.html Wrye Shivering]. (Note: Wrye Shivering does not yet use Marker creatures as it should. See [[#MarkerRats|below]].)


if(GetInWorldSpace BlankRealm)
===Companions===
MoveTo RecallRef 0 0 5
Since the door is not a regular doorway, you companions (if any) will not follow you through. If this is not desirable, then an area spell should be cast which causes companions to moveto player after player has arrived.
else


player.Message "You cannot use that here."
Note however, companions may not have greetings in Shivering Isles -- this is because the regular greetings topic are turned off in SI (as are most rumors, etc.).  


endif
===Marker Rats===
In order to mark points in the world for recall, a reference marker needs to be moved there. In the past, this has been done with XMarkers, but these seem to have problems when they're moved to worldspaces outside of the Tamriel worldspace. It seems that after quitting and reloading, the objects snap back to their original worldspace, while keeping their modified position (x, y, z coordinates). Apparently, the game engine doesn't really expect statics, doors, etc. to move outside of their original cell, and so the information about their movement is not properly recorded.


Solution to this is to use marker actors (creatures or NPCs) instead. (Since the game engine expects these objects to move, changes in worldspaces are correctly recorded.) Thankfully the marker creatures do not have to be visible, thus they can be treated just like regular XMarkers.


End
'''Marker Rat Recipe:'''
* Define a marker rat creature:
** ''Enable'' low level processing (just in case).
** Scripted? If the marker rat is scripted, then the rat must be alive. (Scripts on actors won't run unless the actor is alive.)
* Place instance of rat somewhere in world (e.g., at default teleport point or in dummy internal cell).
* Name the reference (e.g., exTeleport2Ref0) and set it to initially disabled.
* Use reference in scripts as described above.
 
[[Category: Useful Code]]
Anonymous user