Jump to content

Recommended Posts

Posted

I am trying to create an item or spell that can be activated to summon a door wherever you are on the map, when you enter the door it will take you to the player home I have created, when you exit the player home you exit through the spawned door. When you cast the spell again, the door will move to wherever you cast it. I know it's possible as it's been done in other mods, but I'm not sure how to go about this. Does anybody have any advice? Thanks.

Posted

I don't see it being to hard.

Basically you attach a script to the door in the object window.

In the script catch OnActivate() event and move the person who activated the door to your cell.

Maybe also after the door is activated you could dispel the the magic effect.

 

In the effect script of your spell you use the OnEffectStart() event to call placeatme to spawn your door.

Use the OnEffectFinish() event to delete the door (which your door script would trip this off by using dispel after the door is activated).

 

Can probably provide a crude brief knock up example esp if needed.

Posted

That would be awesome if you're willing. I am pretty inexperienced with scripting, I've made a couple basic scripts, but I am struggling with this one.

Posted

Here you go, crude knock up example.

 

I duplicated an exist Door in the Object Window -> WorldObjects -> Door and renamed it to TeleportDoor.

I attached a small script to the door and I filled the TeleportDestination ObjectReference property with an xMarker that was in Whiterun Bannered Mare In

Scriptname TeleportDoorScript Extends ObjectReference

ObjectReference Property TeleportDestination Auto

Event OnActivate(ObjectReference akActionRef)
    akActionRef.MoveTo(TeleportDestination)
    Self.Disable()
    Self.Delete()
EndEvent

Then Created an Explosion in Object Window -> WorldObjects -> Activator I duplicated FireWeaponMarker and renamed it TeleportDoorMarker.

I removed the existing script and then attached a small script.

I set the TeleportDoor property to point to the door I created earlier.

I set the EffectSummonBanishFX activator property to point to the Activator that has the same name (this is just the Summon FX that gets displayed when yoyu conjure the door)

Scriptname TeleportDoorMarkerScript extends ObjectReference

Door Property TeleportDoor Auto
Activator Property EffectSummonBanishFX Auto

Event OnInit()
    Self.SetAngle(0.0,0.0, Game.GetPlayer().GetAngleZ() + 90)
    Self.PlaceAtMe(EffectSummonBanishFX)
    Self.PlaceAtMe(TeleportDoor)
    Self.DeleteWhenAble()
EndEvent

I then created an Explosion in Object Window -> SpecialEffects -> Explosion.

I called it TeleportDoorEplosion.

The explosion I pointed it to use the TeleportDoorMarker to be placed.

 

I then created a Projectile in Object Window -> SpecialEffects -> Projectile.

I called it TeleportDoorProjectile.

The projectile is set to use the TeleportDoorEplosion.

 

I then created a Magic Effect in Object Window -> Magic -> Magic Effect.

I called it TeleportDoorSummonME.

The Magic effect is set as

Effect Archetype: Script

Casting Type: Fire and Forget

Delivery Type: Aimed

I also set under visual effects:

Projectile: TeleportDoorProjectile

Explosion: TeleportDoorExplosion.

(Some other setting I set as well, but these were the main ones for it to work)

 

I then Created a Spell in Object Window -> Magic -> Spell.

I called the spell TeleportDoorSpell.

I added my Magic effect that I created prior.

 

Optionally I created an empty quest with one Reference Alias filled with the Player.

I added the Spell to the reference alias.

