Fallout 4

Settlement Objects Expansion Pack (SOE Pack)
- Documentation

Script Injected Custom Menus

1. Introduction

There are two ways to add custom new menus/categories to the workshop, one is by defining the menus directly in the plugin (known as the plugin hard-coded method), another one is by injecting menus dynamically via scripting which used in this mod.

By using script injection method, compatibility issue that often occur with the plugin hard-coded method can be prevented and mod authors do not need to make countless patches for other mods. For example, issue like missing items when two or more mods edit the same menu with hard-coded method. Of course, everything is a two-edged sword, the disadvantage of using scripting method is that the menus must be removed in-game before the plugin is disabled, increasing the risk of uninstallation that will ripped off your vanilla menus if you uninstall the mod improperly.


2. How it works in the SOE Pack

For All DLC version, there are script-added menus in 'Structure', 'Vault' in the Structure, 'Furniture', 'Decoration' and 'Power' vanilla category.

For Non DLC version, there are script-added menus in 'Structure', 'Furniture', 'Decoration' and 'Power' vanilla category.


A brief introduction of the script mechanism in this mod

- When you load the plugin of this mod for the first time
  • The installation quest will be initiated, script is called by the quest.

- Script will run every time when you load a game save

  • When the script runs again, installation (menus injection) will be triggered, the menus are being install again no matter the status of the menu in the game save as to prevent possible missing menus.
  • However, if you run a menu fixer at the same time, such as the fixer provided by this mod and universal fixer by DarthWayne, the fixer will reset the vanilla menus and remove all script-added menus, thus blocking the injection.

- When you use the reinstaller chem/reinstall menus in the holotape*

  • The chem will trigger chem effect/holotape will call the function in the script to reset the installation quest, thus reset the quest to the status of first time installation.

- When you use the uninstaller chem/uninstall menus in the holotape*

  • The chem will trigger chem effect/holotape will call function in the script to end the installation quest, thus the quest will call the uninstallation function in the script and remove all menus added by this mod.

*Settings holotape is available only on v1.6.4 or later
Notes: Not all mods using script menus injection have the same mechanism, some script of these mod can only run once and don't provide a menu reinstallation function.


3. Additional Info


  • Why the vanilla menus disappear when you uninstall improperly?

The injected menus' references are save in the game save, when you load the save, the game look for a reference is not exist anymore as the plugin is removed. Thus, the game will return a NONE value which the menus cannot be load and process correctly.


  • Dealing with Game Saves

Built objects and injected menus are stored in game save, as long as you don't overwrite the exact save, your objects and menus are still there even you can't see them in game (imagine you are just accessing a read-only word file, but you don't have the font installed, so your computer can't display it correctly, but when you installed the font, you can read and display the file correctly.) So, if you resolve the plugin issue and load back the exact same save, your game should display objects and menus correctly. BE CAREFUL with the EXIT SAVE and Quick-save, make sure you know which save are the fine save you want to load instead of loading exit save and quick-save that objects and menus are already removed from them.

With the same principle, as the ID of all non DLC objects in All DLC version and all objects of the Non DLC version are the same, you can switch between Non DLC and All DLC version anytime you want while preserving all built non DLC objects in the game save.


Credits: DarthWayne (Custom Menu Script Template)

If you have any suggestions or questions, please feel free to post here.
By ccmads

Article information

Added on

Edited on

Written by

ccmads

3 comments

  1. Pal2alax
    Pal2alax
    • supporter
    • 11 kudos
    Is there a way to start the script in-game ?
  2. ismokw33d
    ismokw33d
    • member
    • 1 kudos
    I don't know if I am Truly retarded or what, But I can't for the life of me get Settlement Objects Expansion Pack to work at all I have tried installing it with NMM and manually but both times I don't get the Holo tape and my game crashes out when I open my settlement menu. any help will be gladly appreciated
    1. Pal2alax
      Pal2alax
      • supporter
      • 11 kudos
      Having same problem, i think this script isn't working properly for me, because no quest triggers ever.