Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname HH_QuestScript extends Quest
- { It just works. }
- ;/
- Fallout 4 Papyrus script by ThoraldGM | http://thoraldgm.com | Updated 20171227
- Hitchhiker mod: (url pending)
- SCRIPT SECTIONS:
- LINE 0030: PROPERTIES
- LINE 0168: ON INIT
- LINE 0212: HH START HITCHING
- LINE ####: (OPTIONAL AUTO TIME CHANGE)
- LINE ####: (OPTIONAL AUTO WEATHER CHANGE)
- LINE ####: HH SPIN CAMERA
- LINE ####: ON TIMER
- LINE ####: HH STOP SPINNING
- LINE ####: HH SET RANDOM DESTINATION
- LINE ####: HH IS IN FAR HARBOR
- LINE ####: HH IS IN NUKA WORLD
- LINE ####: IS FURNITURE
- LINE ####: HH TRY TO USE FURNITURE
- LINE ####: HH FORCE TIME
- LINE ####: HH FORCE WEATHER
- /;
- ; ------------------------------------------------------------------------------------------------------------
- ; PROPERTIES
- ; ------------------------------------------------------------------------------------------------------------
- ; ************************************************************************************************************
- ; Player menu options (21 here. Plus Force Time Now, Force Weather Now, Spin Idle Camera Now, & Restore Defaults):
- ; ************************************************************************************************************
- GlobalVariable Property HH_OptionCamMaxDistance Auto Mandatory
- { Max camera distance (default: 200, vanilla: 150) }
- GlobalVariable Property HH_OptionCamMinDistance Auto Mandatory
- { Min camera distance (default: 100, vanilla: 0) }
- GlobalVariable Property HH_OptionDevTracking Auto Mandatory
- { Does player want dev messages? (default: no) }
- GlobalVariable Property HH_OptionExcludeDLC Auto Mandatory
- { Turn all DLC on/off in available destinations (default: on if installed) }
- GlobalVariable Property HH_OptionExcludeFH Auto Mandatory
- { Turn Far Harbor DLC on/off in destinations (default: on if installed) }
- GlobalVariable Property HH_OptionExcludeNW Auto Mandatory
- { Turn Nuka-World DLC on/off in destinations (default: on if installed) }
- GlobalVariable Property HH_OptionExcludeVT Auto Mandatory
- { Turn Vault-Tec DLC on/off in destinations (default: on if installed) }
- GlobalVariable Property HH_OptionFastTravel Auto Mandatory
- { Does player want loading screens? (default: yes) }
- GlobalVariable Property HH_OptionHeal Auto Mandatory
- { Does player want to heal after teleport? (default: no) }
- GlobalVariable Property HH_OptionOffsetX Auto Mandatory
- { Player can choose X offset (default: 250) }
- GlobalVariable Property HH_OptionOffsetY Auto Mandatory
- { Player can choose Y offset (default: 250) }
- GlobalVariable Property HH_OptionOffsetZ Auto Mandatory
- { Player can choose Z offset (default: 500) }
- GlobalVariable Property HH_OptionSetTime Auto Mandatory
- { Change time after teleport? (default: no) }
- GlobalVariable Property HH_OptionSetTimePreference Auto Mandatory
- { Preferred game hour (player sets in menu) }
- GlobalVariable Property HH_OptionSetWeather Auto Mandatory
- { Change weather after teleport? (default: no) }
- GlobalVariable Property HH_OptionSetWeatherPreference Auto Mandatory
- { Preferred game weather (player sets in menu) }
- GlobalVariable Property HH_OptionSitFurniture Auto Mandatory
- { If destination is furniture, choose whether to use it (default: yes) }
- GlobalVariable Property HH_OptionSpinCamera Auto Mandatory
- { Does player want teleport to spin camera? (default: yes) }
- GlobalVariable Property HH_OptionSpinDuration Auto Mandatory
- { How long should camera spin? (default: 20 seconds) }
- GlobalVariable Property HH_OptionSpinGhost Auto Mandatory
- { Does player want invulnerable spin? (default: yes) }
- GlobalVariable Property HH_OptionTeleportSound Auto Mandatory
- { Does player want teleport sound? (default: yes) }
- ; ************************************************************************************************************
- ; Weather:
- ; ************************************************************************************************************
- Weather Property DefaultWeather Auto Const Mandatory
- { Default weather (outdoors) }
- Weather Property CommonwealthClear Auto Const Mandatory
- { Clear }
- Weather Property CommonwealthDusty Auto Const Mandatory
- { Dusty }
- Weather Property CommonwealthFoggy Auto Const Mandatory
- { Foggy }
- Weather Property CommonwealthMisty Auto Const Mandatory
- { Misty }
- Weather Property CommonwealthMistyRainy Auto Const Mandatory
- { Misty Rainy }
- Weather Property CommonwealthOvercast Auto Const Mandatory
- { Overcast }
- Weather Property CommonwealthGSRadstorm Auto Const Mandatory
- { Radstorm }
- Weather Property CommonwealthRain Auto Const Mandatory
- { Rain }
- ; ************************************************************************************************************
- ; Everything else:
- ; ************************************************************************************************************
- Book Property HH_Map Auto Const Mandatory
- { Hitchhiker map }
- FormList Property HH_IsFurniture Auto Const Mandatory
- { Formlist of formlists of furnitures }
- GlobalVariable Property HH_IsSpinning Auto Mandatory
- { Is the camera currently spinning? }
- GlobalVariable Property HH_PlayerHasFH Auto Mandatory
- { Does player have Far Harbor DLC? }
- GlobalVariable Property HH_PlayerHasNW Auto Mandatory
- { Does player have Nuka-World DLC? }
- GlobalVariable Property HH_PlayerHasVT Auto Mandatory
- { Does player have Vault-Tec DLC? }
- GlobalVariable Property HH_Category Auto Mandatory
- { Which category did player select? }
- GlobalVariable Property HH_TargetID Auto Mandatory
- { Which location did player select? }
- GlobalVariable Property HH_ShowMenu Auto Mandatory
- { Don't show menu when map placed in inventory }
- GlobalVariable Property pGameHour Auto Mandatory
- { Current game hour (from vanilla CK) }
- Perk Property HH_TeleportNoFallDamage Auto Const Mandatory
- { Temp perk so teleport falls don't kill player }
- Sound Property DRSVertibirdFlightLoadOpen Auto Const Mandatory
- { Teleport start sound effect }
- Sound Property OBJHijackerTeleportOut2DA Auto Const Mandatory
- { Teleport end sound effect }
- STATIC Property pXMarker Auto Const Mandatory
- { Xmarker (from vanilla CK) }
- STATIC Property pXMarkerHeading Auto Const Mandatory
- { Xmarker heading (from vanilla CK) }
- STATIC Property pCOCMarkerHeading Auto Const Mandatory
- { COC Xmarker heading (from vanilla CK) }
- Actor Player ; Player actor
- String GO_FILE = "Fallout4.esm" ; Vanilla or DLC target destination?
- Int BUS_SHELTERS = 1 ; Category ints (makes code easier to read)
- Int DINERS = 2
- Int DIVES = 3
- Int DRIVE_INS = 4
- Int FACTORIES = 5
- Int FARMS = 6
- Int JUNKYARDS = 7
- Int MILITARY_BASES = 8
- Int MONUMENTS = 9
- Int POWER_LIFTS = 10
- Int RED_ROCKETS = 11
- Int VAULTS = 12
- Int[] Go_Dive ; Array of Dives (hex refIDs converted to decimal)
- Int[] Go_Bus
- Int[] Go_Diner
- Int[] Go_Drive
- Int[] Go_Factory
- Int[] Go_Farm
- Int[] Go_Junkyard
- Int[] Go_Military
- Int[] Go_Monument
- Int[] Go_Power
- Int[] Go_Red
- Int[] Go_Vault
- ; ------------------------------------------------------------------------------------------------------------
- ; EVENT: ON INIT
- ; ------------------------------------------------------------------------------------------------------------
- Event OnInit()
- Player = Game.GetPlayer() ; Player actor
- Utility.Wait(0.1) ; Wait a moment before using actor
- If Player.GetItemCount(HH_Map) == 0 ; If player doesn't have hitchhiker map,
- HH_ShowMenu.SetValue(0) ; don't show menu when map placed in inventory
- Utility.Wait(5) ; wait 5 seconds
- Player.AddItem(HH_Map) ; spawn hitchhiker map in player inventory
- EndIf
- Go_Dive = New Int[13] ; Array of Dives (hex refIDs converted to decimal)
- Go_Dive[0] = 101019 ; Colonial Taphouse
- Go_Dive[1] = 146480 ; Concord Speakeasy
- Go_Dive[2] = 280352 ; Doc Phosphate's Saloon (NUKA-WORLD DLC)
- Go_Dive[3] = 406929 ; Dugout Inn
- Go_Dive[4] = 2240517 ; Forest Grove Pub Buffet
- Go_Dive[5] = 313396 ; Gwinnett Restaurant
- Go_Dive[6] = 857986 ; Nahant Bar Restaurant
- Go_Dive[7] = 1534528 ; Prost Bar
- Go_Dive[8] = 1730482 ; Quincy Liquors
- Go_Dive[9] = 993894 ; Shamrock Taphouse
- Go_Dive[10] = 13532 ; The Last Plank (FAR HARBOR DLC)
- Go_Dive[11] = 1094147 ; The Third Rail
- Go_Dive[12] = 1835650 ; Ticker Tape Lounge
- ; IF HEX CONVERSION METHOD WORKS FOR ALL 13 DIVE BARS, ADD REMAINING 196 DESTINATIONS HERE
- Go_Bus = New Int[10]
- Go_Diner = New Int[30]
- Go_Drive = New Int[12]
- Go_Factory = New Int[12]
- Go_Farm = New Int[12]
- Go_Junkyard = New Int[20]
- Go_Military = New Int[20]
- Go_Monument = New Int[30]
- Go_Power = New Int[15]
- Go_Red = New Int[25]
- Go_Vault = New Int[10]
- EndEvent
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH START HITCHING
- ; ------------------------------------------------------------------------------------------------------------
- Function HH_StartHitching()
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: Started hitching...")
- EndIf
- If HH_OptionTeleportSound.GetValue() as Int == 1 ; If player wants teleport sound,
- Int iInstanceID = DRSVertibirdFlightLoadOpen.Play(Player) ; play teleport start sound at player
- EndIf
- Int Category = HH_Category.GetValue() as Int ; Retrieve Category from global
- Int TargetID = HH_TargetID.GetValue() as Int ; Retrieve TargetID from global
- 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_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
- 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
- ObjectReference TargetObject ; Destination target as ObjectReference
- ; Next block looks redundant but the alternative is to create 12 nested formlists and 209 destination globals in CK
- If Category == BUS_SHELTERS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Bus[TargetID], Go_File) as ObjectReference) ; MoveTo LOADS destination
- TargetObject = Game.GetFormFromFile(Go_Bus[TargetID], Go_File) as ObjectReference ; THEN destination can be saved to variable
- ElseIf Category == DINERS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Diner[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Diner[TargetID], Go_File) as ObjectReference
- ElseIf Category == DIVES
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Dive[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Dive[TargetID], Go_File) as ObjectReference
- ElseIf Category == DRIVE_INS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Drive[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Drive[TargetID], Go_File) as ObjectReference
- ElseIf Category == FACTORIES
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Factory[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Factory[TargetID], Go_File) as ObjectReference
- ElseIf Category == FARMS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Farm[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Farm[TargetID], Go_File) as ObjectReference
- ElseIf Category == JUNKYARDS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Junkyard[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Junkyard[TargetID], Go_File) as ObjectReference
- ElseIf Category == MILITARY_BASES
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Military[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Military[TargetID], Go_File) as ObjectReference
- ElseIf Category == MONUMENTS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Monument[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Monument[TargetID], Go_File) as ObjectReference
- ElseIf Category == POWER_LIFTS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Power[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Power[TargetID], Go_File) as ObjectReference
- ElseIf Category == RED_ROCKETS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Red[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Red[TargetID], Go_File) as ObjectReference
- Else
- Category = VAULTS
- DestinationMarker.MoveTo(Game.GetFormFromFile(Go_Vault[TargetID], Go_File) as ObjectReference)
- TargetObject = Game.GetFormFromFile(Go_Vault[TargetID], Go_File) as ObjectReference
- EndIf
- STATIC TargetBase = TargetObject.GetBaseObject() as STATIC ; Check if target base object is an X/COC marker/header
- 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 = HH_OptionOffsetZ.GetValue() ; Player sets Z (default 500)
- 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?)
- Else
- Player.MoveTo(DestinationMarker) ; else move player (with black screen)
- 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
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH SPIN CAMERA
- ; ------------------------------------------------------------------------------------------------------------
- Function HH_SpinCamera()
- Int SpinSeconds
- Game.ForceFirstPerson() ; IMPORTANT: Must start/run spin in first person!
- ; Thx steve40 for distance & setini code
- Float CamMinDistance = HH_OptionCamMinDistance.GetValue() ; Player chooses min distance (default: 100, vanilla: 0)
- Float CamMaxDistance = HH_OptionCamMaxDistance.GetValue() ; Player chooses max distance (default: 200, vanilla: 150)
- Utility.SetIniFloat("fVanityModeMinDist:Camera", CamMinDistance) ; Set min
- Utility.SetIniFloat("fVanityModeMaxDist:Camera", CamMaxDistance) ; Set max
- Utility.Wait(1) ; Wait a moment
- Utility.SetINIBool("bForceAutoVanityMode:Camera", true) ; Spin the idle camera around player
- HH_IsSpinning.SetValue(1) ; Flag player / camera as spinning
- SpinSeconds = HH_OptionSpinDuration.GetValue() as Int ; Player chooses how long to spin (default: 20 seconds)
- StartTimer(SpinSeconds, 1) ; Wait SpinSeconds then call StopSpinning from OnTimer event
- EndFunction
- ; -----------------------------------------------------------------------------------------------------------
- ; EVENT: ON TIMER
- ; -----------------------------------------------------------------------------------------------------------
- Event OnTimer(int aiTimerID) ; Cancel timer
- If aiTimerID == 1
- HH_StopSpinning() ; Call StopSpinning function
- ElseIf aiTimerID == 2
- Player.RemovePerk(HH_TeleportNoFallDamage) ; Temp perk removed after teleport is safely completed
- If HH_OptionHeal.GetValue() as Int == 1 ; If player wants healed after teleport,
- Player.ResetHealthAndLimbs() ; reset health and limbs
- EndIf
- Else
- ; Placeholder for additional timers
- EndIf
- EndEvent
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH STOP SPINNING
- ; ------------------------------------------------------------------------------------------------------------
- Function HH_StopSpinning()
- CancelTimer(1) ; Cancel any lingering StopSpinning timers
- If Player.IsGhost() ; If player is a ghost,
- Player.SetGhost(false) ; IMPORTANT: Undo player's temporary invulnerability
- If HH_OptionDevTracking.GetValue() as Int == 1 ; If player wants dev messages
- If Player.IsGhost() == false ; If player is no longer a ghost,
- Debug.Notification("Hitchhiker: Player is not a ghost.") ; display dev message
- EndIf
- EndIf
- EndIf
- If HH_IsSpinning.GetValue() as Int == 1 ; If player is spinning,
- Utility.SetINIBool("bForceAutoVanityMode:Camera", false) ; stop spinning
- Game.ForceFirstPerson() ; IMPORTANT: Call this or spin will last forever!
- HH_IsSpinning.SetValue(0) ; Flag player / camera as no longer spinning
- EndIf ; Done with optional spincam effect
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH SET RANDOM DESTINATION
- ; ------------------------------------------------------------------------------------------------------------
- Function HH_SetRandomDestination(Int Category)
- Int TargetCount
- Int TargetID
- Int ReRoll
- Int ExcludeDLC = HH_OptionExcludeDLC.GetValue() as Int
- Int ExcludeFH = HH_OptionExcludeFH.GetValue() as Int
- Int ExcludeNW = HH_OptionExcludeNW.GetValue() as Int
- Int ExcludeVT = HH_OptionExcludeVT.GetValue() as Int
- If HH_PlayerHasFH.GetValue() as Int == 0
- ExcludeFH = 1
- EndIf
- If HH_PlayerHasNW.GetValue() as Int == 0
- ExcludeNW = 1
- EndIf
- If HH_PlayerHasVT.GetValue() as Int == 0
- ExcludeVT = 1
- EndIf
- If Category == BUS_SHELTERS
- TargetCount = Go_Bus.Length
- ElseIf Category == DINERS
- TargetCount = Go_Diner.Length
- ElseIf Category == DIVES
- TargetCount = Go_Dive.Length
- ElseIf Category == DRIVE_INS
- TargetCount = Go_Drive.Length
- ElseIf Category == FACTORIES
- TargetCount = Go_Factory.Length
- ElseIf Category == FARMS
- TargetCount = Go_Farm.Length
- ElseIf Category == JUNKYARDS
- TargetCount = Go_Junkyard.Length
- ElseIf Category == MILITARY_BASES
- TargetCount = Go_Military.Length
- ElseIf Category == MONUMENTS
- TargetCount = Go_Monument.Length
- ElseIf Category == POWER_LIFTS
- TargetCount = Go_Power.Length
- ElseIf Category == RED_ROCKETS
- TargetCount = Go_Red.Length
- Else
- Category = VAULTS
- TargetCount = Go_Vault.Length
- EndIf
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: Category is " + Category + ".")
- Debug.TraceAndBox("Hitchhiker: TargetCount is " + TargetCount +".")
- EndIf
- ; ********************************************************************************************************
- ; Do-while functionality. Only loops if rolled destination is unwanted DLC.
- ; ********************************************************************************************************
- ReRoll = 1
- While ReRoll == 1
- ReRoll = 0
- TargetID = Utility.RandomInt(0, (TargetCount - 1)) ; Roll random 0 through (count - 1)
- If ExcludeDLC == 1 || ExcludeFH == 1
- If HH_IsInFarHarbor(Category, TargetID) == 1
- ReRoll = 1
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: FH ReRoll.")
- EndIf
- EndIf
- EndIf
- If !ReRoll
- If ExcludeDLC == 1 || ExcludeNW == 1
- If HH_IsInNukaWorld(Category, TargetID) == 1
- ReRoll = 1
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: NW ReRoll.")
- EndIf
- EndIf
- EndIf
- EndIf
- If !ReRoll
- If ExcludeDLC == 1 || ExcludeVT == 1
- If Category == VAULTS && TargetID == 5
- ReRoll = 1
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: VT ReRoll.")
- EndIf
- EndIf
- EndIf
- EndIf
- EndWhile
- HH_Category.SetValue(Category)
- HH_TargetID.SetValue(TargetID)
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: Category is " + Category + ".")
- Debug.TraceAndBox("Hitchhiker: TargetID is " + TargetID +".")
- EndIf
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH IS IN FAR HARBOR
- ; ------------------------------------------------------------------------------------------------------------
- Int Function HH_IsInFarHarbor(Int Category, Int TargetID)
- Int Located = 0
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: Checking IsInFarHarbor.")
- EndIf
- If Category == BUS_SHELTERS
- ; No FH bus shelters
- ElseIf Category == DINERS
- If TargetID == 3
- Located = 1
- EndIf
- ElseIf Category == DIVES
- If TargetID == 10
- Located = 1
- EndIf
- ElseIf Category == DRIVE_INS
- If TargetID == 5
- Located = 1
- EndIf
- ElseIf Category == FACTORIES
- If TargetID == 7 || TargetID == 10
- Located = 1
- EndIf
- ElseIf Category == FARMS
- ; No FH farms
- ElseIf Category == JUNKYARDS
- Int[] MyArray
- MyArray.Add(1)
- MyArray.Add(3)
- MyArray.Add(4)
- MyArray.Add(6)
- MyArray.Add(8)
- MyArray.Add(10)
- MyArray.Add(12)
- MyArray.Add(17)
- If MyArray.Find(TargetID) >= 0
- Located = 1
- EndIf
- ElseIf Category == MILITARY_BASES
- If TargetID == 0 || TargetID == 18
- Located = 1
- EndIf
- ElseIf Category == MONUMENTS
- If TargetID == 2 || TargetID == 21 || TargetID == 26
- Located = 1
- EndIf
- ElseIf Category == POWER_LIFTS
- ; No FH power lifts
- ElseIf Category == RED_ROCKETS
- If TargetID == 20 || TargetID == 21 || TargetID == 22
- Located = 1
- EndIf
- ElseIf Category == VAULTS
- If TargetID == 9
- Located = 1
- EndIf
- Else
- Debug.TraceAndBox("HITCHHIKER: NULL IN FH CHECK!")
- EndIf
- Return Located
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH IS IN NUKA WORLD
- ; ------------------------------------------------------------------------------------------------------------
- Int Function HH_IsInNukaWorld(Int Category, Int TargetID)
- Int Located = 0
- If HH_OptionDevTracking.GetValue() as Int == 1
- Debug.TraceAndBox("Hitchhiker: Checking IsInNukaWorld.")
- EndIf
- If Category == BUS_SHELTERS
- ; No NW bus shelters
- ElseIf Category == DINERS
- If TargetID == 2 || TargetID == 13
- Located = 1
- EndIf
- ElseIf Category == DIVES
- If TargetID == 2
- Located = 1
- EndIf
- ElseIf Category == DRIVE_INS
- If TargetID == 0 || TargetID == 3 || TargetID == 9 || TargetID == 10
- Located = 1
- EndIf
- ElseIf Category == FACTORIES
- If TargetID == 11
- Located = 1
- EndIf
- ElseIf Category == FARMS
- ; No NW farms
- ElseIf Category == JUNKYARDS
- If TargetID == 9
- Located = 1
- EndIf
- ElseIf Category == MILITARY_BASES
- If TargetID == 11 || TargetID == 12
- Located = 1
- EndIf
- ElseIf Category == MONUMENTS
- If TargetID == 4 || TargetID == 9 || TargetID == 23 || TargetID == 24
- Located = 1
- EndIf
- ElseIf Category == POWER_LIFTS
- If TargetID == 13 || TargetID == 14
- Located = 1
- EndIf
- ElseIf Category == RED_ROCKETS
- If TargetID == 23 || TargetID == 24
- Located = 1
- EndIf
- ElseIf Category == VAULTS
- ; No NW vaults
- Else
- Debug.TraceAndBox("HITCHHIKER: NULL IN NW CHECK!")
- EndIf
- Return Located
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: IS FURNITURE
- ; ------------------------------------------------------------------------------------------------------------
- ; Declared in properties: FormList Property HH_IsFurniture Auto Const Mandatory
- ; NESTED: Property is a formlist of formlists of furnitures. (Total = 302 NPC/Player furniture actions)
- ; [0] IsFurnitureBed 34
- ; [1] IsFurnitureBedWorkshop 20
- ; [2] IsFurnitureBench 19
- ; [3] IsFurnitureChair 57
- ; [4] IsFurnitureCouch 24
- ; [5] IsFurnitureInstitute 11
- ; [6] IsFurnitureInv 6
- ; [7] IsFurnitureKneel 6
- ; [8] IsFurnitureMisc 104
- ; [9] IsFurnitureStand 8
- ; [10] IsFurnitureStool 13
- Int Function IsFurniture(ObjectReference TargetToCheck)
- Form TargetBaseObject = TargetToCheck.GetBaseObject()
- FormList FurnList = HH_IsFurniture ; FormList declared in properties
- FormList NestedList
- Int FurnSize = FurnList.GetSize()
- Int i = 0
- Int Found = 0
- While i < FurnSize && !Found ; Stop loop if form found in furniture
- NestedList = FurnList.GetAt(i) as FormList ; Loop grabs next unchecked formlist
- If NestedList.HasForm(TargetBaseObject) ; If found,
- Found = 1 ; mark as found and break loop
- Else
- i += 1 ; else iterate and keep looking
- EndIf
- EndWhile
- Return Found ; return found (1) or not found (0) to caller
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH TRY TO USE FURNITURE
- ; ------------------------------------------------------------------------------------------------------------
- Int Function HH_TryToUseFurniture(Actor Person, ObjectReference TargetRef)
- Int DidItWork = 0
- If IsFurniture(TargetRef) == 1 ; If target can be used (chair, wall lean, etc)
- If TargetRef.IsFurnitureInUse(True) == False ; and target is not in use right now (ignores reserved)
- If Person.SnapIntoInteraction(TargetRef) ; then attempt to use the furniture
- DidItWork = 1
- If HH_OptionSpinCamera.GetValue() as Int == 0
- Game.ForceFirstPerson() ; IMPORTANT: Prevents getting stuck in furniture if no spincam
- EndIf
- EndIf
- EndIf
- EndIf
- Return DidItWork
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH FORCE TIME
- ; ------------------------------------------------------------------------------------------------------------
- Function HH_ForceTime(Int TargetHour)
- Int CurrentHour = pGameHour.GetValue() as Int ; Get current game hour
- Int MyDuration ; and determine how long to wait
- If TargetHour < 0 || TargetHour > 24
- TargetHour = 9
- EndIf
- If CurrentHour < TargetHour ; If target is later in same day,
- MyDuration = TargetHour - CurrentHour ; waiting period is easy to calculate
- Else
- Int Difference = CurrentHour - TargetHour
- MyDuration = 24 - Difference ; else duration is difference subtracted from midnight
- EndIf
- If MyDuration > 0 && MyDuration < 24 ; If duration will result in a time change,
- Game.PassTime(MyDuration) ; wait that duration
- EndIf
- EndFunction
- ; ------------------------------------------------------------------------------------------------------------
- ; CUSTOM FUNCTION: HH FORCE WEATHER
- ; ------------------------------------------------------------------------------------------------------------
- Function HH_ForceWeather(Int MyForecast)
- If !Player.IsInInterior() ; If destination is NOT indoors...
- Weather MyWeather
- If MyForecast == 1
- MyWeather = CommonwealthClear ; Clear
- ElseIf MyForecast == 2
- MyWeather = CommonwealthDusty ; Dusty
- ElseIf MyForecast == 3
- MyWeather = CommonwealthFoggy ; Foggy
- ElseIf MyForecast == 4
- MyWeather = CommonwealthMisty ; Misty
- ElseIf MyForecast == 5
- MyWeather = CommonwealthMistyRainy ; Misty Rainy
- ElseIf MyForecast == 6
- MyWeather = CommonwealthOvercast ; Overcast
- ElseIf MyForecast == 7
- MyWeather = CommonwealthGSRadstorm ; Radstorm
- ElseIf MyForecast == 8
- MyWeather = CommonwealthRain ; Rain
- Else
- MyWeather = DefaultWeather ; Default Weather (outdoors)
- EndIf
- MyWeather.ForceActive() ; Force weather change now
- EndIf
- EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement