SKKmods Posted March 13, 2020 Share Posted March 13, 2020 I am creating a diagnostic tool for workshops having problems managing more than 128 ActorValue WorkshopResourceObject objects, which are a subset of Keyword WorkshopItemKeyword objects. All objects built at a workshop link back to it with a LinkedRef WorkshopItemKeyword and this line of script has been working perfectly for years with my Workshop Utilities: ObjectReference[] WorkshopObjects = ThisWorkshop.GetRefsLinkedToMe(pWorkshopItemKeyword) Except if there are more than 128 objects, because a Papyrus array can only hold/access 128 items. So I have been trying to get a quest RefCollectionAlias to dynamically fill WorkshopItemKeyword objects, as a collection alias will handle unlimited (personally tested to 10128) objects. [03/13/2020 - 04:02:13PM] SKK_WUTestWorkshopResources_588922 log opened (PC-64) [03/13/2020 - 04:02:13PM] *************************************************************************** [03/13/2020 - 04:02:13PM] WorkshopParentScript.ResetWorkshop() [03/13/2020 - 04:02:45PM] ThisWorkshop ObjectReference [workshopscript < (000250FE)>] [03/13/2020 - 04:02:45PM] ThisWorkshop.ID 22 [03/13/2020 - 04:02:45PM] WorkshopParentScript.ID 22 [03/13/2020 - 04:02:45PM] [03/13/2020 - 04:02:45PM] ThisWorkshop.GetcurrentLocation [Location < (0001F228)>] [03/13/2020 - 04:02:45PM] ThisWorkshop.MyLocation [Location < (0001F228)>] [03/13/2020 - 04:02:45PM] WorkshopParentScript.Location [Location < (0001F228)>] [03/13/2020 - 04:02:45PM] [03/13/2020 - 04:02:45PM] LocTypeWorkshopSettlement True [03/13/2020 - 04:02:45PM] WorkshopWorkbenchTypeSettlement True [03/13/2020 - 04:02:45PM] [03/13/2020 - 04:02:45PM] AV Population 32 [03/13/2020 - 04:02:45PM] AV Food 54 [03/13/2020 - 04:02:45PM] AV Safety 51 [03/13/2020 - 04:02:45PM] AV Water 9 [03/13/2020 - 04:02:45PM] AV Power 5 [03/13/2020 - 04:02:45PM] AV Beds 22 [03/13/2020 - 04:02:45PM] AV WorkshopRatingScavengeGeneral 4 [03/13/2020 - 04:02:45PM] AV VendorIncome 1 [03/13/2020 - 04:02:45PM] AV WorkshopRatingRadio 1 [03/13/2020 - 04:02:45PM] [03/13/2020 - 04:02:45PM] Resource AV Subtotal 147 [03/13/2020 - 04:02:45PM] AV WorkshopResourceObject 147 [03/13/2020 - 04:02:45PM] [03/13/2020 - 04:02:45PM] Keyword WorkshopWorkObject 108 [03/13/2020 - 04:02:45PM] Keyword WorkshopItemKeyword 343 [03/13/2020 - 04:02:45PM] *************************************************************************** [03/13/2020 - 04:03:08PM] Log closed Copying a couple of base game quests like MinRadiantOwned07ChangeLocOnly that try to use similar fills (dunno if they actually work as triggered by random story events) I am totally unable to get the alias to fill, which is frustrating as my parallel script fills the first 128 WorkshopItemKeyword items fine from the same Alias_ThisWorkshop: Find matching Reference: Condition IsLinkedTo Alias: ThisWorkshop Keyword:WorkshopItemKeyword Arsed around endlessly with Closest To: None, Closest To: ThisWorkshop, Near Alias: ThisWorkshop & etc. Anyone managed to get LinkedReferences to fill ever ? Link to comment Share on other sites More sharing options...
DieFeM Posted March 13, 2020 Share Posted March 13, 2020 (edited) Not sure, but I guess you are filling the workshop alias after the quest has been started, therefore the collection doesn't get filled, I've tried it, and it seems I've got it working fine. In some settlements it returns the same amount of references than GetRefsLinkedToMe and in some others it returns 3 less, I'm not sure why, but at least it fills the collection. You only need to start the quest when you are near to a workshop reference, then stop and start it again the next time. stopquest RE_SKK_FillWorkshopObjects startquest RE_SKK_FillWorkshopObjectsThere you have what I've done: startquest RE_SKK_FillWorkshopObjects.7z Edited March 13, 2020 by DieFeM Link to comment Share on other sites More sharing options...
SKKmods Posted March 13, 2020 Author Share Posted March 13, 2020 Thankyou, that's nailed it. It's not a problem stopping and starting the quest, that's all fine, The problem seems to be seeding the workshop from a linked External Alias Ref [Match = Alias in Other Quest]. It fills totally fine when the lookup quest is started with an object reference that can be accessed OnQuestInit() with GetReference() but any other aliases that depend on it lower in the alias order fail to fill. I use those type of dynamically linked external aliases all the time to get a local reference for common things like Followers/Companion and Followers/DogmeatCompanion, but never had quest start lookup fills dependent on them. Having now tried several different combinations of local lookups and external linked aliases, I can see that external linked aliases do not link fast enough for story manager to use for other quest startup conditional alias fills between OnInit and OnQuestInit. Another constraint exposed. Case Closed. Link to comment Share on other sites More sharing options...
niston Posted March 15, 2020 Share Posted March 15, 2020 I was able to use GetRefsLinkedToMe with way over 128 items - The 221 floor test elevator I built has 221 doors reflinked to the controller. The 128 array element limit only applies to Papyrus VM creating arrays and adding elements, ie new and .Add(). If an array is created/filled by the game engine itself, it may contain more than 128 elements. I can confirm that its possible from papyrus to a) remove elements from an array > 128 entries and b) access > 128 elements from a loop. It was also possible for the iterative version of QuickSort to sort the 221 doors array from the test elevator, accessing and moving around each element (altho it was REALLY slow going). Not sure why you're having the problem with pWorkshopItemKeyword. You sure it isn't a "bunch of references are outside loaded area" problem? GetRefsLinkedToMe() will not return references that are not loaded. Link to comment Share on other sites More sharing options...
SKKmods Posted March 15, 2020 Author Share Posted March 15, 2020 Yes I am aware of 3d loaded state, and linked refs will not resolve to script calls with 3d is unloaded. One of the considerations is that some settlement build areas are actually larger than the uGridsToLoad active area around the player (Sanctuary & Spectacle) which is why resolving LinkRefs can be inconsistent, whereas the story manager seems to be able to find and fill all persistent ObjectReferences through linked reference even when unloaded. It also runs 10x to 100x faster than a GetAll* or FindAll* script call. That loaded state, plus speed plus finding ObjectReference[] array fills unexpectedly capping at 128 on 3d loaded resources is why I am using story manager quest fills. Link to comment Share on other sites More sharing options...
Recommended Posts