Temporarily Disabling Promotions

Déja

Beyond the Mod
Joined
Dec 19, 2005
Messages
353
Is there any way to temporarily disable the benefits from a particular promotion (for instance, to disable blitz for a couple turns and then re-enable it on a particular unit)?
 
Yes. You could make a python script to disable the promotion on the specific event you want to disable it on, and leave a marker in the script data for the unit with the turn it was disabled. Then at the start of every turn you make a check against this script data for every unit, and enable the promotion again if it passes.
 
Great! Do you have any idea which object/property can be used to disable it?
 
To disable the promotion? I'm not quite sure what you are asking. Are you asking how to disable a promotion, or are you asking how to trigger disabling a promotion?
 
Basically, I'm adding a promotion that requires a certain building for a unit to be able to make use of. If the civilization loses that building, then they also lose the bonuses from that building until they take it back.
 
Déja said:
Basically, I'm adding a promotion that requires a certain building for a unit to be able to make use of. If the civilization loses that building, then they also lose the bonuses from that building until they take it back.

The easy (but cpu intensive) way to do this is to perform a check at the end of each players turn. If they have the building then apply the promotion to all of their units.. If they don't have the building, remove the promotion from all of their units.

That would only take a few minutes to code but would be horrible ugly to play (aka: KaelCode).

The better way to do it is going to involve a cut into a lot of event triggers including the build of the building, taking of a city and creation of a new unit. Done well you create a seperate function that does the hard work and you just make a check for the building and a call for the function if it is needed.
 
Yes, I've already figured that bit out... the only thing I'm missing is the actual python call to enable or disable the promotion itself.
 
Déja said:
Yes, I've already figured that bit out... the only thing I'm missing is the actual python call to enable or disable the promotion itself.
Aaah, ok. The API is your friend!

CyUnit.setHasPromotion(PromotionType eIndex, BOOL bNewValue)
 
Aha! That's exactly what I was looking for. Thanks :)
 
Back
Top Bottom