Linked Distribution
available in SPID 7.0.0+


Summary

Linked Forms define unconditional distribution by linking to other Distributable Forms*. They use the same ordering rules as regular entries. When a parent entry is distributed, all Linked Forms are automatically distributed as well to the same NPC.

Linked Distribution is not recursive, so linking forms to other Linked Forms won't cause a cascading distribution. Only immediate "descendants" of the original Distributable Form will be distributed.

Finally, Linked Forms are also controlled by Exclusive Groups, so that if Linked Forms are part of an Exclusive Group and another form from the same group is being distributed, then Linked Forms won't be distributed.

* Only other SPID distributions trigger Linked Distribution. If NPC initially had parent forms or they were added by other means, Linked Distribution won't be triggered.


Supported Forms

All Distributable Forms can be linked.


Syntax

Same rules as in regular Distribution Syntax apply.

LinkedFormType = FormOrEditorID|FormsList|CountOrPackageIndex|Chance
         required                                         required                       required                               optional                        optional
                                                                                                                                  Default: Index=0; Count=1        Default 100

where:

  • LinkedFormType* - a dynamic key similar to regular entries that indicates type of the entry to be distributed, prefixed with Linked. (LinkedItem, LinkedOutfit, ...)
  • FormOrEditorID - FormID or EditorID of the form that you want to link to other forms. This form will be distributed whenever any form from FormsList is being distributed.
  • FormsList* - a comma separated list of FormIDs or EditorIDs similar to default FormFilters in regular SPID entries. These are parent forms, that will trigger distribution of given Linked Form.
  • Count - when Linked Form is an Item, you may specify count of items to add similarly to regular Item distribution. (This also supports Random Counts)
  • Package Index - when Linked Form is a Package, you may specify Index at which Package will be inserted.
  • Chance - additional random chance that is applied to this Linked Form

* LinkedFormType supports Form Type Inferring, so you can use literally "LinkedForm" as a key and SPID will determine type of the linked form during initalization.
* Combining (+) and Exclusion (-) modifiers don't make sense in FormsList, thus are not supported.


Scopes

Due to high risk of unpredictable distributions with Linked Formsby default they are constrained to be linked only to distributable forms from the same file where they are defined. This allows to use the feature and not worry that distributions from other mods will break your intended distribution.

When you're absolutely sure you want to link a form to distributable forms from all config files you can use prefix Global to explicitly mark Linked Form as linked globally:

GlobalLinkedFormType = FormOrEditorID|FormsList|CountOrPackageIndex|Chance
This will link given form globally and distribute it whenever forms from FormsList are distributed, regardless of their origin.


On Death Distribution

Finally, you can also link specifically to On Death Distributable Forms. That will automatically make Linked Form also be distributed On Death.

LinkedDeathFormType = FormOrEditorID|FormsList|CountOrPackageIndex|Chance
or
GlobalLinkedDeathFormType = FormOrEditorID|FormsList|CountOrPackageIndex|Chance
will both distribute a given form on NPC's Death.


Examples

  • Typical usage of Linked Forms

; Giving cool bow with a 70% chance
Item = MyCoolBow|NONE|NONE|NONE|NONE|1|70

; Immediately giving 20 arrows for your cool bow
LinkedItem = ArrowsForMyCoolBow|MyCoolBow|20

; Also, in rare cases (5% chance) give 10 superb arrows.
LinkedItem = SuperbArrowsForMyCoolBow|MyCoolBow|10|5

In case you want them to have only one type of arrows you can simply create an Exclusive Group for your arrows. Though you'd want to adjust order of LinkedItem entries to prioritize distribution of SuperbArrows.
ExclusiveGroup = SingleArrowType|ArrowsForMyCoolBow,SuperbArrowsForMyCoolBow
  • Spells, perks and outfits, perhaps? Let's randomly turn some NPCs into Necromancers

Let's imagine that we have several mods that add perks and spells to NPCs. And we want to make another mod that would dynamically give outfits suitable for Necromancers if such NPCs get appropriate spells or perks. Here is a setup:

ModA_DISTR.ini
; Some complex distribution of RaiseZombie spell
Spell = RaiseZombie|...

ModB_DISTR.ini
; Another mod gives Necromancy Perk
Perk = Necromancy|...

ModC_DISTR.ini (you are here)
Since we want to dress necromancers properly and we do not care which mod gave them spells or perks suitable for necromancers, we mark our Linked Form as Global:
; Now, if it happens so that NPC gets anything related to necromancy, let's give him a proper outfit:
GlobalLinkedOutfit = NecromancerOutfit|RaiseZombie,Necromancy


When to use

When you find yourself in a situation where you create temporary keywords, just to bind several items together. Be it bows & arrows, perks, weapons or any other forms.

If you find the following setup familiar, you should adopt Linked Forms:
Item = CoolBow|ComplexFiltering
Item = AmmoForCoolBow|ComplexFiltering|20


or, slightly better:

Keyword = GetsCoolBow|ComplexFiltering|NONE|50

Item = CoolBow|GetsCoolBow
Item = AmmoForCoolBow|GetsCoolBow|20

Instead, you should do:
Item = CoolBow|ComplexFiltering
LinkedItem = AmmoForCoolBow|CoolBow|20

Article information

Added on

Edited on

Written by

sasnikol

2 comments

  1. sasnikol
    sasnikol
    • premium
    • 477 kudos
    Locked
    Sticky
    Share your cool mods that use Linked Distribution would be great to have more examples and use cases.
  2. MardorTheMadman
    MardorTheMadman
    • member
    • 0 kudos
    This from one I made for personal use, that I may post somewhere eventually, but could still be used as an example here.
    It looks roughly like this:

    ;25% chance each outfit gets selected
    Outfit = OutfitA|ComplexFiltering|NONE|25
    Outfit = OutfitB|ComplexFiltering|NONE|33
    Outfit = SpecialOutfitA|ComplexFiltering|NONE|50
    Outfit = SpecialOutfitB|ComplexFiltering|NONE|100

    ExclusiveGroup = VariousOufits|OutfitA,OutfitB,SpecialOutfitA,SpecialOuftitB

    ;50% of those with a specialoutfit get added to the special faction
    LinkedFaction = SpecialFaction|SpecialOutfitA,SpecialOutfitB|NONE|50

    1. sasnikol
      sasnikol
      • premium
      • 477 kudos
      Hey, thanks!

      Also, if ComplexFiltering is the same for each outfit then you could evaluate it once with an intermediate Keyword, and then do LinkedOutfit to link outfits to this Keyword. However, since Linked Distribution is only one-level deep you wouldn't be able to link SpecialFaction to already LinkedOutfits, but this is a temporary limitation which will be removed some time in the future.