Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;*****************************************************************************************************
- ScriptName SKK_GlobalUtility
- Function OwnAndKillAll() Global
- ; By SKK.50@outlook.com August 2020
- ; To test what happens when trying to become MM general with Preston and no free workshops for radiant recruitment quests.
- ; Moves the player to each workshop registered with WorkshopParentScript so object references can load.
- ; Waits for ResetWorkshop to update resource lists from loaded objects.
- ; Takes ownership of the workshop.
- ; Kills all actors registered with the workshop (aka "Settlers") including invulnerable kids.
- ; Calls reset workshop to ensure stats are updated.
- ;
- ; Call from the PC console [ cgf "SKK_GlobalUtility.OwnAndKillAll" ]
- Actor pPlayerREF = Game.GetFormFromFile(0x00000014, "Fallout4.esm") as Actor
- Quest pWorkshopParent = Game.GetFormFromFile(0x0002058e, "Fallout4.esm") as Quest
- ObjectReference pSanctuaryWorkshopRef = Game.GetFormFromFile(0x000250fe, "Fallout4.esm") as ObjectReference
- WorkshopScript[] WorkshopREFs = (pWorkshopParent as WorkshopParentScript).Workshops
- Int iWorkshopIndex = 0
- While (iWorkshopIndex < WorkshopREFs.Length)
- WorkshopScript ThisWorkshop = WorkshopREFs[iWorkshopIndex]
- pPlayerREF.MoveTo(ThisWorkshop) ;so ObjectReferences can load for enumeration
- While ((pWorkshopParent as WorkshopParentScript).IsEditLocked() == TRUE) ; ResetWorkshop is updating resource arrays
- Utility.WaitMenuMode(1.0)
- EndWhile
- (ThisWorkshop as WorkshopScript).SetOwnedByPlayer(True)
- ObjectReference[] WorkshopActors = (pWorkshopParent as WorkshopParentScript).GetWorkshopActors(ThisWorkshop as WorkshopScript)
- Int iActorIndex = 0
- While (iActorIndex < WorkshopActors.Length)
- Actor ThisActor = WorkshopActors[iActorIndex] as Actor
- ThisActor.GetActorBase().SetInvulnerable(abInvulnerable = False) ; Some kids are set to invulnerable. Awwwww.
- ThisActor.KillEssential(akKiller = None)
- iActorIndex +=1
- EndWhile
- (pWorkshopParent as WorkshopParentScript).ResetWorkshop(ThisWorkshop as WorkshopScript) ; Ensure resource arrays are up to date
- While ((pWorkshopParent as WorkshopParentScript).IsEditLocked() == TRUE) ; ResetWorkshop is updating resource arrays
- Utility.WaitMenuMode(1.0)
- EndWhile
- Debug.Trace("SKK_GlobalUtility.OwnAndKillAll " + iWorkshopIndex + " " + ThisWorkshop + " " + ThisWorkshop.GetParentCell() + " Kills " + iActorIndex)
- iWorkshopIndex +=1
- EndWhile
- pPlayerREF.MoveTo(pSanctuaryWorkshopRef) ;now Fast Start Minutemen option #1
- EndFunction
- ;*****************************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement