Refactor DynamicItemGenerator.cfg
Decription for modders
You no longer need to duplicate your generators many times within DynamicItemGenerator.
From DynamicItemGenerator.cfg the generators for NPCs are moved to files. The files are organized by faction folders. Basic generators have been created that allow you to control generation for all or a specific faction at once.
Decription for players
You can put this mod in your ~mods folder. But, it will primarily be of interest to other creators, as it makes it easier to add and manage the generation of objects from NPCs.
Right now all settings are set to 100% chance. Which means that every new generated (not quest, not zombie, not pre-configured) NPC will have a unit from each category. There will be 1 artifact, 1 armor, 1 detector, 1 weapon, 1 pistol. Expendable items drop at various odds. Weapon modifications and blueprints are missing from the generation.
NPCs that have already been generated in your save will not change anything.
After much experimentation, I will describe some code rules that were discovered, as I could not find any information on the internet about the syntax of the language used in the .cfg files.
– Inherited refkeys within the same file must be above, otherwise they will not apply
– Chaining inheritance through refkey will not work. (although they work in the original files).
– Deduced generators that are inherited in the original files must not have inheritance themselves.
– For a generator to work, it must either be inherited by another generator, or inherit {refurl=ItemGeneratorPrototypes.cfg;refkey=[0]} itself. But only one thing.
– struct.begin, *struct-body, struct.end | must be on different lines. If you write them on the same line, they won’t work.
– Refkey inheritance for lists with [ * ] or [0] causes an error.
– If you know any other non-obvious syntax rules, please post them in the comments.
Valid
[0] : struct.begin {refkey=Template_BodyArmor_Varta_Experienced}
ItemPrototypeSID = Battle_Varta_Armor
struct.end
Error
[0] : struct.begin {refkey=Template_BodyArmor_Varta_Experienced} ItemPrototypeSID = Battle_Varta_Armor struct.end
Valid
Template_BodyArmor_Varta_Experienced : struct.begin
Weight = 400
MinDurability = 0.20
MaxDurability = 0.75
MinCount = 2
MaxCount = 2
struct.end
…
[0] : struct.begin {refkey=Template_BodyArmor_Varta_Experienced}
ItemPrototypeSID = Battle_Varta_Armor
struct.end
Error
[0] : struct.begin {refkey=Template_BodyArmor_Varta_Experienced}
ItemPrototypeSID = Battle_Varta_Armor
struct.end
…
Template_BodyArmor_Varta_Experienced : struct.begin
Weight = 400
MinDurability = 0.20
MaxDurability = 0.75
MinCount = 2
MaxCount = 2
struct.end