F4llfield Posted April 18, 2023 Share Posted April 18, 2023 This I'm trying to get the all settlers from a specific workshop into an array in a Quest script. workshopScript thisWorkshop = pWorkshopParent.getWorkshopFromLocation(Game.getPlayer().getCurrentLocation()) ObjectReference[] settlers = pWorkshopParent.GetWorkshopActors(thisWorkshop) Debug.Notification("Number of settlers : " + settlers.length) But the array length is always zero... Link to comment Share on other sites More sharing options...
SKKmods Posted April 18, 2023 Share Posted April 18, 2023 Considerations: (1) GetWorkshopFromLocation is the first thing to fail in the modded commonwealth due to location overwrites and workshops being removed. You may want to test for none return and run a backup: ObjectReference[] FoundWorkshops = pPlayerRef.FindAllReferencesWithKeyword(pWorkshopKeyword, 10240) (2) Non unique actor settlers are non persistent objects, if they are not in the 3d loaded area around the player defined by uGridsToLoad you will not find them. An issue with extended build/sandbox borders. (3) Rather than stress busy 'ol WorkshopParentScript, make the call it makes direct: ObjectReference[] WorkshopActors = ThisWorkshop.GetWorkshopResourceObjects(pWorkshopRatingPopulation) as ObjectReference[]Be aware it excludes Cows, Codsworth, Dogmeat, RobotCurie, GraygardenWorkers, DLC robots as they do not count for population with WorkshopRatingPopulation = 0 Link to comment Share on other sites More sharing options...
F4llfield Posted April 18, 2023 Author Share Posted April 18, 2023 Thanks again for your reply SKK, Good information. I can't seem to find information on WorkshopRatingPopulation to be able to define it as a property. Link to comment Share on other sites More sharing options...
SKKmods Posted April 18, 2023 Share Posted April 18, 2023 ActorValue Property pWorkshopRatingPopulation Auto Const Mandatory Link to comment Share on other sites More sharing options...
F4llfield Posted April 18, 2023 Author Share Posted April 18, 2023 I'm not sure why but I'm getting a value of 35 at Finch farm. I think I'm getting the total number of settlers and not the settlers from that specific workshop (thisWorkshop). Link to comment Share on other sites More sharing options...
SKKmods Posted April 18, 2023 Share Posted April 18, 2023 Compare with an alternative function: ObjectReference[] WorkshopActors = ThisWorkshop.GetActorsLinkedToMe(pWorkshopItemKeyword) as ObjectReference[]BUT this does include Codsworth, Dogmeat, RobotCurie, GraygardenWorkers, Brahmin, Dogs, Turrets ... any actor object type. Link to comment Share on other sites More sharing options...
F4llfield Posted April 18, 2023 Author Share Posted April 18, 2023 At first with the alternative function it was not working, but because I forgot to assign the properties in ck.... ahhh But now it's working thanks again. I learning by looking at tutorials and looking at other script. Too bad the Papyrus info is scattered like that. I look for a good book on Papyrus scripting but didn't find any. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts