Machiavelli24
Mod creator
- Joined
- May 9, 2012
- Messages
- 818
Compatibility
This code is compatible with vanilla Beyond Earth. It is not compatible with Rising Tide. I am working on an update.
CivFanatics Download
Workshop Download
What it does
This mod contains code that defines a new XML table. By adding entries to this table mod makers can have UnitUpgrades grant Promotions. This works identically for UnitPerks that are inherently part of unit upgrades and UnitPerks that are choices. If an end-user is playing with multiple mods that use this snippet it will work properly.
UnitPerks_UGP_FreePromotions: <PerkType, PromotionType>
Any unit with the PerkType will automatically be given the PromotionType.
How to incorporate into your mod
Copy the "UnitPerks Grant Promotions", "UnitCreatedEvent" and "UnitUpgradedEvent" directory and all its contents to your mod. "UnitPerks Grant Promotions" will only work if you are also using the "UnitCreatedEvent" and "UnitUpgradedEvent" snippets. Have the XML file update the database (via the Action tab) and set the LUA file as an "InGameUIAddin" (via the Content tab).
Make sure the XML files from this snippet that create the table update the database before any files attempt to add entries into the tables for this snippet.
In the UI folder UnitUpgradePopup.lua will need to be added via "InGameUIAddin" and have VFS set to true. It will replace the existing UnitUpgradePopup.lua. Without it the help text from the promotions will not show up when a player is looking at perks in the unit upgrade UI (but the promotions will still be granted).
How to use
Add entries to one of the UnitPerks_UGP_FreePromotions table.
How it works
A collection of functions detect when a player creates a new unit or a unit is upgraded. When one of these happen it looks for all UnitPerks the unit has and gives the unit any promotions that match those UnitPerks in the UnitPerks_UGP_FreePromotions table. The algorithm does not poll every turn and units will be given the promotion right away, not next turn.
Limitations
If a UnitUpgrade does not change the art style of a unit (currently all in game UnitUpgrades do change the art of a unit) this code may not grant units that existed during the upgrade any promotions associated.
This code is compatible with vanilla Beyond Earth. It is not compatible with Rising Tide. I am working on an update.
CivFanatics Download
Workshop Download
What it does
This mod contains code that defines a new XML table. By adding entries to this table mod makers can have UnitUpgrades grant Promotions. This works identically for UnitPerks that are inherently part of unit upgrades and UnitPerks that are choices. If an end-user is playing with multiple mods that use this snippet it will work properly.
UnitPerks_UGP_FreePromotions: <PerkType, PromotionType>
Any unit with the PerkType will automatically be given the PromotionType.
How to incorporate into your mod
Copy the "UnitPerks Grant Promotions", "UnitCreatedEvent" and "UnitUpgradedEvent" directory and all its contents to your mod. "UnitPerks Grant Promotions" will only work if you are also using the "UnitCreatedEvent" and "UnitUpgradedEvent" snippets. Have the XML file update the database (via the Action tab) and set the LUA file as an "InGameUIAddin" (via the Content tab).
Make sure the XML files from this snippet that create the table update the database before any files attempt to add entries into the tables for this snippet.
In the UI folder UnitUpgradePopup.lua will need to be added via "InGameUIAddin" and have VFS set to true. It will replace the existing UnitUpgradePopup.lua. Without it the help text from the promotions will not show up when a player is looking at perks in the unit upgrade UI (but the promotions will still be granted).
How to use
Add entries to one of the UnitPerks_UGP_FreePromotions table.
How it works
A collection of functions detect when a player creates a new unit or a unit is upgraded. When one of these happen it looks for all UnitPerks the unit has and gives the unit any promotions that match those UnitPerks in the UnitPerks_UGP_FreePromotions table. The algorithm does not poll every turn and units will be given the promotion right away, not next turn.
Limitations
If a UnitUpgrade does not change the art style of a unit (currently all in game UnitUpgrades do change the art of a unit) this code may not grant units that existed during the upgrade any promotions associated.