Sid Meier's Civilization: Beyond Earth

Sid Meier's Civilization: Beyond Earth

Enhanced Promotions
Bosparan  [developer] 2 Nov, 2014 @ 1:53am
[Modding] Infos for modders
Hi,

this is my post where I'll try to keep all information fellow modders might care about. If you'd like to have some info on the hows of my mod, just throw me a question here.

Having Promotions remove Promotions
One of the challenges I faced were that some promotions units already had were not easily overwritten (e.g.: A carrier's inability to attack is a promotion. Adding another promotion that allowed the carrier to attack failed). So I wracked my brain on the matter and finally found a solution:
- Create a new table, that lists Promotions and what other promotion they remove
- Process each unit each turn whether they meet the criteria and then remove the offending Promotion.

This allows simply configuring this behavior in XML, like any other promotion property. For an example see ...
...\Unit Promotions\Carrier\Blitz Carrier.xml
If you want to create your own mod that uses this ability, you can either take that part out of my mod (so long as you give credit for it, I'm perfectly fine with that), or you can use my own system. Using my own would make coexistence of mods easier but of course create a dependency. Your choice.

The Unit Iterator
One thing my mod uses is an function that does the following:
- Each player turn, it retrieves all unit that player has
- Then it calls a LuaEvent called UnitIterator, passing both unit and player as parameters.

This means, you can create a function that accepts these two parameters and register it to the event, and it will reliably be called each turn for each player. Like this:
LuaEvents.UnitIterator.Add( PromotionRemover );

Doing so will reduce overhead a little but, again, create a dependency.

Alien Auquatic monsters
This mod changes their unitclass (UNITCLASS_ALIEN_KRAKEN, UNITCLASS_ALIEN_SEA_DRAGON). Not only is the Kraken a fairly poor Aircraft Carrier, it also allowed me to implement the Captain Ahab promotion. The table for UnitClass based effects on promotion still works, in opposite to quite a few others.

Thus this mod may conflict with other mods affecting Alien Sea Monsters.

Cheers,
Bosparan
Last edited by Bosparan; 2 Nov, 2014 @ 3:04am