Help with adding teleport spell to players inventory!

Post » Fri Aug 26, 2011 5:56 pm

Hi, i'm making a house/home mod where i have created my own worldspace and i'm making a teleport spell for it, should the spell just be like this?
scn joeTeleportplayer.moveto islandxmarkerEnd


And if yes, how do i add this spell to the players inventory when they load their save? Do i just make a quest that somehow gives the player the spell?
Thank you very much!! :D
User avatar
Taylor Tifany
 
Posts: 3555
Joined: Sun Jun 25, 2006 7:22 am

Post » Sat Aug 27, 2011 3:08 am

Hi, i'm making a house/home mod where i have created my own worldspace and i'm making a teleport spell for it, should the spell just be like this?
scn joeTeleportplayer.moveto islandxmarkerEnd


No. Using Player.MoveTo to get to another worldspace can result in serious problems with dialogue. Characters that should be able to talk to you will instead display "I have no greeting" when you try to talk to them. You can avoid this by using doors to get to and from your worldspace. To mimic a teleport spell using doors, follow these steps:
1. Place one door in your worldspace and another in Tamriel, then link them together. Make sure the Tamriel door is in a location you want the Player to appear when they leave your worldspace.
2. Make both doors persistent references and give them unique reference IDs (I'll use HomeWorldDoorRef & TamDoorRef as examples).
3. Move the doors below the ground so they can't be seen, but keep the teleport makers at the spots you want the Player to appear in.
4. Use the following script:

scn JoeTeleportBegin ScriptEffectStartIf Player.GetInWorldspace Tamriel == 1Player.Activate TamDoorRefElseIf Player.GetInWorldSpace YourHomeWorldSpaceName == 1Player.Activate HomeWorldDoorRefElseMessage "You cannot teleport from here."EndifEnd

^That will allow you to teleport to your worldspace when you're in Tamriel and back to Tamriel when you're in your worldspace.

Note: Sometimes other NPCs can use doors set up like this, even though they're below ground. To avoid this, make a unique key for your doors. Then make both doors owned by the PlayerFaction (not Player, but PlayerFaction), set the lock level to 'Needs a Key' and select your newly created key from the list. DO NOT place your key in game and never give it to ANYONE. Since the doors are owned by the PlayerFaction, anyone belonging to the PlayerFaction (i.e. the Player, companions, etc.) can go through them without needing the key and the doors will remain locked to everyone else. If you go through one of them with the key, they will be unlocked and anyone can go through them.

How do i add this spell to the players inventory when they load their save? Do i just make a quest that somehow gives the player the spell?
Thank you very much!! :D

You can indeed make a quest that will add the teleport spell to the Player on startup. To do so, follow these steps:

1. At the top of the CS, click on 'Character' and select 'Quests'.
2. Right click in the quest list and select 'New'.
3. Give your quest a name (I'll use AAAJoeTeleportAddQuest as an example) and set the Priority above 0, then click 'Okay' (on the bottom right corner) and close the window.
4. Create the following script and set it as a Quest script:
scn JoeTeleportSpellAddBegin GameModePlayer.Addspell JoeTeleportSpellStopQuest AAAJoeTeleportAddQuestEnd


5. Open your quest again and select your newly created quest script for it, then click 'Okay' and close th window.

That should do it.

Edit: Typo
User avatar
dav
 
Posts: 3338
Joined: Mon Jul 30, 2007 3:46 pm

Post » Sat Aug 27, 2011 3:10 am

Thank you very, very much!
That was very helpful :D
Would never have thought that player.moveto caused bugs with alternate worldspaces, so that would have been a very bad mistake.
I'm off to mod, thank you very much again, when i someday release, your name shall be included in the credits :P

(Also, i just clicked your sig, and i might use your alternate welkynd stones, so thank you for that aswell)
User avatar
Dorian Cozens
 
Posts: 3398
Joined: Sat May 26, 2007 9:47 am


Return to IV - Oblivion