Jump to content

[LE] Creating Custom Portal System


Recommended Posts

Oh ya one more pit fall of this stuff ... If you're in a quest with a quest follower. That follower is considered part of your group/party

and will port with you to the fixed location. But, will not port back to the recall marker. Quest broken ... NPC permanently out of place.

Well unless you console fix it but you may as well say it got broken ... There is also when mounted or in combat to consider.

Link to comment
Share on other sites

Put it in the same cell as the permanent marker. So this can go to any city that is close enough? Or just one city that is the only city you're porting to (a permanent marker)?

Loc01 (the permanent marker) is also an XMarker right?

Edited by NexusComa2
Link to comment
Share on other sites

Could figure this off a Global bool for "is the recall set or not". or a first time flag set up ...
Bool property FTF = true auto hidden
If FTF == true
FTF = false
;1st time ran code
Else
; ...
EndIf

Many things you could test for that really ...
Considering you're porting to towns you may want to also have it check if you're even in the map world space too.
There is way more to this than just moving and/or fast traveling when it comes to, should I even be able to do it right now ...
ObjectReference Property RecallMarker Auto
ObjectReference Property LoC01 Auto ... this is a marker too
You could set up one in each town and do what you wanted with a menu
without the distance check or you could check them all for closest.
Event OnEffectStart (Actor Target, Actor Caster)
Float Distance = Game.GetPlayer().GetDistance(Loc01)
If Distance > 7000
;---------- how to move to a loc marker ... this part could be ElseIf 'd out loc2 loc3 figured off distance.
RecallMarker.MoveTo(Caster)
Caster.MoveTo(Loc01)
Game.EnableFastTravel()
Game.FastTravel(Loc01)
;----------
Else
;---------- how to move back
Caster.Moveto(RecallMarker)
Game.EnableFastTravel()
Game.FastTravel(RecallMarker)
;----------
EndIf
EndEvent

This is a fun code to do but in the end a headache filled with hidden errors.
If you were to really do this right I'd start with following how the carriage ride npc script works.
You could add in your Recall Marker when the menu opens in real time.
Edited by NexusComa2
Link to comment
Share on other sites

Sorry about the confusion. I was trying the suggested distance check because it made sense that I wouldn't necessarily want to be able to teleport to the Town Marker if I am already next to it. Just exploring possible condition solutions with that.

MoveTo is working just fine for whatever I decide Loc01 is, Second spell cast to return to RecallMarker is what was not working. Going to do a test with that right now and make sure it will work without the worldspace or distance conditions.

 

Update/Edit:

Alright that works just like that. I had a few too many IF statements placed. So what I would like to do next for a bit of flair is to leave a temporary special effect wherever the recall Marker is moved to (like Mage Light or a portal vfx) until the recall marker is returned to, then disable the effect until the spell is cast again.

Edited by Guest
Link to comment
Share on other sites

Oh ya one more pit fall of this stuff ... If you're in a quest with a quest follower. That follower is considered part of your group/party

and will port with you to the fixed location. But, will not port back to the recall marker. Quest broken ... NPC permanently out of place.

Well unless you console fix it but you may as well say it got broken ... There is also when mounted or in combat to consider.

Mounted would be more concerning thant in combat. If someone wants to port out of combat that should be "fine" unless it makes enemy AI derp or decide to do a death march across the map after the player. Would like to create a conversation flag or tick to make sure the player isn't talking to an NPC, and block the cast if they are.

 

As for a follower breaking a quest for leaving an area, is there a way to copy the follower and disable their AI and "leave them in place" while a player farts about in town then ports back (destroying the copy on return) Or checking the Story Manager for quest in progress and blocking them from porting with you?

OR for telporting back to the Recall Marker what if it was treated like a Forced Used transition? Player ports back, script checks for follower, if there is (or more) who haven't been put into "Wait Here" forces a trigger to teleport them back since Fast Travel doesn't figure it out?

 

Put it in the same cell as the permanent marker. So this can go to any city that is close enough? Or just one city that is the only city you're porting to (a permanent marker)?

Loc01 (the permanent marker) is also an XMarker right?

Yeah I dropped the recall marker in 'near' the permanent marker and have no problems porting to and from after the recall has been moved. (Or I hope it's been moved? Sort of concerned I'm just filling the worldspace with duplicate markers?)

 

 

Could figure this off a Global bool for "is the recall set or not". or a first time flag set up ...
Bool property FTF = true auto hidden
If FTF == true
FTF = false
;1st time ran code
Else
; ...
EndIf

