the Sim Settlements forums!

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Solved Using the console to remove all faction decorations

MattLish

Member
Messages
32
I appreciate that there are multiple threads on removing faction decorations.
However, most of these are about using in-game methods to remove the decorations. I would like to use the console, as the in-game methods do not work for me as I do not wish to ever own the settlement (so I can't just use the city planners desk) (this is for gameplay reasons, I own no settlements).
My specific problem is that they have spawned in the air in most settlements but I am too far into a playthrough to restart.

I did some reverse engineering of the code and found that there is a ClearFactionDecorations function on the FactionControlManager.

I assumed I could do the following
help FactionControlManager (get the quest ref)
cqf {questRef} ClearFactionDecorations {aWorkshopRef} . I got the workshopRef from clicking on a workshop.

Unfortunately, this doesn't do anything at all. I get no errors in the console but after waiting a while, nothing happens.
I wonder if akWorkshopRef.GetLinkedRefChildren(FactionDecorationsKeyword) is returning no LinkedRefs, but there is no console/debug output to know.
Either I am doing something wrong or there is something wrong with my game.

Firstly, is my understanding of the above correct?
Secondly, is there anything I can do to confirm that SS is correctly tracking the faction decorations to be able to remove them?
Or thirdly, am I just totally way off?

I've a fairly decent experience with modding and programming, so any help to debug this further is appreciated.
 
Last edited:
Solution
For clarity, if anyone comes across this thread looking how to remove faction decorations via the console, it can be achieved as I originally guessed.
It didn't work for me because I had another unrelated issue.

You need to get a quest reference...

uituit

Secretary ;)
Staff member
Administrator
Moderator
Verified Builder
Support Team
Wiki Contributor
Messages
2,956
Been a while.
did you turn faction decorations off in teh holotape? and then try those console commands?

there is always disable/markfordelet if nothing else works
 

MattLish

Member
Messages
32
Yeah, I turned that option off in the holotape/MCM (I actually had this problem before so thought I turned it off before I started SS:C building but obviously not). Either way, it's definitely off now.

I realise I can do that for every single item but that will take a long time. Especially if I need to do it on every item in every settlement.
If nothing else, I can add some debugging to the SS scripts to figure out what's going on.

Unfortunately, I can't seem to compile the SS scripts though.

Can you provide any assistance on that (if this isn't the right place for that I am happy to move this somewhere else).

I tried to run

Code:
"{pathToFO4}/Papyrus Compiler/PapyrusCompiler.exe" "{pathToSS}\scripts\SimSettlements\WorkshopFrameworkIntegration" \
-a \
-f="{pathToFO4}\Data\Scripts\Source\Base\Institute_Papyrus_Flags.flg" \
-i="{pathToSS}\scripts\SimSettlements;\
{pathToSS}\scripts\SimSettlements\WorkshopFrameworkIntegration;\
{pathToFO4}\Data\Scripts\Source" \
-o="{anOutput}"

But when I do I get compiler errors

Code:
❯ ./compile-all.sh
Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright (C) ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "FactionControlManager.psc"...
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(84,65): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(84,79): required (...)+ loop did not match anything at input '['
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(363,31): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(374,28): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(374,96): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(375,29): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(375,89): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(473,31): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(528,95): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(530,67): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(530,163): no viable alternative at character '#'
E:\Games\Fallout 4 MO2\mods\Sim Settlements\scripts\SimSettlements\WorkshopFrameworkIntegration\FactionControlManager.ps
c(0,0): filename does not match script name: "simsettlements:workshopframeworkintegration:factioncontrolmanager" expecte
d: "FactionControlManager"
No output generated for FactionControlManager.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on FactionControlManager.psc

For now, FactionControlManager is the only thing I am trying to compile.

I have only ever compiled Skyrim psc files so I might be missing something, but I can't seem to compile this at all.
Do I need a flag or something?
 

uituit

Secretary ;)
Staff member
Administrator
Moderator
Verified Builder
Support Team
Wiki Contributor
Messages
2,956
Scripts are above my pay grade but i will let KG know about this thread ;)
 

MattLish

Member
Messages
32
Scripts are above my pay grade but i will let KG know about this thread ;)
Awesome, thanks!

KG, if you happen to read this, I am more than happy to provide a PR with debugging/README info. I've had to do some serious reverse engineering to figure out how WSFW and SS works, so I can write up some README/docs for those.
I think it would be worthwhile adding some further debugging to these methods.

On that, are the SS scripts open-source/available for contribution?
I would be more than happy to add to them.
 

MattLish

Member
Messages
32
Scripts are above my pay grade but i will let KG know about this thread ;)
I managed to get some more information and potentially solve it but I think something has inherently gone wrong, so it would be good to understand why.
This is probably still script heavy though.

I opened my save in ReSaver and noticed that all my saves have an active script that won't go away
1609349581306.png

After terminating that script, I can successfully run the console commands I had above.
It looks like perhaps this has just got stuck.

