Jump to content

New workshop location not initializing properly (scripting help)


adb3nj

Recommended Posts

But I'm only getting the location error in a single save file, and as far I can tell, the workshop is initializing inconsistently in ALL save files. I say "as far as I can tell" because it's possible I'm just not waiting long enough, but I've been pretty intensive with my testing.
Link to comment
Share on other sites

The most likely issue is that DiamondCityLocation 00002cef spans both Commonwealth worldspace cells (e.g. DiamondCityExt) and DiamondCity internal (no not interior) worldspace cells (e.g. DiamondCityOrigin) and it just depends what story manager finds and fills on each roll.

 

If you check other diamond city workshop mods they seem to have have similar user error reports where some dont get WorkshopParent registered location services and others do.

Link to comment
Share on other sites

dont know if its relevant but just in case...

I had a "similar" issue with a location at Nakano because Nakano isnt really part of the commonwealth until you discover it being that its a part of the DLC...

So in order to have the location show up to the player they added a map marker in a cell bordering the location that was linked to a location marker in the location cells...

When i did a location mod there and making it into a settlement i had to do the same .....Basically placed my map marker in the commonwealth in a unused cell close to the border and linked it to my location marker... This allowed NPC travel,supply routes etc. to work properly...and stats to show on the map .

The difference with you is that i had unused cells that didnt belong to nakano to place my settlement markers on and not in nakano itself.. You however have to use the D.C. cells and that maybe the problem....

Also curious... Have you tried adding the settlement keywords to the D.C. location and setup the zone as well ? Or did you make a new location and zone ?

Link to comment
Share on other sites

Added the keywords to the DC location. I don't think I did anything with any encounter zones because it wasn't necessary for my purposes, i.e. there are no settlement attacks. I guess my next course of action is to look into creating a new location.

Link to comment
Share on other sites

Well I personally would not target split locations like that, but if you want to try and force an outcome I would use a custom registration script.

 

Which I happen to have, just attach to a blank start game enabled quest, fill in the properties and watch the debug log. Good luck !

 

 

 

Scriptname SKK_WURegisterNewWorkshopScript extends Quest

Group BaseGameForms
Quest				Property pWorkshopParent					Auto Const Mandatory 
ActorValue 			Property pWorkshopRatingHappiness			Auto Const Mandatory 
ActorValue 			Property pWorkshopRatingLastAttackDaysSince	Auto Const Mandatory 
Keyword 			Property pLocTypeWorkshopSettlement 		Auto Const Mandatory 
LocationRefType 	Property pMapMarkerRefType					Auto Const Mandatory 
EndGroup 

Group UserReferenceFills
ObjectReference 	Property thisWorkshopREF 					Auto
Location			Property thisWorkshopLocation 				Auto
ObjectReference 	Property thisMapMarkerREF					Auto
EndGroup

;****************************************************************************************************************

Event OnQuestInit()

Debug.Trace("SKK_WURegisterNewWorkshopScript.OnQuestInit")

WorkshopScript thisWorkshop

If (thisWorkshopREF != None)
	thisWorkshop = (ThisWorkshopREF as WorkshopScript) 
Endif

If (thisWorkshopLocation == None)
	thisWorkshopLocation = ThisWorkshopREF.GetCurrentLocation()
EndIf

Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop thisWorkshop " + thisWorkshop)
Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop thisWorkshopLocation " + thisWorkshopLocation)
Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop thisMapMarkerREF " + thisMapMarkerREF)

If (thisWorkshopLocation != none) && (thisWorkshopLocation.HasKeyword(pLocTypeWorkshopSettlement) == False) 
	thisWorkshopLocation = None
	Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop FAIL LocTypeWorkshopSettlement")
EndIf

