Jump to content

Recommended Posts

I think I'm having an issue with the speed (slowness) of importing files from DLC.

 

Process:

 

- Commonwealth ref aliases exist in ref quests (to grab/release ref aliases to avoid persistence and bloat)
- DLC ref aliases have Todd room placeholder (I'm registering for OnQuestInit, then firing ref quest, so I need all ref aliases to fill... hence placeholders)
- Player selects teleport destination
- If destination is DLC:
* Get DLC target (GetFormFromFile)
* Replace placeholder w/ DLC (ForceRefTo)
- Go

 

I have code that checks IF form was imported and ref was forced. Is there any way to know WHEN these "events" happen?

 

All of my Commonwealth teleports work. Some of the DLC teleports work. The ones that don't work, well, I get to hang out with Napoleon Todd. Since that chair is my placeholder (because I don't want DLC dependencies...) that's why I think it's a speed issue. It feels like I'm trying to go places that haven't been forced into the refs YET, so I get the unchanged placeholder instead of expected target.

 

 

.

 

 

DReBaRCW0AAg50d.jpg

Link to comment
Share on other sites

I added a couple of 30 second waits to the code and it still failed (test destination: The Last Plank, Far Harbor).

 

When I tested 14 out of 42 earlier, the results were:

  • 5 Nuka-World destinations passed: Cappy's Cafe, Bradberton Amphitheater, Dry Rock Gulch, Starlight Interstellar, The Parlor.
  • 3 Nuka-World destinations failed (went to Todd's room instead): Fizztop Grille, Doc Phosphate's Saloon, World of Refreshment.
  • 6 Far Harbor destinations failed (went to Todd's room instead): Cliff's Edge, Eden Meadows, The Last Plank, Super Duper Mart FH, Vim Factory, Echo Lake Lumber.

The specific failed targets/ref aliases were:

  • Static table
  • Bar stool
  • COC marker
  • Bar stool
  • Diner booth
  • X marker
  • COC marker
  • COC marker
  • COC marker

 

I don't know why my ForceRefTo's seem to be failing. The Debug.TraceAndBox(es) I have in place fire all the way through to completion of teleport. Papyrus.0.log sometimes reports that MoveToNearestNavmeshLocation is not found.

 

 

Code assigning DLC target:


		If TargetAliasID == 23
			Found = 1
			DLCObjRef = Game.GetFormFromFile(0x0100D393, "DLCNukaWorld.esm") as ObjectReference ; 
		EndIf
		
		If TargetAliasID == 24
			Found = 1
			DLCObjRef = Game.GetFormFromFile(0x01043C13, "DLCNukaWorld.esm") as ObjectReference ; 
		EndIf
		
	ElseIf TargetQuest == QuestRefVaults
	
		If TargetAliasID == 5
			Found = 1
			DLCObjRef = Game.GetFormFromFile(0x01004217, "DLCworkshop03.esm") as ObjectReference ; 
		EndIf

		If TargetAliasID == 9
			Found = 1
			DLCObjRef = Game.GetFormFromFile(0x01038AFB, "DLCCoast.esm") as ObjectReference ; 
		EndIf
		
	Else
	
		Debug.TraceAndBox("HITCHHIKER: TARGET QUEST IS NULL!")
		
	EndIf
	
	; Grab the desired reference alias from the correct quest

	If Found
		Utility.Wait(30)
		TargetAlias = TargetQuest.GetAlias(TargetAliasID) as ReferenceAlias
		
		If HH_OptionDevTracking.GetValue() as Int == 1
			Debug.TraceAndBox("Hitchhiker: TargetAlias is " + TargetAlias + ".")
		EndIf
	EndIf
	
	; Force the refalias to the DLC objref

	If Found
		Utility.Wait(30)
		If DLCObjRef
			TargetAlias.ForceRefTo(DLCObjRef)
		EndIf
	EndIf
	
	Return Found
EndFunction

.

 

Code moving target to destination, then to navmesh, then moving player to target:

		Int GetDLC = HH_ForceDLCRefAlias(akSender, RefAliasID)
		
		Utility.Wait(0.1)
		TargetRef = (akSender.GetAlias(RefAliasID) as ReferenceAlias).GetReference()
		
		StartTimer(60, 3)																		; Done with quest in 60 seconds
	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_OptionTeleportSound.GetValue() as Int == 1											; If player wants teleport sound,
		Int iInstanceID = OBJHijackerTeleportOut2DA.Play(Player)								; play teleport end sound at player
	EndIf
	
	DestinationMarker = Player.PlaceAtMe(pXMarker)												; Dynamically spawn xmarker at player
	
	STATIC TargetBase = TargetRef.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
		DestinationMarker.MoveTo(TargetRef)															; so teleport will place 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(TargetRef, 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 TargetRef Is Furniture" caused illegal typecast compiler error, so I wrote a custom function
	HH_TryToUseFurniture(Player, TargetRef)

Link to comment
Share on other sites

So ultimately, your picking an object to spawn to. Is there an absolute need for the refalias? If persistence is the issue with the alias method, have you tried casting it to an objectreference property and clearing that?

 

I need to read your code a bit more. I thought refalias was as persistent as a property, but I do recall seeing a post saying this isn't always the case.

Link to comment
Share on other sites

Rather than MoveTo() a static reference target, as you have all the hard XYZ target coordinates (and don't seem to be activating them e.g. sitting on furniture) why not just do a SetPosition(XYZ). Do away with the target refs, aliases and persistence issues just have a library (struct/array) of coordinates.

 

MoveToNearestNavmeshLocation is an inconsistent and totally unreliable function I have been wrestling with for some months (> million spawns logged !). There are patches of world it simply wont work in (Sanctuary play area, Starlight carpark). As there is no function error return to accompany the error log, the best test is to spawn at Z+ , call the function and check Z has decreased to land on the navmesh. I *thought* it only worked in IsLoaded() cells (hence my extensive messing with uGrids) surprised its partially working for you on remote maps. SetPosition(XYZ) avoids this nonsense.

Link to comment
Share on other sites

I haven't checked the ids yet. But if they're not persistent and not in the currently loaded area that could be why it's not teleporting.

 

 

More testing confirmed this is the exact problem. If I can't find a way to remote/hot load the target objectreference before attempting GetFormFromFile, then I will have to use one of the alternate methods suggested. Previous erratic results indicate the game must be loading those refs (just prior to ??) when the teleport succeeds, and the GetFormFromFile is NONE when the teleport fails.

Link to comment
Share on other sites

If persistence is the issue with the alias method, have you tried casting it to an objectreference property and clearing that?

 

 

Then it becomes a Catch-22. I didn't put it in a property originally so I could avoid DLC dependency for players who don't have them. And I can't place it into a property dynamically if GetFormFromFile() returns NONE due to not being loaded.

 

So my options are find a way to preload it, or go with alt method like the suggested XYZ coords.

Link to comment
Share on other sites

Rather than MoveTo() a static reference target, as you have all the hard XYZ target coordinates (and don't seem to be activating them e.g. sitting on furniture) why not just do a SetPosition(XYZ). Do away with the target refs, aliases and persistence issues just have a library (struct/array) of coordinates.

 

MoveToNearestNavmeshLocation is an inconsistent and totally unreliable function I have been wrestling with for some months (> million spawns logged !). There are patches of world it simply wont work in (Sanctuary play area, Starlight carpark). As there is no function error return to accompany the error log, the best test is to spawn at Z+ , call the function and check Z has decreased to land on the navmesh. I *thought* it only worked in IsLoaded() cells (hence my extensive messing with uGrids) surprised its partially working for you on remote maps. SetPosition(XYZ) avoids this nonsense.

 

 

I think the reason MoveToNearestNavmeshLocation has been mostly working for me is because I'm moving markers very close to navmeshed areas first. Then it's just a matter of bumping to the right spot so player doesn't get stuck inside a static... (In theory.) But I haven't set up mathematical, automated tests like yours. I don't know anyone more thorough, btw, so much respect.

 

I may have to rewrite everything to use the XYZ method. I hate leaving questions unanswered almost as much as I hate going back to Square One. But if it doesn't just work, then I've got to let go and adopt a better way.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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