Often when I’m making a mod I’ll need to write additional code that allows me to implement effects I otherwise couldn’t. These snippets aren’t just useful to me, other mod makers can take advantage of them to build their own creations. I’ve separated many of them out and put them in a collection together on Steam Workshop. They are also on CivFanatics forum in the code snippets section.
Policies grant buildings & perks
This snippet greatly expands what you can do with Virtues. With only XML you can have Virtues grant buildings or perks in certain cities a player controls.
Loadouts grant perks
Loadouts are the pre-game colonists, cargo and spacecraft players pick. This snippet expand what you can do with them with only XML.
Unit Created Event
This snippet is for Lua, it lets you easily detect when a unit is created.
Unitperks grant promotions
This snippet hasn’t been updated for Rising Tide yet, but I’m working on it. It expands what effects you can give a unit when it upgrades from Affinity.