Struckur Posted June 12, 2018 Share Posted June 12, 2018 (edited) Is there a keyword that links workshops when they have a supply line connecting them?Or any other way to get a list of all workshops in a supply line network? I'm working on a cost enforcement system for my Clipboard mod, I have the list of components and am trying to implement a method for checking the player and the appropriate workshops for the required components. But I don't see how I can get a list of all workshops that are connected. I can of course, get the local workshop reference so I have a starting point. Thanks,Struckur Edited June 12, 2018 by Struckur Link to comment Share on other sites More sharing options...
SKKmods Posted June 12, 2018 Share Posted June 12, 2018 This is cut from one of my workshop scripts, may not work exactly as is but gives you a primer to get all player owned connected workshops: Import WorkshopScript WorkshopParentScript Property pWorkshopParentScript Auto Const Mandatory ; Connect to Quest WorkshopParent WorkshopScript[] WorkshopREFs = pWorkshopParentScript.Workshops Int iIndex = 0 While iIndex < WorkshopREFs.Length If WorkshopREFs[iIndex] != None && WorkshopREFs[iIndex].OwnedByPlayer == TRUE If WorkshopREFs[iIndex].GetValue(pWorkshopParentScript.WorkshopRatings[pWorkshopParentScript.WorkshopRatingCaravan].resourceValue) as Int ) > 0 ; Have caravan do stuff EndIf EndIf iIndex += 1 EndWhile Enjoy ! Link to comment Share on other sites More sharing options...
Struckur Posted June 12, 2018 Author Share Posted June 12, 2018 Thanks, that is exactly what I needed! Link to comment Share on other sites More sharing options...
SKKmods Posted June 12, 2018 Share Posted June 12, 2018 PS forgot to say that the [ WorkshopREFs[iIndex] != None ] test looks redundant, but your script may be dealing with players who have damaged Workshop.Array, typically from removing DLCs or mods that add workshops, leaving null entries. Of course they may have bigger workshop issues, but you will be golden. Link to comment Share on other sites More sharing options...
Struckur Posted June 12, 2018 Author Share Posted June 12, 2018 Ended up with: WorkshopScript[] Function GetLinkedWorkshops() Location[] linkedLocations = workshopRef.myLocation.GetAllLinkedLocations(WorkshopCaravanKeyword) WorkshopScript[] linkedWorkshops = new WorkshopScript[linkedLocations.Length]; int index = 0 while (index < linkedLocations.Length) linkedWorkshops[index] = WorkshopParent.GetWorkshopFromLocation(linkedLocations[index]) index += 1 endwhile return linkedWorkshops EndFunction Works perfectly Link to comment Share on other sites More sharing options...
SKKmods Posted June 12, 2018 Share Posted June 12, 2018 Lovely linked keywords, thanks grabbed for the papyrus porn stash /sad. Link to comment Share on other sites More sharing options...
Recommended Posts