HandyVac
Gentleman
This resource adds two new database tables, which allow units to gain promotions from being upgraded.
What It Does
The UnitUpgrades_Promotions table attaches a promotion to an affinity-level upgrade. All units which recieve that upgrade will get the promotion.
The UnitPerks_Promotions table attaches a promotion to one of the selectable perks in an affinity-level upgrade. Units will get the promotion if this perk is picked when recieving the upgrade.
How it Works
Various events trigger a lua script, which checks whether any unit on the map has one of the Perks or Upgrades in these two tables. If it does, the script gives it the corresponding promotion.
A modified version of UnitUpgradePopup.lua makes sure the promotion's Help TXT_KEY is shown in tooltips on the Unit Upgrade screen. (The code to grant the promotions will still work without the modified UnitUpgradePopup.lua, but you won't see the promotion's effects listed in the Unit Upgrade tooltips.)
How To Use It
Simply include the following three files in your mod:
Limitations
Units will not gain promotions immediately when they're built or when an upgrade is applied, they will gain them the turn *after* they're built or the upgrade is applied.
Fixed: Units now gain promotions immediately.
Perks gained as a FreePerk inherant to a UnitUpgrade will not trigger the promotion-granting system. Use the UnitUpgrades_Promotions table instead if you want a promotion inherant to an upgrade.
Download Here
An example mod and instructions are also included in the folder.
What It Does
The UnitUpgrades_Promotions table attaches a promotion to an affinity-level upgrade. All units which recieve that upgrade will get the promotion.
Code:
<UnitUpgrades_Promotions>
<Row>
<UpgradeType></UpgradeType> <!-- the upgrade you want to grant a promotion -->
<PromotionType></PromotionType> <!-- the promotion you want it to grant -->
</Row>
</UnitUpgrades_Promotions>
The UnitPerks_Promotions table attaches a promotion to one of the selectable perks in an affinity-level upgrade. Units will get the promotion if this perk is picked when recieving the upgrade.
Code:
<UnitPerks_Promotions>
<Row>
<UnitPerkType></UnitPerkType> <!-- the perk you want to grant a promotion -->
<PromotionType></PromotionType> <!-- the promotion you want it to grant -->
</Row>
</UnitPerks_Promotions>
How it Works
Various events trigger a lua script, which checks whether any unit on the map has one of the Perks or Upgrades in these two tables. If it does, the script gives it the corresponding promotion.
A modified version of UnitUpgradePopup.lua makes sure the promotion's Help TXT_KEY is shown in tooltips on the Unit Upgrade screen. (The code to grant the promotions will still work without the modified UnitUpgradePopup.lua, but you won't see the promotion's effects listed in the Unit Upgrade tooltips.)
How To Use It
Simply include the following three files in your mod:
- PGP_Create_New_Tables.xml - flagged as OnModActivated->UpdateDatabase
- PerksGrantPromotions.lua - flagged as InGameUIAddin
- UnitUpgradePopup.lua - flagged as Import Into VFS = true
Limitations
Fixed: Units now gain promotions immediately.
Perks gained as a FreePerk inherant to a UnitUpgrade will not trigger the promotion-granting system. Use the UnitUpgrades_Promotions table instead if you want a promotion inherant to an upgrade.
Download Here
An example mod and instructions are also included in the folder.