Asaf
Sleep Deprived
- Joined
- Mar 22, 2010
- Messages
- 1,326
Unique Civics by Asaf (version 0.1)
Download here
(This mod was originally an idea/request by Cia in this thread)
This mod allows for the addition of Unique Civics (UC's) for any civilization, the same way as they have unique units and unique buildings.
Each civilization can replace one (or more) of the default civics.
This mod component is based on BTS 3.19.
Civic classes were added (same as unit classes and building classes) to help determine which civics replace which.
UI was updated wherever needed (civics screen, civilopedia, tech tree, etc.)
AI was also updated: it will only select allowed civics, and it values different game elements accordingly (techs, buildings, etc.)
A few game concepts were modified to adapt to the new UC concept:
Diplomacy/Trade
Civic classes (instead of civics) are taken into account.
If you replace your civic to match you rival's, you will change to the same civic class, but it might be a different civic.
There is now a 'favorite civic class' for a leader, instead of a 'favorite civic'.
Civic forcing
This is true for both UN decisions and espionage missions which change civics: This now forces a civic class, instead of a civic.
Events
Events are triggered by civic classes instead of civics. Relevant python code was also changed to accomodate that.
I created two sample Unique Civics (not intended for actual game play, only for demonstration):
For the English Empire - British Royalty (replaces Hereditery Rule) - Adds +25% GPP.
For the American Empire - First Amendment (replaces Free Speech) - Adds a free specialist in every city.
Screen shots
Notes for Modders:
All changes in C++ and Python code were marked with a 'Unique Civics' comment.
In the XML files - all changes in the schema files were marked as well, but in the data files I didn't mark them as it could sometimes cause parsing problems.
XML
Added a new file, CIV4CivicClassInfos.xml, which contains all the original civics as civic classes.
Here's a sample XML:
Note a few things:
- The civic option was moved to the civic class
- The civic class has a default civic
- Civic percent anger was also moved to civic class (think of a case where each civ has a different kind of emancipation - you still want the anger to be calculated as if they all have it).
The CIV4CivicInfos.xml file was updated. Here's a sample:
Note that each civic points to its class.
In the Civilization Info there's a new section for UC's:
Note that it must come (if at all) after the UU's section and before the free unit classes.
Other changes:
- Event triggers now have civic class instead of civic.
- Leader head now have favorite civic class.
- Vote infos and vote source infos now have civic class instead of civic.
Take a look at the schema files in the Assets folder for full detail change.
Python
Note that the random events functions now use civic classes instead of civics, in case you add new events.
These are the changes I made in the exposed methods to Python (I added updated Python files from the original BTS files when needed):
CyGame:
- CyGame.getForceCivicCount(CivicTypes eIndex) was replaced by CyGame.getForceCivicClassCount(CivicClassTypes eIndex)
- CyGame.isForceCivic(CivicTypes eIndex) was replaced by CyGame.isForceCivicClass(CivicClassTypes eIndex)
CyGlobalContext:
- Added CyGlobalContext.getNumCivicClassInfos()
- Added CyGlobalContext.getCivicClassInfo(CivicClassTypes eIndex)
CvCivicClassInfo (new class):
- int CvCivicClassInfo.getCivicOptionType()
- int CvCivicClassInfo.getDefaultCivicIndex()
- void CvCivicClassInfo.setDefaultCivicIndex(int i)
- int CvCivicClassInfo.getCivicPercentAnger()
CvCivicInfo:
- Added CvCivicInfo.getCivicClassType()
- Note that CvCivicInfo.getCivicPercentAnger() still exists, but its value is taken from the class info on startup.
CvCivilizationInfo:
- Added int CvCivilizationInfo.getCivilizationCivics(int i)
CvLeaderHeadInfo:
- CvLeaderHeadInfo.getFavoriteCivic() was replaced by CvLeaderHeadInfo.getFavoriteCivicClass()
CvVoteInfo:
- CvVoteInfo.isForceCivic(CivicTypes eIndex) was replaced by CvVoteInfo.isForceCivicClass(CivicClassTypes eIndex)
CvEventTriggerInfo:
- CvEventTriggerInfo.getCivic() was replaced by CvEventTriggerInfo.getCivicClass()
CvVoteSourceInfo:
- CvVoteSourceInfo.getCivic() was replaced by CvVoteSourceInfo.getCivicClass()
CyPlayer:
- Added CyPlayer.isSameCivicClassSelected(CivicTypes eCivic) - returns True if the given civic has the same class as one of the current civics
- Added CyPlayer.getCivicClassPercentAnger(CivicClassTypes eCivic) - returns percent anger for given civic class
- Added CyPlayer.getCivilizationCivicForClass(CivicClassTypes eCivic) - returns the civic type used by this player's civilization for this civic (usually will be the default civic, unless there's a UC)
- Added CyPlayer.isCivilizationCivic(CivicTypes eCivic) - returns True if the given civic is the one used by this player's civilization (not necessarily the current civic).
Download here
(This mod was originally an idea/request by Cia in this thread)
This mod allows for the addition of Unique Civics (UC's) for any civilization, the same way as they have unique units and unique buildings.
Each civilization can replace one (or more) of the default civics.
This mod component is based on BTS 3.19.
Civic classes were added (same as unit classes and building classes) to help determine which civics replace which.
UI was updated wherever needed (civics screen, civilopedia, tech tree, etc.)
AI was also updated: it will only select allowed civics, and it values different game elements accordingly (techs, buildings, etc.)
A few game concepts were modified to adapt to the new UC concept:
Diplomacy/Trade
Civic classes (instead of civics) are taken into account.
If you replace your civic to match you rival's, you will change to the same civic class, but it might be a different civic.
There is now a 'favorite civic class' for a leader, instead of a 'favorite civic'.
Civic forcing
This is true for both UN decisions and espionage missions which change civics: This now forces a civic class, instead of a civic.
Events
Events are triggered by civic classes instead of civics. Relevant python code was also changed to accomodate that.
I created two sample Unique Civics (not intended for actual game play, only for demonstration):
For the English Empire - British Royalty (replaces Hereditery Rule) - Adds +25% GPP.
For the American Empire - First Amendment (replaces Free Speech) - Adds a free specialist in every city.
Screen shots
Spoiler :




Notes for Modders:
All changes in C++ and Python code were marked with a 'Unique Civics' comment.
In the XML files - all changes in the schema files were marked as well, but in the data files I didn't mark them as it could sometimes cause parsing problems.
XML
Spoiler :
Added a new file, CIV4CivicClassInfos.xml, which contains all the original civics as civic classes.
Here's a sample XML:
Code:
<CivicClassInfo>
<Type>CIVICCLASS_FREE_MARKET</Type>
<Description>TXT_KEY_CIVIC_FREE_MARKET</Description>
<CivicOptionType>CIVICOPTION_ECONOMY</CivicOptionType>
<DefaultCivic>CIVIC_FREE_MARKET</DefaultCivic>
<iCivicPercentAnger>0</iCivicPercentAnger>
</CivicClassInfo>
Note a few things:
- The civic option was moved to the civic class
- The civic class has a default civic
- Civic percent anger was also moved to civic class (think of a case where each civ has a different kind of emancipation - you still want the anger to be calculated as if they all have it).
The CIV4CivicInfos.xml file was updated. Here's a sample:
Code:
<CivicInfo>
<CivicClass>CIVICCLASS_FREE_SPEECH</CivicClass>
<Type>CIVIC_FIRST_AMENDMENT</Type>
...
In the Civilization Info there's a new section for UC's:
Code:
<Civics>
<Civic>
<CivicClassType>CIVICCLASS_FREE_SPEECH</CivicClassType>
<CivicType>CIVIC_FIRST_AMENDMENT</CivicType>
</Civic>
</Civics>
Other changes:
- Event triggers now have civic class instead of civic.
- Leader head now have favorite civic class.
- Vote infos and vote source infos now have civic class instead of civic.
Take a look at the schema files in the Assets folder for full detail change.
Python
Spoiler :
Note that the random events functions now use civic classes instead of civics, in case you add new events.
These are the changes I made in the exposed methods to Python (I added updated Python files from the original BTS files when needed):
CyGame:
- CyGame.getForceCivicCount(CivicTypes eIndex) was replaced by CyGame.getForceCivicClassCount(CivicClassTypes eIndex)
- CyGame.isForceCivic(CivicTypes eIndex) was replaced by CyGame.isForceCivicClass(CivicClassTypes eIndex)
CyGlobalContext:
- Added CyGlobalContext.getNumCivicClassInfos()
- Added CyGlobalContext.getCivicClassInfo(CivicClassTypes eIndex)
CvCivicClassInfo (new class):
- int CvCivicClassInfo.getCivicOptionType()
- int CvCivicClassInfo.getDefaultCivicIndex()
- void CvCivicClassInfo.setDefaultCivicIndex(int i)
- int CvCivicClassInfo.getCivicPercentAnger()
CvCivicInfo:
- Added CvCivicInfo.getCivicClassType()
- Note that CvCivicInfo.getCivicPercentAnger() still exists, but its value is taken from the class info on startup.
CvCivilizationInfo:
- Added int CvCivilizationInfo.getCivilizationCivics(int i)
CvLeaderHeadInfo:
- CvLeaderHeadInfo.getFavoriteCivic() was replaced by CvLeaderHeadInfo.getFavoriteCivicClass()
CvVoteInfo:
- CvVoteInfo.isForceCivic(CivicTypes eIndex) was replaced by CvVoteInfo.isForceCivicClass(CivicClassTypes eIndex)
CvEventTriggerInfo:
- CvEventTriggerInfo.getCivic() was replaced by CvEventTriggerInfo.getCivicClass()
CvVoteSourceInfo:
- CvVoteSourceInfo.getCivic() was replaced by CvVoteSourceInfo.getCivicClass()
CyPlayer:
- Added CyPlayer.isSameCivicClassSelected(CivicTypes eCivic) - returns True if the given civic has the same class as one of the current civics
- Added CyPlayer.getCivicClassPercentAnger(CivicClassTypes eCivic) - returns percent anger for given civic class
- Added CyPlayer.getCivilizationCivicForClass(CivicClassTypes eCivic) - returns the civic type used by this player's civilization for this civic (usually will be the default civic, unless there's a UC)
- Added CyPlayer.isCivilizationCivic(CivicTypes eCivic) - returns True if the given civic is the one used by this player's civilization (not necessarily the current civic).