Teleport Script Redux

Post » Tue Jun 19, 2012 3:13 pm

Hello and welcome to my regular cry for help. Today, we're revisiting an old friend, the teleport script. I wanted teleport stones in my player house to transport the player to various cities, with the help of someone more knowledgeable than me. This is what I ended up using:

Scriptname TeleP_Riften extends ObjectReference  ObjectReference Property TeleportMarker autoEvent OnActivate(ObjectReference akActionRef)Game.GetPlayer().MoveTo(TeleportMarker)EndEvent

Now I could only get this to work if I created nine identical scripts, only named for each city, if I didn't do that, it teleported you into blue nothingness. So I did that, and it worked...for a while. I moved on to other things in my house mod, but have now noticed its not working again. It still teleports you into the Tamriel world without problems, so Falkreath, Winterhold, Morthal and Dawnstar are not an issue. But any of the cities that have their own world space I just get teleported into blue nothingness. I have no idea why and it's driving me mad, anyone know what I'm doing wrong? and surely there's a way to do this as a single script and just change the variables/properties for each activator?

Also, if anyone knows how I could check to see if the player has traveled to the city in question and if they have not, then get the message "You can only teleport to cities you have already visited" instead of being teleported. Finally, it would also be really nice if your follower came with you, as currently they don't. If anyone can help with any of this I would be really grateful
User avatar
April D. F
 
Posts: 3346
Joined: Wed Mar 21, 2007 8:41 pm

Post » Tue Jun 19, 2012 11:56 pm

This has to do with where the TeleportMarker is. I'm assuming you're using an xmarkerheading, how are you setting it? If you are pointing that property to a specific xmarkerheading in the game world, make sure that xmarkerheading is in the right worldspace.

They are not in the Tamriel worldspace.
User avatar
Ash
 
Posts: 3392
Joined: Tue Jun 13, 2006 8:59 am

Post » Tue Jun 19, 2012 10:54 pm

Sorry, let me clarify, teleportmarker is an xmarker heading, one that I would create, place and name the ref something like Telemarker_Riften, then set its linked ref back to the activator at player house. now if I placed it in the tamriel worldspace, just outside riftens gate it worked fine, if I placed inside riften, blue nothingness.

EDIT: typo
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Tue Jun 19, 2012 2:57 pm

I can only give a wild guess here, but when I was looking through the carriage quest to see just how teleporting worked there, I noticed it used the map marker as a spawn point. Wouldn't be too surprised if there is a string of code that you can add to check to see if a map marker has been found yet. Sorry I can't be of more help, I'm still very much learning myself, but maybe that tidbit of info could lead you where you want to go.
User avatar
kitten maciver
 
Posts: 3472
Joined: Fri Jun 30, 2006 2:36 pm

Post » Tue Jun 19, 2012 2:37 pm

Just to double check, you are placing the marker in the Whiterun worldspace, and not the Tamriel worldspace??

Also, you could have one script, but I'm not sure if Papyrus has a self type function to get the object the script is attached to. That would make it easier :D.
User avatar
Ally Chimienti
 
Posts: 3409
Joined: Fri Jan 19, 2007 6:53 am

Post » Tue Jun 19, 2012 8:11 pm

Yes, what Im saying is, when I place the teleport marker in tamriel worldspace, it works, but when I place it in riftenworld space (ie selecting riftenworld space, then the riftencity north cell) it does not.
User avatar
sas
 
Posts: 3435
Joined: Thu Aug 03, 2006 8:40 am

Post » Tue Jun 19, 2012 3:15 pm

Look at the Moon Sugar Mansion WIP mod on the nexus. He's found a way around the issue you are having by double teleporting (two load screens). Otherwise I think it won't work, or you'll need to set the xmarker heading in the tamriel worldspace.
User avatar
Saul C
 
Posts: 3405
Joined: Wed Oct 17, 2007 12:41 pm

Post » Tue Jun 19, 2012 3:51 pm

You could make a different activator item type for each destination, and set TeleportMarker in the script properties...Same script, different objects.

