Difference between revisions of "Teleport Recall"

1,805 bytes added ,  20:56, 28 May 2007
Complete rewrite with examples, etc.
imported>Wrye
(Marker Rat)
imported>Wrye
(Complete rewrite with examples, etc.)
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 [[#MarkerRats|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 alive or even visible, thus they can be treated just like regular XMarkers.


End
'''Marker Rat Recipe:'''
 
* Define a marker rat creature:
My MOD, The Lost Telvanni Codex, has both recall and true-recall spells. RecallRef has to be a static marker. That is in the CS you have to copy an existing one (name it), put in the world somewhere then use it's refID directly. You would have to do the same thing if you used, eg., an item to achieve the same effect. You may have some timing issues too - I did. [[User:GuidoBot|GuidoBot]] 03:22, 4 November 2006 (EST)
** ''Enable'' low level processing (just in case).
 
** Set health to zero (just in case).
==Marker Rat==
** No respawn.
A teleport recall is quite popular for use with pocket dimensions, mobile tents, etc., but can also be used for multimark. 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.
* 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.
Usually an XMarker static is used as the mark/recall point. The static is placed somewhere, given a name and then move to the player for mark and has the player move to it for recall. In my experience this seems to work fine for pocket dimensions, but for my Wrye Shivering mod which has a two ended portal (one end in Shivering Isles, other end anywhere outside of SI) it has major problems -- which are essentially those described by WGS. I don't know the exact details, but after quitting/reloading the moved marker often seems to snap back to its original worldspace (or interior cell) while keeping its new x,y,z position -- often this leaves you in some ordinarily out of reach part of the original worldspace/cell. Oddly, this does not seem to occur for markers moved within various tamriel worldspaces, but does occur for markers moved between SI worldspaces, and for markers originally in Tamriel that have been moved out of tamriel.
* Use reference in scripts as described above.
 
It seems that the problem is related to the game not really expecting statics and other types of objects (doors, etc.) to move. So, solution: Use a creature or npc marker instead (which are expected/allowed to move). What I did:
* Started with a standard rat
* Enabled low level processing and set health to zero. (Don't know if this is necessary, but seemed a good idea.)
* Saved as new object.
* Placed rat references, and generally treated the same way as an xmarker, except I also arranged for script to disable it.
 
So far (30 minutes testing) looks good. --[[User:Wrye|Wrye]] 21:53, 27 May 2007 (EDT)
Anonymous user