(This was so I didn't have to Console Command or write more BS to give myself the spell).

 

So you can find the spell under the Conjuration tab in your spells inventory.

"Conjure Teleport Door" is the spells display name.

 

Cast the spell at the ground in front of you (any distance) it will spawn a set of doors.

Open the door you will be transported to Whiterun Bannered Mare Inn.

The door will be deleted after you activate it.

(You can spawn as many doors as you like, each will only be deleted after it is activated.)

 

If you look at the esp in CK, then use TeleportDoor as a word filter in the object window with All selected.

You'll see exactly what the spell is made from and uses.

(Ignore the quest as it was merely a way for you to have the spell without doing anything and it is not required).

 

 

Have fun

Posted (edited)

Wow, thank you so much for your help. Those directions were perfect. I was able to create a summon-able portal to my player home. I already appreciate your help very much, but I'm wondering if you know how to do one more thing. I was able to link a door in my home to the summon-able door so you teleport to the door in my home. I was wondering if you know a way to have it when I exit the door in my player home, it teleports you to your summoned door, wherever it is. (I deleted the self.disable and self.delete section of the script so the summoned door stays.) And on that same level, do you know how to make it so when you create a new door, the previous one disappears so there is only one summoned door in the world at any point?

Edited by dallytay
Posted

Ok, did it by just altering the scripts.

 

I created a script that attaches to a door in the house.

The door in the house needs to not be a normal door you use to exit the house.

eg: Not a door that you would normally exit the house and be on the front door step.

The door needs to be just for teleport use only.

No properties need to be set for this script

Scriptname TeleportDoorDestinationScript Extends ObjectReference

ObjectReference Property TeleportDoorSource Auto Hidden

Event OnActivate(ObjectReference akActionRef)
    If TeleportDoorSource
        akActionRef.SetAngle(0.0, 0.0, TeleportDoorSource.GetAngleZ() + 90)
        akActionRef.MoveTo(TeleportDoorSource, 0.0, 0.0, 0.0, False)
        TeleportDoorSource.Disable()
        TeleportDoorSource.Delete()
        TeleportDoorSource = None
    EndIf
EndEvent

Then I modified the script that is attached to my original spawn door.

I filled the TeleportDestination property with the door in the house.

Scriptname TeleportDoorScript Extends ObjectReference

ObjectReference Property TeleportDestination Auto

Event OnInit()
    If (TeleportDestination As TeleportDoorDestinationScript).TeleportDoorSource
        (TeleportDestination As TeleportDoorDestinationScript).TeleportDoorSource.Disable()
        (TeleportDestination As TeleportDoorDestinationScript).TeleportDoorSource.Delete()
    EndIf
    (TeleportDestination As TeleportDoorDestinationScript).TeleportDoorSource = Self
EndEvent

Event OnActivate(ObjectReference akActionRef)
    Float fAZ = TeleportDestination.GetAngleZ() - 90
    akActionRef.SetAngle(0.0, 0.0, fAZ)
    akActionRef.MoveTo(TeleportDestination, 100 * Math.Sin(fAZ), 100 * Math.Cos(fAZ), 0.0, False)
    TeleportDestination.SetOpen(False)
EndEvent

Then I edited the door marker script.

I added a TeleportDestination property to it and pointed it to the door in the house.

Scriptname TeleportDoorMarkerScript extends ObjectReference

Door Property TeleportDoor Auto
Activator Property EffectSummonBanishFX Auto
ObjectReference Property TeleportDestination Auto

Event OnInit()
    If TeleportDestination.GetParentCell() != Game.GetPlayer().GetParentCell()
        Self.SetAngle(0.0,0.0, Game.GetPlayer().GetAngleZ() - 90)
        Self.PlaceAtMe(EffectSummonBanishFX)
        Self.PlaceAtMe(TeleportDoor)
        Self.DeleteWhenAble()
    EndIf
EndEvent

So now if you try and spawn a door while in the house nothing happens.

 

If you not in the house and you spawn a door it will stay there after using it until you leave the house using the teleport door and after you teleport it gets deleted.

Also while your not in the house if you spawn another door then the prior door is deleted, so only one door at any time can be spawned.

 

I didn't alter the spell or effect at all.

Can post my updated example if you want, but really the above scripts is all that changed.

 

I think the only thing that could be improved is to add an ImageSpaceModifier to fade the screen to black when activating either door.

This way you wouldn't get a flash of a wall or background just before being moved.

In other words activate door, fade to black, move the player, fade from black.

Would make it look a little smoother.

 

It would take a whole 4 extra lines of code across 2 door scripts to do that (2 property and 2 simple calls) , damn easy...lol

But I was lazy and it was just a passing thought. :smile:

Posted

Thank you so much for your help. I tweaked a couple of minor things such as making the door not be deleted after transporting back to it, but I've pretty much left most of it as is and it works beautifully. The only issue I'm having now is the "door" (I'm using the gemportal door) will spawn at an angle depending on the angle I cast it on the ground, it doesn't stand upright. I found a potential fix by marking "always uses world orientation" which makes it stand upright, however it also forces it to be facing a certain direction, regardless of the direction I cast it. I'm toying around with it and I'm sure I'll figure it out. Thanks so much for your help, do you mind if I credit you on my mod when I release it on the nexus?

Posted

What is the "gemportal", if I know it's proper editor name or the nif model it uses then i can tell you how to make it stand upright regardless of the angle the spell hits the ground.

 

In the Door Marker script I used this line;

Self.SetAngle(0.0,0.0, Game.GetPlayer().GetAngleZ() - 90)

to set the x and y angle to 0 and to rotate the door -90 degrees to the way the player is facing.

That is based for the door I was spawning.

Tthat set angle is setting the marker angle so placeAtme would place the door at the same angle as the marker.

 

The door your using may not be centered or rotated the same as the door I was using.

So you would adjust things based on the door your using.

 

If it was me (tedious but this way you can visualize things easier to work them out):

Open CK and load a plugin in or whatever (you are not going to saving anything, it's just to use the editor to work things out)

In CK I would go to a cell (eg; aaamarkers as it's near the top of the list) and i would drop the door in the cell and then i would edit the position of the door so everything is at 0

eg; X, Y Z position and angle all set to 0.000

 

Then i would drop an Actor in the cell and do the same and set them to 0 position and angle.

 

Then you can see the exact way everything faces at 0 as to what direction things face and angle.

 

Once you know that it's easy to formulate what angle needs to be what.

 

After that just close that instance of CK without saving.

Posted

That doesn't seem to change anything, I've tried multiple values and it casts the door at a parallel angle from my POV (not the ground) regardless of what value I put in getanglez.

  • Recently Browsing   0 members

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