A few questions then:
  • If I terminate this script, I assume it won't ever correctly set the faction, perhaps I could rerun that from the console again?
  • Are you interested in a save file to debug this any further or just put it down to something going wrong my end?
  • Is there any more digging you want me to do to see if this is a SS bug?
 

uituit

Secretary ;)
Staff member
Administrator
Moderator
Verified Builder
Support Team
Wiki Contributor
Messages
2,956
Sure ur save would be helpful ,not sure if KG has seen this yet but im sure he will get to it when he can :)
 

MattLish

Member
Messages
32
Sure ur save would be helpful ,not sure if KG has seen this yet but im sure he will get to it when he can :)
Okay, I've managed to narrow down the problem.

(Apologies, this is a bit of a long post but I think I have found a bug. Again, happy to provide a fix for it if I can have some support running the compiler and get access to the code)

uituit, you might be able to help with part of this as it's possible I am just being an idiot or didn't follow instructions properly.

tldr; my war planners desk doesn't work in settlements controlled by a faction with one or more plots, even if there are no settlers.

I traced this issue right back to when I placed a war planners desk in a settlement. It only works if there are currently no plots in that settlement or it is not currently controlled by a faction.
I realise now I never got the flag placement, meaning it never succeeded. It did assign my chosen faction to the city, so something worked, but it didn't complete.
I used the prebuild option, so some settlements were already controlled by a faction.
All of the below were tested in a few settlements with 0 people (sometimes I killed those people before starting).

Works:
  • Totally empty settlement, no faction/city plan/plots etc.
  • Settlement owned by a faction with 0 plots
  • Settlement not owned by a faction with 1 or more plots
  • Settlement with a city plan with no plots (If I remove them all before placing the desk)

Doesn't work:
  • Settlement with a faction and at least 1 plot

This makes sense because the issue I have seems to be getting stuck on removing faction skins.

Here is a google drive link to some saves. One just before I place the war planners desk (so before I experience the issue) and one just after.
I consistently get the issue with the before save after placing a war planners desk.

Non-technical questions:
  • Is this expected behaviour/a known issue?
  • Is it expected that the war planners desk will not work if a faction owns a settlement already, even if all the settlers are dead?
  • If so, is it worth putting a warning in about the above?

Technical questions:
I think the issue is likely with the ClearFactionSkins

The first while loop will only exit if thisSkin is not empty. If for some reason it failed to find AppliedSkin then the loop will never end.
Code:
   ; Some code...
    int I = 0
    While (I < akPlotRefs.length)
        simsettlements:simbuildingplanskin thisSkin = akPlotRefs[I].AppliedSkin
        If (thisSkin)
            ; Some code...
            I += 1
        EndIf
    EndWhile

Shouldn't the increment be after the EndIf, so it doesn't get stuck?
Code:
   ; Some code...
    int I = 0
    While (I < akPlotRefs.length)
        simsettlements:simbuildingplanskin thisSkin = akPlotRefs[I].AppliedSkin
        If (thisSkin)
            ; Some code...
        EndIf
      I += 1 ; Should this actually be here?
    EndWhile

Unfortunately, that's just a bit of a stab in the dark.
 
Last edited:

kinggath

Well-Known Member
Staff member
Administrator
Moderator
Verified Builder
Messages
3,884
I haven't gone through this entire post - but I'll hotfix that script immediately - expect it up within the hour.

Unfortunately those loops require save surgery to break out of, so you'll need to use Fallrim Tools to find and terminate those in your save under the ActiveScripts section after I post the fix.
 

MattLish

Member
Messages
32
I haven't gone through this entire post - but I'll hotfix that script immediately - expect it up within the hour.

Unfortunately those loops require save surgery to break out of, so you'll need to use Fallrim Tools to find and terminate those in your save under the ActiveScripts section after I post the fix.
I appreciate there was quite a lot there so I can summarise.
  • I can confirm 4.2.9b fixes the issue (at least on my test save where I consistently got the issue). Thanks for sorting!
  • I will do some save file manipulation and reading of the code to figure out what went wrong my end to replicate it via the console.
  • My original question about clearing faction decorations was the correct assumption. I'll add a new reply to make it more obvious in case anyone stumbles on this question looking for an answer.
  • Are SS scripts available anywhere? Would it be worth hosting these on GitHub so minor tweaks and fixes like this can be made by the community?
  • If the SS scripts go onto GitHub I would be happy to write some docs/READMEs/contribution guides etc.
Again, thanks for sorting this!
 
Last edited:

MattLish

Member
Messages
32
For clarity, if anyone comes across this thread looking how to remove faction decorations via the console, it can be achieved as I originally guessed.
It didn't work for me because I had another unrelated issue.

You need to get a quest reference and a workshop reference to apply the function.

In the console, run:
  • help FactionControlManager - copy the quest reference
  • cqf {questRef} ClearFactionDecorations {aWorkshopRef} . Replace {questRef} with the reference you copied above and {aWorkshopRef} with a workshop reference (which you can get by clicking on a workshop).
If this does nothing, then you've got another deeper problem like I did which might be fixed with the patch KG applied.
Read the rest of this thread for some context on that.
 
Solution
Top