Jump to content

Supply line keyword?


Recommended Posts

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 by Struckur
Link to comment
Share on other sites

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

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

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

  • Recently Browsing   0 members

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