Here is the script I have so far in its simplest form, minus all of the workarounds I wrote that did nothing helpful. I can only get it to work in 1 direction, towards the destination point, but the return point does not work.
Spoiler
Scriptname TeleportScript extends activemagiceffect ObjectReference property [color=#ff0000]DestinationMarker[/color] autoObjectReference property [color=#00ffff]ReturnMarker[/color] autobool PlayerAtDestinationEvent OnEffectFinish(Actor target, Actor caster) if PlayerAtDestination == false [color=#00ffff]ReturnMarker[/color].MoveTo(target) target.MoveTo([color=#ff0000]DestinationMarker[/color]) PlayerAtDestination == true else target.MoveTo([color=#00ffff]ReturnMarker[/color]) PlayerAtDestination == false endifEndEvent
In this instance, ReturnMarker and DestinationMarker are XMarkerHeadings. The goal is for the player to go to the DestinationMarker located in DestinationCell (which is exterior), and at the same time move the ReturnMarker to the player's original location. After casting the spell a second time, the player is moved to the ReturnMarker, and the process repeats. What would be bad is if the check fails, and the ReturnMarker is sent to DestinationCell, trapping the player forever.
I could possibly get it to work if I could figure out how to actually change the values of the boolean flag.
Bonus points:
50 Bonus points if anyone can come up with a script that, instead of directly teleporting the player, spawns a portal object in front of the player that is activated when the player walks into it. The rest of the script's original effect applies, except the player is moved to the location of the portal rather than where they stood while casting the spell.
30 Bonus points each if you can prevent it from working in interiors, during combat, and if companions are able to travel with you.
5,000 bonus points if you can explain it to me so I don't need to ask again

