Diablo-Style Town Portal Trouble

Post » Wed Oct 02, 2013 11:46 pm

Hey guys, how are you all?

I've come here because trying to create this is simply beyond my abilities; further, I can't find any tutorials that explain what I'm after.

As simply as possible, I am trying to create the following: a spell that summons two portals (virtually simultaneously), one in a town of my choosing (portal01), one on the player (portal02). Activating Portal02 moves the player to Portal01's location, in town; however, both portals remain open. Similarly, activating Portal01 moves the player to Portal02's location, but then shuts both portals.

Thus far, I have created a dummy cell with markers, portal effects and activators.

Using the following script, I can summon PortalFX to the spot I've allocated in Whiterun, and to myself; however, whilst Portal02's activator moves to my position, as it should, Portal01's activator does not move to it, meaning I can't teleport both ways. Obviously, I have attached a simple movement OnActivate script on the activators.

scriptName DTP_TownPortalMagicEffectScript extends ActiveMagicEffect

; The purpose of this Script is to create a Town Portal to Whiterun.

;-- Properties --------------------------------------
; Essentially, this consists of the Portal FX, the Markers, the Lights, the Triggers, and the Sounds.

ObjectReference property DTP_TownPortalTrigger01 auto
ObjectReference property DTP_TownPortalTrigger02 auto
ObjectReference property DTP_WhiteRunMarker auto
ObjectReference property DTP_PlayerMarker auto
ObjectReference property DTP_PlayerPositionHolder auto
ObjectReference property DTP_FXTownPortal01 auto
ObjectReference property DTP_FXTownPortal02 auto

;-- Variables ---------------------------------------

;-- Functions ---------------------------------------

;Ok, this will be tricky. The purpose of this first part is to open the Town Portal in Whiterun.

function SummonWhiteRunTownPortal ()
DTP_FXTownPortal01.moveto(DTP_WhiteRunMarker, 0.000000, 0.000000, 0.000000, true)
DTP_TownPortalTrigger01.moveto(DTP_WhiteRunMarker, 0.000000, 0.000000, 0.000000, true)
DTP_FXTownPortal01.setAngle(0.000000, 0.000000, 0.000000)
DTP_FXTownPortal01.enable(false)
DTP_FXTownPortal01.playGamebryoAnimation("animIdle01", true, 0.000000)
utility.wait(0.0300000)
DTP_FXTownPortal01.playGamebryoAnimation("animTrans01", true, 0.000000)
utility.wait(1.27000)
DTP_FXTownPortal01.playGamebryoAnimation("animIdle02", true, 0.000000)

endFunction

;Part 2: Now I need to open one on myself. PlayerPositionHolder will hold the my position whilst I'm at town.

function SummonSelfTownPortal ()
DTP_FXTownPortal02.moveto(DTP_PlayerMarker, 0.000000, 0.000000, 0.000000, true)
DTP_TownPortalTrigger02.moveto(DTP_PlayerMarker, 0.000000, 0.000000, 0.000000, true)
DTP_PlayerPositionHolder.moveto(DTP_PlayerMarker, 0.000000, 0.000000, 0.000000, true)
DTP_FXTownPortal02.setAngle(0.000000, 0.000000, 0.000000)
DTP_FXTownPortal02.enable(false)
DTP_FXTownPortal02.playGamebryoAnimation("animIdle01", true, 0.000000)
utility.wait(0.0300000)
DTP_FXTownPortal02.playGamebryoAnimation("animTrans01", true, 0.000000)
utility.wait(1.27000)
DTP_FXTownPortal02.playGamebryoAnimation("animIdle02", true, 0.000000)

endFunction

function OnEffectStart(actor akTarget, actor akCaster)

self.SummonWhiteRunTownPortal()
self.SummonSelfTownPortal()
endFunction

I suspect the problem is that because I'm not extending ObjectReference, the moveto function isn't working for the objects. However, I whilst I think I can create a script that extends ObjectReference with the movement function inside, I have zero clue how to call that function outside of this script (assuming this is even the problem).

If you have any thoughts, please let me know. I've spent quite some time on this, and I can't figure it out.

User avatar
Gisela Amaya
 
Posts: 3424
Joined: Tue Oct 23, 2007 4:29 pm

Return to V - Skyrim