Jump to content

How to detect player Fast Travel in script


Recommended Posts

Hi,

 

I would like to detect when the player is fast traveling in my script. Is there a way to do this without the locationchange ?

 

If you'd like to make a script that detects fast traveling only (i.e., to exclude load doors), you can either

 

- Start a very short timer (StartTimer()) or wait (Utility.Wait()) after the Pip-Boy close animation finishes: when the timer expires, check if OnPlayerTeleport is received or the FaderMenu (miscellaneous menu during fading out/in) has been opened,

 

- Edit the Pip-Boy menu interface by setting up an AS3 to Papyrus event (requires F4SE).

Link to comment
Share on other sites

Just had a dig around and my "charge caps for fast travel like in Fallout 76" function does it like this:

Bool bFastTravelMenu = false
...

Self.RegisterForPlayerTeleport()
Self.RegisterForMenuOpenCloseEvent("PipboyMenu")
...

Event OnPlayerTeleport()
If (bFastTravelMenu == TRUE) && (pPlayerREF.GetCurrentLocation() != pInstituteConcourseLocation)
    ; PUNISH THEM
EndIf
bFastTravelMenu = FALSE
EndEvent

Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
 If (asMenuName == "PipboyMenu")
   If (abOpening == True) 
      bFastTravelMenu = True 
   Else 
     Utility.Wait(1.0) ;for events to happen 
     bFastTravelMenu = False
   EndIf 
EndIf 
EndEvent

 

Since it contains a blocking Wait, for elegance it wants to be in a standlone async script (not part of a larger event driven script).

 

The only gotcha is if a player open/close pipboy within 1 second of using a load door that is detected as fast travel.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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