Jump to content

Removing Settlement Ownership


Recommended Posts

Good day all,

 

I am looking at the possibility of adding a function to a mod to remove a settlement from player ownership, kind of like extreme unhappiness does it. Instead however, I am looking for force this via papyrus when the player fails to defend a settlement via my own custom REScript for settlement attacks that fail.

 

I have looked at Cell Script and Actor Script documentation and note SetActorOwner on a cell and object reference perspective. I am assuming if I use SetActorOwner on the workshop workbench and change it from PlayerREF to none, this *should* remove the player as owner, but my question is, by removing the workbench from player ownership, does it also remove the settlement?

 

Should I also be looking to use Location Script SetCleared(false) to force the player to need to retake it?

 

In essence, if the player fails the settlement defense mini-game in my mod, I want the attacking party to take over the settlement (and subsequently remove ALL settlers) which would then cause the player to 1) lose the settlement and 2) be forced to mount an offensive to retake it via combat with the holding party, be it raiders or gunners or super mutants.

 

Im quite confident I can track the retaking aspect via an attached script on the 'defenders' to track total count of refcollectionalias and subtracting one when killed, much the same as the script DN054GunnerScript on the quest DN054, where you must kill 'x' amount of gunners to resolve the attack phase at Atom Cats Garage and advance the quest. So that is simple enough.

 

Its the removing of settlement ownership and allowable recapture that I have questions with. And I ask ahead of any coding, because why waste time if this is not even possible....

 

So, has anyone ever done this? Remove a settlement from player ownership and then allow retaking it upon quest stage, all via papyrus?

Link to comment
Share on other sites

I have removed and reassigned player workshop ownership using WorkshopParentScript groups and WorkshopScript functions to ensure all the dependent flags and triggers are configured. Take a look at WorkshopScript.psc code from line 465.

 

Some abbreviated definitions (no, this wont run as is):

import WorkshopScript
WorkshopParentScript  Property pWorkshopParentScript     Auto Const Mandatory
...
WorkshopScript ThisWorkshopRef = pWorkshopParentScript.Workshops[iIndex]
ThisWorkshopRef.SetOwnedByPlayer(True)  ; Script.Function
ThisWorkshopRef.AllowAttacks = False    ; Script.Property

Edit: if you have a direct REF to the workshop you may be able to drop the WorkshopParentScript, but with the fragility of the settlement system best to follow the forms.

Edited by SKK50
Link to comment
Share on other sites

  • Recently Browsing   0 members

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