Promotions that require a civic

Chiyu

Prince
Joined
Jun 9, 2006
Messages
412
Location
Limburg, The Netherlands
Hey all,

I have a problem. I want to make all my (compatible) units in my mod automatically get a certain promotion when switching to a civic. But, also, they have to lose that promotion once they switch back to another civic. If I could get this to work (without modifying the SDK!), it would open up a lot of possibilities for some new promotions in my mod :). I don't know much about python, but if someone could help me in the right direction I could probably manage to implement this.

I've tried searching for this issue on the forums, but had no luck.

Please help me!

-Chiyu
 
I currently don't have time to actually write the code. but here are some ideas to get you started.

You could place your code in onBeginPlayerTurn in CvEventManager. That would be easy but then the effects of the civic wouldn't happen until the next turn. The other option would be to place your code in the handleInput function for the Civics screen in CvCivicsScreen.py

The API functions that would be most helpful are:

player.getCivics(CivicOptionTypes.CIVICOPTION_GOVERNMENT) - can be used to see the players current civic for a given civic type - see the links below for more info.

unit.setHasPromotion(PromotionTypes.PROMOTION_COMBAT1, True) - can be used to set or unset a promotion. True enables the promotion and False disables it.

I took the above information from the API documentation, which is mostly right, but not 100% correct. I didn't test it so there is a chance that some of it may be wrong. If thats the case, hopefully someone who has actually used the code will post a correction.

Here's some links to the API documentation.

http://www.sthurlow.com/cvDocs/cvDoc/CyUnit.htm

http://civilization4.net/files/modding/PythonAPI/
 
Thanks for the suggestions General Tso, but I don't think I have the knowledge or skills required to build some code 'from scratch'. I looked into the CvEventManager, but I couldn't figure it out. And learning Python properly would be too time-consuming :(.

Everything I did with python was the work of copy, paste and edit. So if I would have a snippet of code (from another mod or mod component) that looks a bit like what I want to do, I could probably change it to make it work :). Any ideas?
 
Unfortunately, I don't have any other ideas. I'm busing trying to get my mod into beta mode at the moment. Maybe I can help you with it sometime in the future. The code required to do this shouldn't be to complicated, but it would still take some time to create.
 
I don't know if it has any promotions that require a civic, but I'm pretty sure that Fall From Heaven 2 has some promotions that change based on your religion. You could check out the code for that and edit it pretty quickly if it's what you're looking for.
 
Top Bottom