=============================== = Ethnic Buildings by Asaf (version 0.1) = =============================== Download here This Mod component enables a modder to have different art for the same building for different civilizations, the same way units art works in BTS. Building art info defined that way is displayed at the following places: - On the map view - as a 3D model in the city (3D model) - Inside the city screen, as a building production order button (button image) - Inside the city screen, when the is building currently in queue (3D model) - On the map in the city bar, when the building is currently being built (button image) - On the popup where the player can select the next city production (button image) - On the minimized production popup (if used) (button image) This art is not used in the civilopedia (since it is not connected to a specific player). Other places which are not in Vanilla BTS (such as in BUG) are not defined here, but can be easily modded. All the changes I made (C++, Python and XML files) are marked with an 'Ethnic Buildings' comment. Modders how-to: XML Spoiler : A new type info was added: BuildingArtStyleTypeInfo. This type info connects civilizations to the BuildingArtInfo's relevant for them. In Civ4CivilizationInfos, a new tag was added under CivilizationInfo: <BuildingArtStyleType>. Its value must be defined in the new file Civ4BuildingArtStyleTypeInfos.xml. This tag may not appear, and in that case the art used by the building is the same as was used before (ArtDefineTag in BuildingInfo). If it does appear, it should appear after <UnitArtStyleType>. For example: Civ4CivilizationInfos.xml: PHP: <CivilizationInfo> <Type>CIVILIZATION_AMERICA</Type> ... <UnitArtStyleType>UNIT_ARTSTYLE_EUROPEAN</UnitArtStyleType> <BuildingArtStyleType>BUILDING_ARTSTYLE_AMERICA</BuildingArtStyleType> <bPlayable>1</bPlayable> ... Civ4BuildingArtStyleTypeInfos.xml: PHP: <Civ4BuildingArtStyleTypeInfos xmlns="x-schema:CIV4CivilizationsSchema.xml"> <BuildingArtStyleTypeInfos> <BuildingArtStyleTypeInfo> <Type>BUILDING_ARTSTYLE_AMERICA</Type> <StyleBuildings> <StyleBuilding> <BuildingType>BUILDING_BARRACKS</BuildingType> <BuildingMeshGroup> <EarlyArtDefineTag>ART_DEF_BUILDING_BARRACKS_AMERICAN</EarlyArtDefineTag> <LateArtDefineTag>ART_DEF_BUILDING_BARRACKS_AMERICAN</LateArtDefineTag> <MiddleArtDefineTag>ART_DEF_BUILDING_BARRACKS_AMERICAN_MODERN</MiddleArtDefineTag> </BuildingMeshGroup> </StyleBuilding> </StyleBuildings> </BuildingArtStyleTypeInfo> ... Note that there can only be one mesh group (unlike unit art styles), and here too you can have different art for different eras (same as with units). Of course, some or all eras may have the same art, but if you define a StyleBuilding, you must define a single BuildingMeshGroup in it with all 3 possible eras defined. In this example, ART_DEF_BUILDING_BARRACKS_AMERICAN and ART_DEF_BUILDING_BARRACKS_AMERICAN_MODERN should be defined in CIV4ArtDefines_Building.xml, each as a BuildingArtInfo of its own. Appropriate changes were made to the civilization scheme (make sure you merge it to your Mod). Python Spoiler : In order for the correct 3D model to be displayed in the city screen, I used a minor 'hack': The drawing of this model is done by calling addBuildingGraphicGFC(), which in turn calls the DLL function CvGame::getBuildingArtInfo(). Since in CvGame::getBuildingArtInfo() the player information does not exist, then before calling addBuildingGraphicGFC() the Python code calls the new function CyGame().setBuildingModelCity() and passes the city ID and the owner ID. This enables the DLL to return the correct art for the player. When merging the Python code to your Mod (or with BUG or any other Mod) make sure to leave these lines (see updatePlotListButtons() in CvMainInterface.py). New exported functions to python: void CyGame.setBuildingModelCity(int iCityId, int /*PlayerTypes*/ eOwner) - Described above. int CvCivilizationInfo.getUnitArtStyleType() - For some reason was not defined. int CvCivilizationInfo.getBuildingArtStyleType() - Returns the ID of the building art style type defined for this civilization (-1 for NONE) string CyPlayer.getBuildingButton(int eBuilding) - Returns the building button for this player. Credits: ======== DannyDaemonic - the fast Makefile (1.0). Downloaded from: http://forums.civfanatics.com/showthread.php?t=370861 j_mie6 - For the idea (requested this Mod) EDIT: You are more than welcome to use this mod component in your own mods, but if you do - please let me know.