kinggath Posted October 18, 2016 Share Posted October 18, 2016 I have a script that spawns in a workshop object, let's say a Bar for example, and then assigns a settler to it. Everything works, the settler works the object, I can purchase things from him, etc. The one problem is that the settler's info card when you look at them in workshop mode shows Unassigned and the spawned object is not highlighted. If you pick up and move the spawned object, the info card updates and the highlighting works again. I can't figure out what I'm missing. The only thing I can think of is that it has to do with the Navmesh, which I've tried calling MoveToNearestNavmeshLocation with no success. Here is the function that does the work: Function Test() Debug.Notification("Running test...") ObjectReference playerRef = Game.GetPlayer() workshopscript thisWorkshop = WorkshopParent.GetWorkshopFromLocation(playerRef.GetCurrentLocation()) if(thisWorkshop) ObjectReference spawnTest = thisWorkshop.GetLinkedRef(WorkshopParent.WorkshopLinkSpawn).PlaceAtMe(SpawnMe) if(WorkshopParent.BuildObjectPUBLIC(spawnTest, thisWorkshop)) Debug.Notification("Spawned work object.") ObjectReference[] workshopActors = WorkshopParent.GetWorkshopActors(thisWorkshop) if(workshopActors) int j = 0 bool assignmentAttempted = false while(j < workshopActors.Length && ! assignmentAttempted) if( ! (workshopActors[j] as workshopnpcscript).bIsWorker) assignmentAttempted = true WorkshopParent.AssignActorToObjectPUBLIC(workshopActors[j] as workshopnpcscript, spawnTest as workshopobjectscript) Debug.Notification("Assigned actor.") endif j += 1 endwhile endif endif endif EndFunction Link to comment Share on other sites More sharing options...
kinggath Posted October 18, 2016 Author Share Posted October 18, 2016 I don't have a solution yet, but I'm closer to figuring out the exact cause. If I call GetWorkshopOwnedObjects in the OnWorkshopObjectGrabbed event for the spawned object, it comes back empty. When I also place it in the OnWorkshopObjectMoved event for that object, it comes back finding the reference. Something is preventing ownership from completing until after the object is placed in workshop mode. I've now tried calling SetActorRefOwner manually, and that doesn't fix it. Link to comment Share on other sites More sharing options...
MasterMagnus Posted October 18, 2016 Share Posted October 18, 2016 Possibly the object needs a Keyword to flag it as an assignable object? Just a guess. Link to comment Share on other sites More sharing options...
kinggath Posted October 18, 2016 Author Share Posted October 18, 2016 Yep, turned out I needed to manually add a LinkedRef linking it to the workshop with the WorkshopItemKeyword. Link to comment Share on other sites More sharing options...
Recommended Posts