How about this...make a FormList of special Activator or marker objects ("TeleportMarker" - Different item type, so the next part will work), and have the initialization script move them to the map marker in the appropriate world zones (First move it into the zone, then use a FindClosestRefOfTypeFromRef, searching for the mapmarker base, with the TeleportMarker as the search center, and a fairly large radius (Keep adjusting the search center until it finds the one you're after, then save that as the search start location)
User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am

Post » Wed Jun 20, 2012 1:21 am

Can't find Moonsugar Mansion, @RedwoodElf: I'll be honest, that sounds advanced and Im not sure I have a clue how to do it (not the diff objects, but a formlist or the findclosestref. I'm going to bed now, but in the morning I'll look the terms up on the Wiki and see what I can see

Edit, found Moonsugar Mansion
User avatar
Bedford White
 
Posts: 3307
Joined: Tue Jun 12, 2007 2:09 am

Post » Tue Jun 19, 2012 3:48 pm

How you would do the simpler of the two is, have an ObjectReference property in your script, then go into "Properties" and click "Edit value" - it will ask you to select an object in the render window...pull up the zone you want, find the map marker, and select it. (I actually recommend finding the map marker and getting it in the render window first, ready to click on)
User avatar
Isaiah Burdeau
 
Posts: 3431
Joined: Mon Nov 26, 2007 9:58 am

Post » Wed Jun 20, 2012 3:38 am

I've not got CK here atm but I think the teleports in my mod (AEzeal's fortress) do work. I use several varieties but you could look there (if you do it be prepared to keep enter pressed for 20 seconds about all navmesh errors, and then look in tamriel for cell TheFLoatingFortress. Look for the biggest tower, there are 4 stones there that teleport to 4 cities. Inside (Aezcastle or something there is near the entrance a roundfloor college sign that teleports too; interior Tincan Cave has in the back a dwemer cube which also has a teleport script (it does something different though, it teleports on picking it up, it is a handy idea to return to your house if I say so myself, you just drop it and then pick it up and there you are right back in your house.)
Anyway I use a single script for the 4 basic teleports in the tower with just another teleportmarker property (I think I just selected some markers in thecities (existing ones) to be honest I don't think I've actually tested all of them.)
User avatar
Amie Mccubbing
 
Posts: 3497
Joined: Thu Aug 31, 2006 11:33 pm

Post » Wed Jun 20, 2012 3:46 am

Ok, so Sent a pm to the author of Moon Sugar Mansion and he kindly replied and explained how he circumvented the issue, his teleport script looks like this:

Scriptname LFoxMSMTeleportTravelScript extends ObjectReference  ObjectReference Property TeleportMarkerDestination  AutoObjectReference Property TeleportMarkerBugPrevent  AutoObjectReference PlayerEvent OnActivate(ObjectReference akActionRef)	    Player = Game.GetPlayer()	    Player.MoveTo(TeleportMarkerBugPrevent)	    Utility.Wait(0.15)	    Player.MoveTo(TeleportMarkerDestination)EndEvent

He essentially teleports just outside the city (into Tamriel world-space) then immediately teleports again (into city world-space) I've tested this, and it works! even inside the buggy frostfang cell. Though it does mean two consecutive loading screens in a row.

So with that bug fixed (as best it can be I think) Can anyone tell me how to check a map marker to see if a player has visited it yet, and if he isnt disable the teleport stone, and less likely can someone tell me how to get your follower to come with you through the teleport.
User avatar
FABIAN RUIZ
 
Posts: 3495
Joined: Mon Oct 15, 2007 11:13 am

Post » Wed Jun 20, 2012 4:13 am

Haven't found it yet, but I seem to recall seeing a boolean property on map markers somewhere for that...maybe something like isDiscovered?
User avatar
Fanny Rouyé
 
Posts: 3316
Joined: Sun Mar 25, 2007 9:47 am

Post » Tue Jun 19, 2012 1:00 pm

Yeah that's the sort of thing I'm looking for, but can't find it either
User avatar
Jade
 
Posts: 3520
Joined: Mon Jul 10, 2006 6:42 am

Post » Tue Jun 19, 2012 8:30 pm

I should point out I had some strange issues too teleporting to my worldspace. I found that even if I coc'd to the worldspace I had graphic problems. When I coc'd again, it worked properly.

Currently in my scripts to move the player I actually move the player twice, to the same location. This is how I got it to work but I don't know why.

So try
Scriptname TeleP_Riften extends ObjectReference  ObjectReference Property TeleportMarker autoEvent OnActivate(ObjectReference akActionRef)	Game.GetPlayer().MoveTo(TeleportMarker)	Game.GetPlayer().MoveTo(TeleportMarker)EndEvent

This way you won't get two consecutive loading screens unless your PC is slow. When moving to the same cell it's almost instanteaneous since everything's already loaded the first time.
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Tue Jun 19, 2012 11:15 pm

You just have to check if the map marker is enabled
User avatar
Causon-Chambers
 
Posts: 3503
Joined: Sun Oct 15, 2006 11:47 pm

Post » Tue Jun 19, 2012 10:22 pm

Paladin, are your errors textures not loading? because I get that too sometimes, and assumed it was just my lousy hardware. I also got it to work twice, though I see you just send them to the same place which is different from me. I think I found the Bool in question:
http://www.creationkit.com/CanFastTravelToMarker
Will let you know if it works.
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Wed Jun 20, 2012 12:18 am

Yes I had a blank screen when I teleported there, same as you but I can't recall if my screen was more bluish or something. Definitely off though and the double-moveto method should work. It's not ideal but it works and that's all I need.

Just be careful if you're teleporting into a trigger box as you'll potentially set it off twice. Shouldn't be a big deal though.
User avatar
kyle pinchen
 
Posts: 3475
Joined: Thu May 17, 2007 9:01 pm

Post » Tue Jun 19, 2012 7:00 pm

A bit of a long shot, but suppose you used two teleport markers, and linked them with a linkedref?

Then, potentially, you could start from the Riften marker and follow the link to get the one inside. Then try 'porting to that directly.

If it works from outside riften then it has to be a problem resolving the reference over distance and multiple worldspaces. This might get you around the issue.
User avatar
Lory Da Costa
 
Posts: 3463
Joined: Fri Dec 15, 2006 12:30 pm

Post » Tue Jun 19, 2012 5:45 pm

Map Markers appear to have three states: Unknown, Heard About, and Discovered (Not visible, Black, White)
User avatar
AnDres MeZa
 
Posts: 3349
Joined: Thu Aug 16, 2007 1:39 pm

Post » Tue Jun 19, 2012 9:35 pm

Doc, I'm not sure I understand what you mean, what does linking them do? and how does it bypass the double loading screen? In other news, here is what I have so far:

ObjectReference Property TeleportMarkerDestination  AutoObjectReference Property TeleportMarkerBugPrevent  AutoObjectReference Property FTMarker AutoObjectReference Player	Event OnActivate(ObjectReference akActionRef)bool canFastTravel = FTMarker.CanFastTravelToMarker()		If canFastTravel == True				Player = Game.GetPlayer()				Player.MoveTo(TeleportMarkerBugPrevent)				Utility.Wait(0.15)				Player.MoveTo(TeleportMarkerDestination)		else			Debug.MessageBox("You can only teleport to cities you have already visited.")		endifEndEvent

This compiles fine, but when I try it ingame it always gives the false reply regardless whether the whiterun marker is enabled or not, is this because fast travel is disabled in the cell? (if it was enabled, there would be no point in having teleporters) I'm not a coder, so I know Im doing something stupid
User avatar
Charlie Ramsden
 
Posts: 3434
Joined: Fri Jun 15, 2007 7:53 pm

Post » Tue Jun 19, 2012 7:30 pm

I'd probably make my own marker type so I'd have complete control over them. How about if you had each of your teleporters come with a one-use-only item like a scroll that drops a permanent destination marker when you used it...so the player could pick where his teleporters "come out" by first travelling to the location and using the item? Set a scroll property that references the teleporter, and when the scroll is used, it

1) Drops your special TeleportDestinationMarker,
2) Passes a reference to the marker to the teleporter, which then sets the Destination marker as it's activate child.
3) Deletes itself.

The marker's OnActivate could look like this:

Event OnActivate(ObjectReference WhatActivatedMe)   If WhatActivatedme == Game.GetPlayer()	  Game.GetPlayer().MoveTo(self)   EndifEndEvent
User avatar
Conor Byrne
 
Posts: 3411
Joined: Wed Jul 11, 2007 3:37 pm

Post » Wed Jun 20, 2012 4:45 am

Doc, I'm not sure I understand what you mean, what does linking them do? and how does it bypass the double loading screen?

Well, when you create the marker you can go to the linked reference tab and set a link there. That doesn't do anything by itself, but you can link across worldspaces, just like a load door. Then you can execute GetLinkedRef on the first marker and get a reference to the second one. And try and move to the second one in a single jump.

If it's a problem finding the marker, this might just possibly side step it. Or you might just as easily find yourself in the void again. No CK at this computer, or I'd try it and see.
User avatar
Nauty
 
Posts: 3410
Joined: Wed Jan 24, 2007 6:58 pm

Post » Tue Jun 19, 2012 1:57 pm

EDIT: I got the mapmarker thing working (I think, needs more testing) But will now try the linkedref idea. Heres what is working at the moment:

Scriptname FFT_TeleP_Whiterun extends ObjectReference  ObjectReference Property TeleportMarkerDestination  AutoObjectReference Property TeleportMarkerBugPrevent  AutoObjectReference Property FTMarker AutoObjectReference Player    Event OnActivate(ObjectReference akActionRef)        Player = Game.GetPlayer()        bool canFastTravel = FTMarker.CanFastTravelToMarker()            If canFastTravel == False                Debug.Notification("You can only teleport to cities you have already visited.")	        else                 Player.MoveTo(TeleportMarkerBugPrevent)	             Utility.Wait(0.15)	             Player.MoveTo(TeleportMarkerDestination)            endif    EndEvent

Edit2: Edited for legibility
User avatar
Jonathan Braz
 
Posts: 3459
Joined: Wed Aug 22, 2007 10:29 pm

Post » Tue Jun 19, 2012 3:35 pm

@Doc

Tried the linkedref concept, but got the same bug as if I'd teleported straight there, for some reason, it has to load tamriel, then teleport into whiterun, I have no idea why.
User avatar
Heather Dawson
 
Posts: 3348
Joined: Sun Oct 15, 2006 4:14 pm

Next

Return to V - Skyrim