Jump to content

Need help with teleporters


craftymonkey

Recommended Posts

Hi! I can't figure out how to do a simple teleporter system for my mod.

 

I'm making an additional armory for Legacy of the Dragonborn and I have a stand with custom door-buttons to teleport to a place I need. The only thing is that I can't make it work.

 

If I understand correctly, two doors only connect to each other? Because I can't select a reference to existing door that is linked to another one. If I remove a portal link from that door I'm able to connect my teleport to it but that's not what I need.

 

I can add script and found a simple solution:

Scriptname MyTeleportScript extends ObjectReference  

ObjectReference Property TargetLocation Auto

Event OnActivate(ObjectReference akActionRef)
Game.GetPlayer().MoveTo(TargetLocation)
Game.EnableFastTravel()
Game.FastTravel(TargetLocation)

EndEvent

But I don't know what to do with it after I add it on my activator. I'm a junior Unity developer so Papyrus scripts don't say much to me.

 

Thanks for the help)

Link to comment
Share on other sites

After you add it to the activator you must then fill the property TargetLocation, point it to an xmarkerheading you have placed at the target location.

Link to comment
Share on other sites

After you add it to the activator you must then fill the property TargetLocation, point it to an xmarkerheading you have placed at the target location.

So I created a new activator ID, placed it to the wall, attached a script like this:

Scriptname MyTeleportScript extends ObjectReference  

ObjectReference Property LArmoryLocation Auto

Event OnActivate(ObjectReference akActionRef)
Game.GetPlayer().MoveTo(LArmoryLocation)
Game.EnableFastTravel()
Game.FastTravel(LArmoryLocation)

EndEvent

Then I attached ObjectReference property that I linked to XMarkerHeading in another location.

 

Doesn't work in the game. Also, my activator is lying on the floor instead of being static on the wall. How do I change this?

Link to comment
Share on other sites

Have you got a space before the .MoveTo ? Min you that would't compile, something else is not quite right, but difficult to know without more detail. did you double click on the activator, goto the script tab, highlight the script and select properties, point property to xmarker?

 

If its an orange rectangular activator you can just select it and rotate like any normal object.

Link to comment
Share on other sites

You have placed comment brackets { } round the code remove them and you don't need be anything after the EndEvent

 

Scriptname XXXXScript extends ObjectReference

ObjectReference Property TargetLocation Auto

Event OnActivate(ObjectReference akActionRef)
Game.GetPlayer().MoveTo(TargetLocation)
Game.EnableFastTravel()
Game.FastTravel(TargetLocation)
EndEvent

Link to comment
Share on other sites

Many thanks, it worked! I don't know why there were brackets though, I didn't put them there.

 

And the last thing: how can I make this activator static without falling from the wall? I'm goind to put different models on the board like shield to go to armory, two swords to go to left and right wings of that armory and so on. I thought being an activator it shouldn't just fall to the ground.

Link to comment
Share on other sites

To make the activator static, you can replace its collision with a vanilla static collision in nifskope. Or you can add to your script to change its motion type. Note that doing this though items tend to sink after exiting and loading your game again. To prevent this you can put a static xmarker and moveto that as well.

 

ObjectReference Property TargetLocation Auto
ObjectReference Property ActivatorLocation Auto

Event OnActivate(ObjectReference akActionRef)
 Game.GetPlayer().MoveTo(TargetLocation)
 Game.EnableFastTravel()
 Game.FastTravel(TargetLocation)
EndEvent

Event OnLoad() 
    Self.SetMotionType(4) ;set motion type to keyframed / static.
    Self.TranslateToRef(ActivatorLocation, 1000)
EndEvent

Note I used TranslateToRef instead of MoveTo because I'm not sure if Moveto would work on objects that are set to motion type keyframed, it might though.

Link to comment
Share on other sites

I am presuming he is only teleporting the player and follower NPC's in which case MoveTo and FastTravel works reliably. For other objects Translate would probably be better.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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