Jump to content

Assigning NPC to workshop through dialogue.


Recommended Posts

I have a NPC who has a workshop script attached to it.

 

 

Through dialogue I want the NPC to become later on part of a settlement. How would I do that?

Link to comment
Share on other sites

If your NPC has to be rescued, you can add REDialogueRescued "Gives ""rescued"" hellos" [FACT:0002F126] to their faction list with the rank set to 0.

I've been trying to reverse engineer that faction in order to create a generic "recruitable NPC faction," but so far, I've not succeeded.

Link to comment
Share on other sites

There is a function in workshoparentscript "AddPermanentActorToWorkshopPlayerChoice" which can be called in a fragment attached to the dialogue. This would pop up the settlement choice to which you send the NPC. If on the contrary you want to send the settler to an specific settlement without going through the prompt for choosing one I suppose there are ways. Surely SKK knows better; I am curious too about this.

Link to comment
Share on other sites

Your NPC should have the appropriate workshop script attached. Usually, this means they have WorkshopNPCScript so they can be assigned to a settlement.

  1. Open the Creation Kit.
  2. Locate your NPC in the Object Window under Actors.
  3. Ensure that the NPC has WorkshopNPCScript attached under the "Scripts" tab

You'll need a quest with a dialogue topic where the player can invite the NPC to the settlement.

  1. In Quest window, create a new quest (Miscellaneous type works fine).
  2. Add a Dialogue View under the Player Dialogue tab.
  3. Create a new Topic where the player asks the NPC to join the settlement.

After the player selects the recruitment option, you'll need a script that assigns the NPC to a settlement.

  1. In the dialogue response window, go to the Papyrus Fragment section.
  2. Add the following script snippet to the End Script Fragment box:
 

; Get the player's currently active settlement
WorkshopScript WorkshopRef = Game.GetPlayer().GetLinkedRef(WorkshopParent.WorkshopItemKeyword) as WorkshopScript

; Assign the NPC to that settlement
If WorkshopRef
    Self.SetLinkedRef(WorkshopRef, WorkshopParent.WorkshopItemKeyword)
    (Self as WorkshopNPCScript).SetWorkshop(WorkshopRef)
    Debug.Notification("NPC has joined your settlement!")
EndIf


 

After the NPC joins the settlement, you want them to be assignable to work.

  1. Ensure the NPC has WorkshopNPCScript attached.
  2. Ensure they have the correct WorkshopActorType keyword so they function properly within settlements.
  3. If necessary, manually enable the "Allow Move" flag in the WorkshopParent script.
     

 

 
  • Like 1
Link to comment
Share on other sites

    If ((ThisActor as Actor).GetActorBase().IsUnique() == TRUE)
        (pWorkshopParent as WorkshopParentScript).AddPermanentActorToWorkshopPlayerChoice((ThisActor as Actor), bWaitForActorToBeAdded = true)
    Else
        Location ThisLocation = (pWorkshopParent as WorkshopParentScript).AddActorToWorkshopPlayerChoice(actorToAssign = ThisActor, bWaitForActorToBeAdded = true, bPermanentActor = false)
    Endif
 

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...