Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

SeaSparrow

Uploaded by

Shekhinaga

Virus scan

Safe to use

Tags for this mod

About this mod

SKSE framework that distributes items to container references based on rules such as location, reference, count, item keyword etc.

Requirements
Permissions and credits
Mirrors
Changelogs
Container Distribution Framework is an SKSE plugin that allows mod authors to dynamically add items to container references without the need to replace the entire container. In addition, thanks to a robust rule system, it can also dynamically distribute to non-specific containers based on location, type of container, while leaving merchant containers untouched.


Requirements and runtimes:
1. Skyrim SE version 1.6.1130+
2.
Skyrim Script Extender
3.
Address Library for SKSE Plugins

A note on the Address Library:
This mod needs the


All in one Address Library (Anniversary Edition) version, regardless of whether or not you have purchased the AE DLC.

A note on runtime:
As stated above, this requires Skyrim SE version 1.6.1130+, sometimes called Skyrim AE. Please do not ask me to support older versions, I don't want to have multiple Skyrim installations.



Getting Started

In order to start using this framework, you need to make a config file. Config files are json files stored in Data/SKSE/Plugins/ContainerDistributionFramework/.

Each JSON file starts with this base:

Spoiler:  
Show

{
  "rules" : [
    {
      "friendlyName" : "Adds gold to all containers.",
      "changes" : [
        {
          "add" : "0xF|Skyrim.esm"
        }
      ]
    }
  ]
}

Configurations specify instructions. Each instruction is composed from 2 groups, and optionally a conditions group. The first is "friendlyName". Friendly name is used to make your identifier unique, and should be unique in your file. The second is the changes group, which specifies what should be added, removed, or replaced. The log will do its best to tell you what went wrong if you configured a file incorrectly, and won't load it in game.

Configuration file with all fields:
Spoiler:  
Show

{
  "rules" : [
    {
      "friendlyName" : "Example",
      "conditions" : {
        "locations" : [
           "0x802|CoolMod.esp"
        ],
        "worldspaces" : [
          "0x900|AnotherCoolMod.esl"
        ],
        "locationKeywords" : [
          "SomeLocationKeyword"
        ],
        "merchants" : false,
        "plugins" : [
          "mod1.esp",
          "mod2.esl"
        ],
        "containers" : [
          "0x801|CoolMod.esp"
        ],
        "references" : [
           "0xD62|UnCoolMod.esp"
        ],
        "bypassUnsafeContainers" : false
      },
      "changes" : [
        {
          "remove" : "0x800|CoolMod.esp",
          "removeByKeywords" : [
            "SomeCoolKeyword",
          ]
          "add" : [
            "0xFORMID|CoolMod.esp"
          ],
          "count" : 0
        }
      ]
    }
  ]
}


Condition Fields:
  • locations
    Locations are formatted strings (<local FormID>|ModName.esp). The FormID is the ID as it appears in xEdit, minus the index (so you'd remove the 02 from Dawnguard). For ESL mods (and ESP flagged ESL mods) you need to remove the first 5 letters - so FE000, for example. You replace what you removed with 0x and append the rest of the FormID.
    Locations are arrays, meaning that you can specify multiples separated by a comma.
    If the reference does not have a location, but is very near one (such as chests in the wilderness), it will find a nearby map marker within a range (defined in the ini file) to act as its location.
  • locationKeywords
    Location keywords is an array of strings representing the EditorID of the keyword.
  • worldspaces
    Worldspaces is an array of formatted strings that point to a worldspace in a plugin. All worldspaces must be present, if worldspaces is defined.
  • plugins
    Plugins is an array of strings representing the name of the plugin that is required for this ruleset.
  • references
    References is an array of formatted strings representing the formID of the reference you want to distribute to.
  • bypassUnsafeContainers
    Allows you to distribute to "unsafe" containers if set to true. Unsafe containers are containers that are either marked as "no respawn" or are in "No Reset" encounter zones. An example would be the Thalmor Embassy containers or Avanchnzel. Setting this to true allows you to distribute there, with a caveat: After an unsafe container has been evaluated, it won't be evaluated again. In the future, I might make this a per-rule restriction, but for now consider those containers set in stone after the player has seen them.
  • containers

    Containers is an array of formatted strings representing the formID of the base object of the container you want to distribute to.

Addition Fields:
  • add
    Add is an array of formatted strings, with each string pointing to an object that you want to add to a container. A random one is picked from among all of them to add to the container.
  • remove
    Remove is an array of formatted strings, with each string pointing to an object you want to remove from a container.
  • removeByKeywords
    Remove by keyword replaces remove if it is specified, and will remove all objects in the container with all the keywords.
  • count
    If specified, only (up to) that many items will be added or removed from the reference.


If both Add and (Remove or Remove By Keyword) are specified, the rule is considered a swap rule. At that point, count is ignored and all instances of remove will be removed and that many instances of add will be added
Limitations:
There are 2 limitations to keep in mind. The first one is that merchant containers are completely excluded from distribution regardless of settings. Adding and or removing to those references seems to break and not work when done dynamically. The second one is that all "safe" containers are ignored. This means containers that are set to "safe" in the container record and containers in no reset zones. If you want to edit these containers without conflicts, you will want to use Container Item Distributor. If you want to change the contents of a specific instance, you need to create a more involved solution using Base Object Swapper to swap that reference to a different container.

Source Code:
Github

Acknowledgements:
PowerOfThree - Built on that fork of CommonlibSSE.
ThirdEyeSqueegee - Container Item Distributor inspired this mod and a function is lifted from there.
Everyone who helped test this.