1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[Tutorial] How to Add new Buildings to the City Management Screen

Discussion in 'Civ4Col - Creation & Customization' started by Kailric, May 30, 2009.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Some of you may seen me crying about how to add a new building to the city screen. Well I got off me arce and figured it out myself. And its pretty simple.

    It requires XML editing and Python and maybe some SDK depending on how far you want to go with this. For this sadly small tutorial I'll just be focusing on what needs changed in Python so if you are not sure how to make the changes in XML there are lots of tutorials on that here on the forums.

    Read Only Attribute : Make sure you remove this tag on your files you will be editing after you moved them to your moding folder as you want be able to save them if not.


    XML:

    First Edit the CIV4SpecialBuildingsinfos.XML to add in your new "special" building. This is what connects your building to Python.

    Then Edit the CIV4BuildingInfos.XML and the CIV4ArtDefines_Building.XML to add your new building, this is where you set up all the actually attributes, art, buttons, and such to your building.

    Optional:
    K, now if your building will have yields Fortuente wrote an excently tutorial on that here: http://forums.civfanatics.com/showthread.php?t=319070. You will need to get into the SDK for this part but if your building doesn't do yields then you can skip this.

    Then to connect your new building to the yields you must add in a new Profession that will use the Yield in the CIV4ProfessionInfos.XML. And if your yield will be transported you must create a new Unit in the CIV4UnitInfos.XML. Of course you will have to edit the SDK and other XMLs in order to get your new Yield to actually do any thing :)


    Python:

    Open the CvMainInterface.py (I believe any text editor will do?) and find the code that is labled as below:

    Code:
    # CITY BUILDINGS GRID MAP
    BUILDING_DATA = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", ""[COLOR="Red"], ""[/COLOR]]
    
    BUILDING_DATA[0] = [40, 33, 33, 18] #Bells
    BUILDING_DATA[1] = [60, 42, 33, 18] #Hammers
    BUILDING_DATA[2] = [40, 66, 33, 18] #Coats
    BUILDING_DATA[3] = [0, 33, 33, 18] #Cloth
    BUILDING_DATA[4] = [80, 0, 33, 18] #Rum
    BUILDING_DATA[5] = [20, 42, 33, 18] #Cigars
    BUILDING_DATA[6] = [60, 8, 33, 18] #Tools
    BUILDING_DATA[7] = [40, 0, 33, 18] #Crosses
    BUILDING_DATA[8] = [0, 66, 33, 18] #Muskets
    BUILDING_DATA[9] = [0, 0, 33, 18] #Horses
    BUILDING_DATA[10] = [80, 65, 33, 18] #Dock
    BUILDING_DATA[11] = [60, 74, 33, 18] #WareHouse
    BUILDING_DATA[12] = [20, 8, 33, 18] #Education
    BUILDING_DATA[13] = [80, 78, 33, 18] #Wall
    BUILDING_DATA[14] = [20, 74, 33, 18] #Print
    [COLOR="Red"][B]BUILDING_DATA[15] = [80, 33, 33, 18] #Booty[/B][/COLOR]
    
    BUILDING_GRID = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", ""[COLOR="Red"], ""[/COLOR]]
    First add an Extra double quotes and comma to the BUILDING_GRID and BUILDING_DATA lines of code, so that there are 16 pairs of quotes in each. I marked my changes in red.

    In the above code I have already added a new Special Buidling called #Booty.
    The City Building Screen is made up of location points numbered 0 to 80 going down and across. In the example [80, 33, 33, 18] #Booty: 80 is how far across to place the building on the screen and 33 would be how far down. The last two numbers 33, 18 I believe are the size of the building but I haven't messed with that yet.

    Now before you make changes start up your modded game of CIV4Colonization in Windowed Mode and head to the City Management Screen. Have your Python code open at the same time and when you save changes to python your Game will refresh itself and you can see the changes you made. This is a fast way to move the buildings around so that all can fit and look good!

    You can see in the screen shot I have moved the Ship Yard way down and moved the Walls slightly down as well in order to make room for my new Building the Buccaneer's Den!



    BuccaneerDen.jpg

    Thats it. Repeat for each building you want to add. If I figure out more things with this or if you have any suggestions or comments please feel free!

    Note: I used "Gimp" in order to create the Buccaneer's Den art you see above. I just cut and pasted other parts of buildings. You can be quite creative with this and come up with lots of cool buildings of your own! If you do please post them so others can see!
     
    Schmiddie likes this.
  2. kaibayashi

    kaibayashi Chieftain

    Joined:
    Aug 8, 2008
    Messages:
    264
    nice. we could do with a tutorials section.... if there isnt already??
     
  3. Aymerick

    Aymerick Chieftain

    Joined:
    Dec 26, 2008
    Messages:
    233
    Location:
    Ville de Québec
    So Kailric, how did you get around the "interface not showing" problem when adding SpecialBuildings?
     

Share This Page