Many things you could test for that really ...

Considering you're porting to towns you may want to also have it check if you're even in the map world space too.
There is way more to this than just moving and/or fast traveling when it comes to, should I even be able to do it right now ...

ObjectReference Property RecallMarker Auto
ObjectReference Property LoC01 Auto ... this is a marker too
You could set up one in each town and do what you wanted with a menu
without the distance check or you could check them all for closest.
Event OnEffectStart (Actor Target, Actor Caster)
Float Distance = Game.GetPlayer().GetDistance(Loc01)
If Distance > 7000
;---------- how to move to a loc marker ... this part could be ElseIf 'd out loc2 loc3 figured off distance.
RecallMarker.MoveTo(Caster)
Caster.MoveTo(Loc01)
Game.EnableFastTravel()
Game.FastTravel(Loc01)
;----------
Else
;---------- how to move back
Caster.Moveto(RecallMarker)
Game.EnableFastTravel()
Game.FastTravel(RecallMarker)
;----------
EndIf
EndEvent

 

This is a fun code to do but in the end a headache filled with hidden errors.

If you were to really do this right I'd start with following how the carriage ride npc script works.

You could add in your Recall Marker when the menu opens in real time.

 

I think having the marker manually placed nulls the bool function. Checking -where- it is currently though might be useful? Would probably need to make a separate function to show a message for where the recall is placed that doesn't overwrite the spell casts.

 

And as I mentioned, would like to also attach a VFX to the Recall Marker so I can see where it's at, if say I travel back on foot, and maybe also do a distance check to Recall Marker as well, if I'm too close to it I would want to just move it next cast and initiate teleport to town.

Edited by Guest
Link to comment
Share on other sites

  • 3 weeks later...

Going to update this (the current script from the previous post isn't working as intended. The only time the teleport going to the Moving marker works is if it's done from another cell (interior vs exterior for example.) Otherwise when cast the spell always returns the player to the Moving Marker, without ever moving it from its original position in the world space. Only from a different cell does the spell return the player to the dedicated town location.


Another matter is being able to recast the spell instantly, doing so will initiate a cascade teleport to the same marker and invoke loading screen after loading screen.

 

 

I would like to just scrap instantly teleporting the player, and instead spawn an activatable actor that requires using to then teleport the player to town to work around some of the issues with casting and the Moving Marker not working at all when in the same worldspace with it.

Link to comment
Share on other sites

What is the issue with scripts of type ActiveMagicEffect (AME)?

 

In opposite to papyrus scripts of type actor, objectReference, ReferenceAlias etc., AME scripts do not have a valid self on it.

That means, if player cast the same spell (AME script will be running) different times, every script is part of a new spell instance.

The properties and variables inside the script are every time virgin. What do you have to do?

 

1) create a new quest, attach a script to the quest and add properties to this script as storage for your teleport locations or markers

 

 

Scriptname nightsTeleportDataQuestScript extends Quest Hidden
; https://forums.nexusmods.com/index.php?/topic/10074768-creating-custom-portal-system/

  Static PROPERTY XMarker auto        ; a Xmarker baseobject to place it at recall location

  ObjectReference PROPERTY myHomePosition auto
  {we have to teleport between two positions the current and a recall}
 
  ObjectReference myRecallPosition    ; filled at runtime with placed xMarker objectRef

; -- EVENT --

EVENT OnInit()
    Debug.Trace(" OnInit() - has been called for " +self)        ; debugging only, see "papyrus.0.log"
ENDEVENT

 

 

 

2a) inside your MagicEffect script use this quest as property like next

    Quest PROPERTY myQuest auto

2b) inside your MagicEffect script get access to stored data of the quest script with this code

nightsTeleportDataQuestScript ps = myQuest as nightsTeleportDataQuestScript
IF ( ps )
    objectReference oRef = ps.myHomePosition
ENDIF

3) Its possible to create a new GlobalVariable with CK and use the value of this globalVar in your MagicEffect script. The globalVar.GetValue() can be used as follow.

    GlobalVariable PROPERTY myGlobal auto   ; return of myGlobal.GetValue() see spoiler, first time its 0.0

 

 

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    float f = myGlobal.GetValue()

    IF (f == 0)
       myGlobal.SetValue(2)                ; busy with action 1

       myGlobal.SetValue(1)                ; ready for action 2

    ELSEIF (myGlobal.GetValue() == 1)
       myGlobal.SetValue(2)                ; busy with action 2

       myGlobal.SetValue(0)                ; ready for action 1
    ENDIF
ENDEVENT

 


Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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