If (thisWorkshop != None) && (thisWorkshopLocation != None)  

	While (pWorkshopParent.GetStageDone(20) == false)
		Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop WAIT WorkshopParent.20")
		Utility.Wait(2.0)
	endWhile

	While ((pWorkshopParent as WorkshopParentScript).IsEditLocked() == True) 
		Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop WAIT WorkshopParent.EditLock")
		Utility.Wait(2.0)
	EndWhile

	Int iWorkshopCount = (pWorkshopParent as WorkshopParentScript).Workshops.Length
	Int iWorkshopLocationsCount = (pWorkshopParent as WorkshopParentScript).WorkshopLocations.Length

	int iWorkshopIndex = (pWorkshopParent as WorkshopParentScript).Workshops.Find(thisWorkshop)
	int iWorkshopLocationIndex =  (pWorkshopParent as WorkshopParentScript).WorkshopLocations.Find(thisWorkshopLocation)

	Bool bOKTeRegister = True
	
	If (iWorkshopIndex > -1)
		bOKTeRegister = False
		Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop FAIL WorkshopRef already exists at index " + iWorkshopIndex)
	Endif

	If (iWorkshopLocationIndex > -1)
		bOKTeRegister = False
		Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop FAIL WorkshopLocation already exists at index " + iWorkshopLocationIndex)
	Endif

	If (iWorkshopCount != iWorkshopLocationsCount)
		bOKTeRegister = False
		Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop FAIL Array count mismatch " + iWorkshopCount + "/" + iWorkshopLocationsCount)
	Endif

	If (bOKTeRegister == True) 

		(pWorkshopParent as WorkshopParentScript).Workshops.Add(thisWorkshop)

		int thisWorkshopIndex = (pWorkshopParent as WorkshopParentScript).Workshops.Length -1
		(thisWorkshop as WorkshopScript).InitWorkshopID(thisWorkshopIndex) 

		(pWorkshopParent as WorkshopParentScript).WorkshopLocations.Add(thisWorkshopLocation)
		(thisWorkshop as WorkshopScript).myLocation = thisWorkshopLocation

		If (thisMapMarkerREF != None) && (thisMapMarkerREF.HasRefType(pMapMarkerRefType) == true)
			(thisWorkshop as WorkshopScript).myMapMarker = thisMapMarkerREF ; this is not vital can be blank
		Endif

		thisWorkshop.SetValue(pWorkshopRatingHappiness, 50) 
		thisWorkshop.SetValue(pWorkshopRatingLastAttackDaysSince, 99)

		(pWorkshopParent as WorkshopParentScript).RegisterForRemoteEvent(thisWorkshopLocation, "OnLocationCleared")
		(thisWorkshop as WorkshopScript).RegisterForCustomEvent((pWorkshopParent as WorkshopParentScript), "WorkshopDailyUpdate")

		(thisWorkshop as WorkshopScript).RecalculateWorkshopResources(True)
		
		;this script skips trying to add placed WorkshopNPCScript actors and resources to the workshop when 3d is unloaded as nonpersistent objects are never found anyway.
		;wait until OnLocationChange kicks ResetWorkshop and hope that all workshop resource objects are in the 3d loaded area. LOL

		Debug.Trace("SKK_WURegisterNewWorkshopScript.RegisterNewWorkshop SUCCESS thisWorkshop " + thisWorkshop + " WorkshopID " + (thisWorkshop as WorkshopScript).GetWorkshopID() )

	EndIf
	
EndIf

thisWorkshopREF  = None
thisWorkshopLocation  = None
thisMapMarkerREF = None

Self.UnregisterForAllEvents()
(Self as Quest).Stop()

EndEvent

;****************************************************************************************************************

 

 

Link to comment
Share on other sites

You may have a major issue with workshop resource updates and assignments which are triggered by player OnLocationChange as DiamondCityLocation spans both inside and outside DC.

 

When the player rocks up from the outside, OnLocationChange triggers ResetWorkshop which tries to find all workshop resources in the loaded area, which will clearly not include stuff inside DC. Infact if the workshop is inside DC and its 3d is unloaded there will be all sorts of LOLs. When the player then enters the DC elevator or gate to the internal worldspace OnLocationChange does not trigger as its still the same location !

 

Whereas if the player fast travels to the DC Market internal map marker from a non DC location then OnLocationChange triggers ResetWorkshop with all the internal resources loaded.

 

Its exactly the same resource 3d loaded confusion issue for the larger build areas like Sanctuary and Spectacle when walking to or fast travelling. Described in detail in my "why resources are reported wrong" article.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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