F4llfield Posted March 3, 2023 Share Posted March 3, 2023 Hi, In my script, I'm using the below lines to detect if the player is currently in a settlement, and it's working fine: Location Here = PlayerREF.GetCurrentLocation() If Here.HasKeyword(LocTypeWorkshopSettlement)...Else...EndIf Now I need to know if this current settlement is owned by the player in my script. I have difficulty finding the info. What would be the best way to do this ? thks Link to comment Share on other sites More sharing options...
SKKmods Posted March 3, 2023 Share Posted March 3, 2023 Bool Function IsLocalWorkshopOwned(Location thisLocation) Bool bIsowned = False If (thisLocation == None) thisLocation = Game.GetPlayer().GetCurrentLocation() EndIf Quest WorkshopParent = Game.GetFormFromFile(0x0002058e, "Fallout4.esm") as Quest WorkshopScript thisWorkshop = (WorkshopParent as WorkshopParentScript).GetWorkshopFromLocation(thisLocation) If (thisWorkshop != None) bIsOwned = thisWorkshop.OwnedByPlayer EndIf Return bIsOwned EndFunction If you know how to do script proprties turn pWorkshopParent and Game.GetPlayer into them for neatness. Note1 this only detects Workshops that are registered with WorkshopParent as full settlements. Standalone/Isolated/PlayerHome workshops will not be found, that takes a bit more work. Note2 GetWorkshopFromLocation is EZ but the #1 victim of crappy mod added workshops, users removing registered workshop mods from their load order and workshop location overwrites. Learn more here. Link to comment Share on other sites More sharing options...
F4llfield Posted March 4, 2023 Author Share Posted March 4, 2023 Thousand thanks for your quick reply and info. I just added the word "Function" between Bool and IsLocalWorkshopOwned and it worked like a charm. Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts