Zorkaz Posted February 13, 2020 Share Posted February 13, 2020 The issueI'm currently working on a debug feature in one of my mods, where you can assign a home to a companion by pressing a button. (I'm already looking into this as I write this with all these "sendcompanionshome" scripts, but it also means it can be extremely confusing so I additionally ask some pros here) The questionHas anyone ever made a button/trigger that sets new home locations for Companions? Link to comment Share on other sites More sharing options...
SKKmods Posted February 13, 2020 Share Posted February 13, 2020 Yes, there are three methods I have tried: (1) On each companion actor, set the CompanionActorScript property AllowDismissToSettlements to point at a GlobalVariable you control and set that variable to 0. Then you can script control the HomeLocation: (pPiperREF as CompanionActorScript).HomeLocation = ThisLocation (2) If you are comfortable fighting with WorkshopParentScript you can set WorkshopParent.PlayerOwnsAWorkshop to 0 but you will need to register for WorkshopParentScript.WorkshopPlayerOwnershipChanged and keep setting it to zero. Problem is things like Minutemen quests also check that variable. (3) If you want to do this without fighting base game configurations, the UX is less good. If AllowDismissToSettlements is not set and PlayerOwnsAWorkshop is 1 then FollowersScript.DismissCompanion always pops the list of workshops to pick from*. After that you can intercept the CompanionChange custom event and force your own location: Quest Property pFollowers Auto Const Mandatory Event OnQuestInit() Self.RegisterForCustomEvent((pFollowers as FollowersScript), "CompanionChange") EndEvent Event FollowersScript.CompanionChange(FollowersScript akSender, Var[] akArgs) If (akArgs.Length > 0) Actor akActor = akArgs[0] as actor bool bIsCompanion = akArgs[1] as bool If (bIsCompanion == FALSE) (akActor as CompanionActorScript).HomeLocation = ThisLocation ;you need to manage Actor:ThisLocation logic ;plus boot from WorkshopPermanentActors.PermanetActors alias for AI packages EndIf EndIf EndEvent Whilst they all work, as they are intrusive or messy UX I have not progressed them. (*) R2K has a Companion go home solution that based on (3) and depends on the the user [TAB] key out of the workshop selection to avoid HomeLocation being overwritten. Link to comment Share on other sites More sharing options...
Zorkaz Posted February 13, 2020 Author Share Posted February 13, 2020 Thanks SKK50 for your quick response as I am knee deep in the workshopparent script and the companionsgohome script too... :wink: As alternative I thought I might just let the companions sandbox around an xmarker via a script without overwriting the "home" entry, but it's just a thought and I'm not sure if it can be done Actually my main intent is to set a workaround for all kinds of settlements that don't get properly recognized/initialized for different reasons, so using the workshopscript might not even be a good idea in the first place Link to comment Share on other sites More sharing options...
SKKmods Posted February 13, 2020 Share Posted February 13, 2020 If a workshop doesn't have a WorkshopLinkCenter which is used as the ultimate target by most scripts and packages, it is fundamentally broken and should not be an actor settlement . Use the workshop keyword test tool to see how bad the issue is. The easiest solution is to add a WorkshopLinkCenter to bad workshops, which is exactly what my Workshop Utilities WorkshopUpgradeToSettlement function does: ObjectReference WorkshopLinkCenter = ThisWorkshop.GetLinkedRef(apKeyword = pWorkshopLinkCenter) If (WorkshopLinkCenter == None) WorkshopLinkCenter = ThisWorkshop.PlaceAtMe(pXmarkerHeading, aiCount = 1, abForcePersist = true, abInitiallyDisabled = false, abDeleteWhenAble = false) ThisWorkshop.SetLinkedRef(WorkshopLinkCenter, pWorkshopLinkCenter) WorkshopLinkCenter.SetLocRefType(ThisLocation, pLocationCenterMarker) If (ThisWorkshop.GetPositionX() < 0) WorkshopLinkCenter.MoveTo(ThisWorkshop, 128, 0, 0, abMatchRotation = True) ElseIf (ThisWorkshop.GetPositionX() >= 0) WorkshopLinkCenter.MoveTo(ThisWorkshop, -128, 0, 0, abMatchRotation = True) EndIf EndIf Link to comment Share on other sites More sharing options...
Zorkaz Posted February 13, 2020 Author Share Posted February 13, 2020 Yeah the thing is the workshop is set up correctly (with the Center and such) and works for let's say 3/5 out of my characters. And even with some characters it depends on the save.It's linked correctly I looked it up in F04Edit.It's appearantly the initialization or the setownedtrigger that doesn't always work But besides from that a lot of different modifications overwrite the location entry and such, so I'm at this point just keen on finding an alternative to provide for custom settlements. Then again my CK messes up so many links currentlyAnd many thanks will try your test tool out Link to comment Share on other sites More sharing options...
Recommended Posts