Temporary Promotions?

EviltheMonkey

One Primate Think Tank
Joined
Dec 7, 2006
Messages
85
Is it possible to give a promotion to a unit for a limited time, either for a given number of turns or as the result of a civ wide change of non-fixed duration (such as a civic choice)?

Would this be very difficult to mod or has someone already done it?
 
I recall trying to do this back when civ4 first came out. I wanted a Blitzkrieg civic that would give the March promotion to all Armoured units so long as the civic was in effect. It was very hard to do and I couldn't pull it off.

EDIT: here's the thread
 
FfH has an expiration chance on promotions. So you could, for example, set a 10% chance that a promotion will wear off each turn. From a code perspective its an easier implementation than setting a fixed amount of turns.
 
If you wanted a fixed number of turns you could set up an array for each unit which is parallel to the hasPromotion array. Store in each slot the Turn Number for when the Promotion is acquired (or lost, might be useful later), and then setup a new XML field for Limited Duration. In the onTurn function you can check through the PromotionChanged array for any promotion which is too old (according to the Promotions LimitedDuration field) and remove it (or if you want a promotion which fades in and out, toggle the state. Probably set a XML field to enable that as an option as well).


If you are willing to have just a percent chance though, that is far easier, and not just because the code is already written in FfH and easily borrowed :)
 
Back
Top Bottom