Advertisement
skk50

Fallout 4 own all workshops kill all settlers

Aug 23rd, 2020 (edited)
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. ;*****************************************************************************************************
  2.  
  3. ScriptName SKK_GlobalUtility
  4.  
  5. Function OwnAndKillAll() Global
  6.  
  7. ; By SKK.50@outlook.com August 2020
  8. ; To test what happens when trying to become MM general with Preston and no free workshops for radiant recruitment quests.
  9. ; Moves the player to each workshop registered with WorkshopParentScript so object references can load.
  10. ; Waits for ResetWorkshop to update resource lists from loaded objects.
  11. ; Takes ownership of the workshop.
  12. ; Kills all actors registered with the workshop (aka "Settlers") including invulnerable kids.
  13. ; Calls reset workshop to ensure stats are updated.
  14. ;
  15. ; Call from the PC console [ cgf "SKK_GlobalUtility.OwnAndKillAll" ]
  16.  
  17. Actor pPlayerREF = Game.GetFormFromFile(0x00000014, "Fallout4.esm") as Actor
  18. Quest pWorkshopParent = Game.GetFormFromFile(0x0002058e, "Fallout4.esm") as Quest
  19. ObjectReference pSanctuaryWorkshopRef = Game.GetFormFromFile(0x000250fe, "Fallout4.esm") as ObjectReference
  20.  
  21. WorkshopScript[] WorkshopREFs = (pWorkshopParent as WorkshopParentScript).Workshops
  22.  
  23. Int iWorkshopIndex = 0
  24. While (iWorkshopIndex < WorkshopREFs.Length)
  25.  
  26. WorkshopScript ThisWorkshop = WorkshopREFs[iWorkshopIndex]
  27. pPlayerREF.MoveTo(ThisWorkshop) ;so ObjectReferences can load for enumeration
  28.  
  29. While ((pWorkshopParent as WorkshopParentScript).IsEditLocked() == TRUE) ; ResetWorkshop is updating resource arrays
  30. Utility.WaitMenuMode(1.0)
  31. EndWhile
  32.  
  33. (ThisWorkshop as WorkshopScript).SetOwnedByPlayer(True)
  34.  
  35. ObjectReference[] WorkshopActors = (pWorkshopParent as WorkshopParentScript).GetWorkshopActors(ThisWorkshop as WorkshopScript)
  36. Int iActorIndex = 0
  37. While (iActorIndex < WorkshopActors.Length)
  38. Actor ThisActor = WorkshopActors[iActorIndex] as Actor
  39. ThisActor.GetActorBase().SetInvulnerable(abInvulnerable = False) ; Some kids are set to invulnerable. Awwwww.
  40. ThisActor.KillEssential(akKiller = None)
  41. iActorIndex +=1
  42. EndWhile
  43.  
  44. (pWorkshopParent as WorkshopParentScript).ResetWorkshop(ThisWorkshop as WorkshopScript) ; Ensure resource arrays are up to date
  45. While ((pWorkshopParent as WorkshopParentScript).IsEditLocked() == TRUE) ; ResetWorkshop is updating resource arrays
  46. Utility.WaitMenuMode(1.0)
  47. EndWhile
  48.  
  49. Debug.Trace("SKK_GlobalUtility.OwnAndKillAll " + iWorkshopIndex + " " + ThisWorkshop + " " + ThisWorkshop.GetParentCell() + " Kills " + iActorIndex)
  50. iWorkshopIndex +=1
  51.  
  52. EndWhile
  53.  
  54. pPlayerREF.MoveTo(pSanctuaryWorkshopRef) ;now Fast Start Minutemen option #1
  55.  
  56. EndFunction
  57.  
  58. ;*****************************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement