Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
- UnregisterForMenuOpenCloseEvent("PipboyMenu") ; Cancel player button spams
- If (asMenuName== "PipboyMenu") ; When the Pip-Boy
- If (!abOpening) ; closes,
- ; Thanks to ehtyeci for Vault Boy list!
- ; Thread: https://forums.nexusmods.com/index.php?/topic/6271136-i-there-a-list-of-perks-in-their-swf-forms/
- ; VB Viewer: http://powback.com/public/Fallout/?mobile=true
- If HH_OptionTeleportSound.GetValue() as Int == 1 ; If player wants teleport sound,
- Int iInstanceID = DRSVertibirdFlightLoadOpen.Play(Player) ; play teleport start sound at player
- EndIf
- If HH_OptionVaultBoy.GetValue() as Int == 1 ; If player wants Vault Boy animations, show thumbs up
- Game.ShowPerkVaultBoyOnHUD("Components\\VaultBoys\\Perks\\PerkClip_Default.swf")
- Utility.Wait(2) ; Give Vault Boy time to display
- EndIf
- Player.AddPerk(HH_TeleportNoFallDamage) ; IMPORTANT: Temp perk so teleport falls don't kill player!
- If HH_OptionSpinGhost.GetValue() as Int == 1 ; If player wants no spin damage (default)
- If HH_OptionSpinCamera.GetValue() as Int == 1 ; If player wants spincam after teleport,
- Player.SetGhost() ; IMPORTANT: Player immune to all damage!
- EndIf ; *** Set ghost now BEFORE the spin! ***
- If HH_OptionDevTracking.GetValue() as Int == 1 ; If player wants dev messages...
- If Player.IsGhost() ; If player is a ghost,
- Debug.Notification("Hitchhiker: Player is a ghost!") ; display dev message
- EndIf
- EndIf
- EndIf ; NOTE: Unghosting happens in HH_SpinCamera()
- If HH_OptionVaultBoy.GetValue() as Int == 1 ; If player wants Vault Boy animations, show VANS ride
- Game.ShowPerkVaultBoyOnHUD("Components\\VaultBoys\\Perks\\PerkClip_207d1.swf")
- Utility.Wait(2) ; Give Vault Boy time to display
- EndIf
- If HH_OptionTeleportSound.GetValue() as Int == 1 ; If player wants teleport sound,
- Int iInstanceID = OBJHijackerTeleportOut2DA.Play(Player) ; play teleport end sound at player
- EndIf
- ObjectReference DestinationMarker = Player.PlaceAtMe(pXMarker) ; Dynamically spawn xmarker at player
- Int Category = HH_Category.GetValue() as Int ; Retrieve Category from global
- Int TargetID = HH_TargetID.GetValue() as Int ; Retrieve TargetID from global
- If HH_IsInFarHarbor(Category, TargetID) == 1
- Go_File = "DLCCoast.esm"
- ElseIf HH_IsInNukaWorld(Category, TargetID) == 1
- Go_File = "DLCNukaWorld.esm"
- ElseIf Category == VAULTS && TargetID == 5
- Go_File = "DLCworkshop03.esm"
- Else
- Go_File = "Fallout4.esm"
- EndIf
- String Coc_Target ; Target placeholder array for COC
- ObjectReference TargetObject ; Destination target as ObjectReference
- Int Hex2Dec ; Destination hex converted to decimal
- If Category == BUS_SHELTERS
- Coc_Target = Coc_Bus[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Bus[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Bus[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Bus[TargetID]
- ElseIf Category == DINERS
- Coc_Target = Coc_Diner[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Diner[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Diner[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Diner[TargetID]
- ElseIf Category == DIVES
- Coc_Target = Coc_Dive[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Dive[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Dive[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Dive[TargetID]
- ElseIf Category == DRIVE_INS
- Coc_Target = Coc_Drive[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Drive[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Drive[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Drive[TargetID]
- ElseIf Category == FACTORIES
- Coc_Target = Coc_Factory[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Factory[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Factory[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Factory[TargetID]
- ElseIf Category == FARMS
- Coc_Target = Coc_Farm[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Farm[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Farm[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Farm[TargetID]
- ElseIf Category == JUNKYARDS
- Coc_Target = Coc_Junkyard[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Junkyard[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Junkyard[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Junkyard[TargetID]
- ElseIf Category == MILITARY_BASES
- Coc_Target = Coc_Military[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Military[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Military[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Military[TargetID]
- ElseIf Category == MONUMENTS
- Coc_Target = Coc_Monument[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Monument[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Monument[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Monument[TargetID]
- ElseIf Category == POWER_LIFTS
- Coc_Target = Coc_Power[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Power[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Power[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Power[TargetID]
- ElseIf Category == RED_ROCKETS
- Coc_Target = Coc_Red[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Red[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Red[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Red[TargetID]
- Else
- Coc_Target = Coc_Vault[TargetID]
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Vault[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Vault[TargetID], Go_File) as ObjectReference
- Hex2Dec = Go_Vault[TargetID]
- EndIf
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitching to "+Coc_Target+"\nCategory: "+Category+"\nTargetID: "+TargetID+"\nHex2Dec: "+Hex2Dec+"\nHH Go_File: "+Go_File)
- EndIf
- ; ************************************************************************************************
- ; Move the player in a manner that best utilizes player's gaming system and declared preferences!
- ; ************************************************************************************************
- WorldSpace OriginWS = Player.GetWorldSpace() ; Check player worldspace
- WorldSpace TargetWS ; Check target worldspace
- If TargetObject
- TargetWS = TargetObject.GetWorldSpace()
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker\nTargetObject: "+TargetObject+"\nTargetWS: "+TargetWS)
- EndIf
- EndIf
- If ((!TargetWS || TargetWS != OriginWS) && (HH_PlayerHasPC.GetValue() as Int == 1)) || (HH_OptionAlwaysCOC.GetValue() as Int == 1)
- Debug.CenterOnCell(Coc_Target) ; CenterOnCell to target destination
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("HITCHHIKER: CENTER ON CELL CALLED.")
- EndIf
- Else ; ELSE DO THE USUAL MOVETO ATTEMPT!!!
- STATIC TargetBase = TargetObject.GetBaseObject() as STATIC ; Check if target base object is an X/COC marker/heading
- If TargetBase == pXMarker || TargetBase == pXMarkerHeading || TargetBase == pCOCMarkerHeading
- ; Do not use XYZ offsets if destination is a marker, because teleport placed player directly on the X
- Else ; else move marker to static ref with XYZ offsets
- Float OffsetX = HH_OptionOffsetX.GetValue() ; Player sets X (default 250)
- Float OffsetY = HH_OptionOffsetY.GetValue() ; Player sets Y (default 250)
- Float OffsetZ
- If DestinationMarker.IsInInterior() ; If destination is indoors,
- OffsetZ = 50 ; don't land in the rafters
- Else
- OffsetZ = HH_OptionOffsetZ.GetValue() ; Else player sets Z (default 500)
- EndIf
- Utility.Wait(0.1)
- DestinationMarker.MoveTo(DestinationMarker, OffsetX, OffsetY, OffsetZ) ; Move marker with XYZ offsets
- DestinationMarker.MoveToNearestNavmeshLocation() ; Then move marker to nearest navmesh
- EndIf
- If HH_OptionFastTravel.GetValue() as Int == 1 ; If player wants loading screens,
- Game.FastTravel(DestinationMarker) ; move player to marker (with load screens?)
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("HITCHHIKER: FAST TRAVEL CALLED.")
- EndIf
- Else
- Player.MoveTo(DestinationMarker) ; else move player (with black screen)
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("HITCHHIKER: MOVETO CALLED.")
- EndIf
- EndIf
- EndIf
- Utility.Wait(0.1)
- ; "If TargetObject Is Furniture" caused illegal typecast compiler error, so I wrote a custom function
- HH_TryToUseFurniture(Player, TargetObject)
- ; ********************************************************************************************************
- ; Optional automatic time change on teleport
- ; ********************************************************************************************************
- If HH_OptionSetTime.GetValue() as Int == 1 ; If player wants automatic time change (default is NO)
- Int PrefTime = HH_OptionSetTimePreference.GetValue() as Int ; get preferred time
- HH_ForceTime(PrefTime) ; and set it
- EndIf
- ; ********************************************************************************************************
- ; Optional automatic weather change on teleport
- ; ********************************************************************************************************
- If !Player.IsInInterior() ; If destination is NOT indoors...
- If HH_OptionSetWeather.GetValue() as Int == 1 ; If player wants automatic weather change (default is NO)
- Int PrefWeather = HH_OptionSetWeatherPreference.GetValue() as Int ; get preferred weather
- HH_ForceWeather(PrefWeather) ; and set it
- EndIf
- EndIf
- If HH_OptionSpinCamera.GetValue() as Int == 1 ; If player wants spincam after teleport,
- HH_SpinCamera() ; call the custom spin camera function
- EndIf
- StartTimer(10, 2) ; Remove HH_TeleportNoFallDamage perk in 10 seconds
- EndIf
- EndIf
- EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement