Jump to content

Spawn NPC, make settler, move to settlement using script


Recommended Posts

I know how to spawn a random settler via script, I know how to set their attributes, but I don't know if I can move that settler to a specific settlement via script, or failing that, to the settlement the player character is currently in.

 

For testing SImSettlements2 I wish to quickly create muiltiple settlers with specific attributes and have them automatically move to a settlement or HQ, doing this via console and then going into workshop mode for each one quickly becomes a bore:) Hence the desire for a script that will DO IT ALL! MWAHAHAHAHA

 

diziet

Link to comment
Share on other sites

In Creation Kit, edit your script so it includes in its properties:

workshopparentscript Property WorkshopParent Auto Const

Then add the line:

WorkshopParent.AddPermanentActorToWorkshopPUBLIC(settlerRef, workshopID)

where 'settlerRef' is the Object Reference of your spawned settler and 'workshopID' is the ID of the workshop you want to assign the settler to. Then compile the script and make sure the WorkshopParent property has filled properly.

Link to comment
Share on other sites

If the settler does not exist then compile this, put in data\scripts and console [ cgf "SKK_GlobalScript.CreateSettler" workshopref ]

ScriptName SKK_GlobalScript

Function CreateSettler(ObjectReference thisWorkshop) Global

If (thisWorkshop != None) && (thisWorkshop is WorkshopScript)
   Quest pWorkshopParent = Game.GetFormFromFile(0x0002058e, "Fallout4.esm") as Quest
   WorkshopNPCScript thisActor = (pWorkshopParent as WorkshopParentScript).CreateActor((ThisWorkshop as WorkshopScript)) 
   Debug.Notification("Created Settler")
   ; do stuff to thisActor here
Else
  Debug.Notification("No Workshop")
EndIf

EndFunction
Link to comment
Share on other sites

This looks v. useful;

question re: first reply by adb3nj:

workshopparentscript Property WorkshopParent Auto Const

do I not need to set this property in the CK? If so what to? I always get myself confused with scripts as properties, and I've done it few times in my mods:)

 

re: second reply by SKK50: 'thisWorkshop' is the id of the workshop as adb3nj mentions? and a workshop will have WorkshopScript attached to it so that 'thisWorkshop is WorkshopScript' works, that is what that means?

 

diziet

Link to comment
Share on other sites

This looks v. useful;

question re: first reply by adb3nj:

workshopparentscript Property WorkshopParent Auto Const

do I not need to set this property in the CK? If so what to? I always get myself confused with scripts as properties, and I've done it few times in my mods:)

 

Autofill it.

Link to comment
Share on other sites

  • 1 year later...
On 8/4/2023 at 4:59 AM, adb3nj said:

Sorry cannot use this editor system to use quotes.

Where do I get the NPC reference from. using "Actor property NPCid Auto",, does not fill. So what is the reference?? Is it the text value that one can give an NPC reference  instance in the game????. And What is the workshop ID ?????

WorkshopParent.AddPermanentActorToWorkshopPUBLIC(settlerRef, workshopID)
WorkshopParent.AddPermanentActorToWorkshopPUBLIC(settlerRef, workshopID)
WorkshopParent.AddPermanentActorToWorkshopPUBLIC(settlerRef, workshopID)

 

Edited by AndyTheSaurus
Link to comment
Share on other sites

  • Recently Browsing   0 members

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