the Sim Settlements forums!

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Question Issues from WorkshopParentScript's functions

ghzfba

New Member
Messages
2
I noticed my mod on NexusMods, Invisible Marker Pack, shows some issues only when WSFW is loaded.
It seems, in particular, the WorkshopParentScript's function AssignActorToObjectPUBLIC can't unassign the settler from his current job before assigning him to the new one.
What could it be? Am I ignoring something?
 
@ghzfba Is this happening consistently? AssignActorToObjectPUBLIC does unassign from previous objects, I simply added a means for overriding the unassign, but it requires explicitly registering your items for such behavior which you clearly didn't.

I'm happy to look into this, just need reproducible steps so I can trace out what is happening in the code.
 
Hey, thanks for your concern.

In cases like the one below (1), it seems AssignActorToObjectPUBLIC fails to assign the settler to the new job:
Function AddFollower(ObjectReference akFollowerRef, ObjectReference akLeaderRef)
(...)
WorkshopScript WorkshopRef=akLeaderRef.GetLinkedRef(IMP.WorkshopItemKeyword) as WorkshopScript
ObjectReference FollowerMarkerRef=akFollowerRef.PlaceAtMe(IMP.IMP_Controller_GuardScoutFollower, abDeleteWhenAble=False)
IMP.WorkshopParent.BuildObjectPUBLIC(FollowerMarkerRef as WorkshopObjectScript, WorkshopRef)
IMP.WorkshopParent.AssignActorToObjectPUBLIC(akFollowerRef as WorkshopNPCScript, FollowerMarkerRef as WorkshopObjectScript)
FollowerMarkerRef.SetLinkedRef(WorkshopRef, IMP.WorkshopItemKeyword)
WorkshopRef.RecalculateWorkshopResources()

(...)
EndFunction
__________
FollowerMarkerRef is an object with WorkshopObjectScript attached
akFollowerRef is the settler (WorkshopNPCScript) I want to assign to FollowerMarkerRef
__________


It's like the UnassignActor function included in AssignActorToObject function code doesn't work properly in WorkshopParentScript.

________
(1) extract from IMPScriptGuardManagerScout.psc, lines 466-499
You can view the entire code of IMP on Github (but I still can't post the repository link here)
 
Top