Jump to content

Script help for portable dimension/pocket home


Recommended Posts

Hi,
I would like to make a spell to a pocket home and have an item that takes the player back to where they where.
I'm good at the designing part but the scripting part...not so good.
I have looked at mark and recall mods on the Nexus and on a few pocket dimensions. I also looked at some scripts here at the forum too.
I get parts of the script but not all of it and I do not want to just grab someone elses scripts and use it as my own.
I be happy if someone could write the code and guide me through how to implement it.
Thank you.

Link to comment
Share on other sites

You will only learn how to write scripts by looking at them. By that logic you will be grabbing these 2 from me...

First you would create your pocket world. Then add 2 x-markers to it. 1 x-marker will mark the "landing spot" for the player. The other will sit nearby.

Then you need to make a spell and a magic effect for it in CK. Afterwards you can add a script to the magic effect and paste this in.

Scriptname MyMod_TeleportPlayerHome extends ActiveMagicEffect

ObjectReference Property xMarkPocket Auto
ObjectReference Property xMarkRecall Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

    xMarkRecall.MoveTo(akCaster)
    akCaster.MoveTo(xMarkPocket)

EndEvent

Save the script. Make sure your custom script name matches the Scriptname within the script. Once you have successfully compiled the script, exit the script and right-click it to fill out the properties window. Set xMarkPocket to your x-marker "landing spot" and xMarkRecall to the x-marker off to the side.

Now you should be able to get to your pocket world.

To get back you need to create the activator object and add it to your pocket world. Also add the following script to your activator, rename the script contents as needed.

Scriptname MyMod_TeleportPlayerRecall extends ObjectReference

ObjectReference Property xMarkPocket Auto
ObjectReference Property xMarkRecall Auto

Event OnActivate(ObjectReference akActionRef)

    akActionRef.MoveTo(xMarkStart)
    xMarkRecall.MoveTo(xMarkPocket)

EndEvent

Save, exit, and once again fill out the properties with the x-markers from your pocket world.

Now when the player activates the object, they should be moved to their recall position and the recall x-marker will reset cleanly for uninstalls if needed.

Edit: I forgot to share my sources.

https://www.creationkit.com/index.php?title=OnEffectStart_-_ActiveMagicEffect
https://www.creationkit.com/index.php?title=MoveTo_-_ObjectReference
https://www.creationkit.com/index.php?title=OnActivate_-_ObjectReference
https://www.creationkit.com/index.php?title=Magic_Effect
https://www.creationkit.com/index.php?title=Activator

Edited by Dromundas
Link to comment
Share on other sites

  • Recently Browsing   0 members

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