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

Adding a new building

Discussion in 'Civ4 - Modding Tutorials & Reference' started by Chamaedrys, Oct 8, 2006.

  1. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    Ok, here is a simple guide for adding new buildings.

    1. Make sure that that the model (.nif files) and texture (.dds or .tga files) are in the same folder
    2. put that folder in assets/art/structures/buildings/

    Now it's time for some xml work :cry:

    *THE BEST WAY OF CREATING XML ENTRIES IS COPY 'N' PASTE*

    3. Open the file assets/xml/art/civ4artdefinesbuildings.xml and create an entry for your new building.
    The fscale determins the size of the building in game and the finterfacesclae the size in the pedia.

    4. Open the folder assets/xml/buildings. Here are 3 files that must be changed:

    5. If your new building is NOT a unique building, it needs a buildingsclass. Create an entry for that in the file civ4buildingclassinfos.xml.

    6. Create an entry for it in the civ4buildinginfos.xml.

    7. The file Civ4CityLSystem is a very important and very difficult file. This file controlls if a building uses different models through the ages or not and on what sort of "leaf" it is placed in a city. I sugguest to copy and paste the entry of a building with a similar ground.
     
  2. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,660
    Gender:
    Male
    Location:
    MN
    If your making this pls have examples included, thx, and # 4 ends in a ":" ??
    # 3, what entry??
    5. How do you know?? what entry??
    6.What entry??
    7. Huh?
     
  3. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    There are entries for the vanilla buildings. Copy and paste one and change it so that it fit to your building.;)
     
  4. Splinter13

    Splinter13 The Learner

    Joined:
    Aug 7, 2006
    Messages:
    204
    Location:
    Canada
    Sometimes when you create a building it doesn't show up in your city when it's been built.

    I've heard you have to change Civ4PlotLSystem.xml in the buildings folder. What types of edits should you be making? Also I may have the wrong file it could be Civ4CityLSystem.xml too (I forgot the name of the file you had to edit).

    So I'm just wondering if your building doesn't show up, what should you be editing in this file. This file is a little wacky compaired to the other types of xml files. Okie! thanks
     
  5. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,660
    Gender:
    Male
    Location:
    MN
    I copy'd and pasted and still lots of error's??
     
  6. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    @ Splinter13: the civ4cityLsystem is indeed a bit tricky. But it must be changed for adding new buildings. When you scroll down a bit you will see this:

    <LNode Name="Leaf_1x1">

    this the start of the list of all buildings which are managed by this leaf. There several leaf in this file. Such list starts with the normal houses (or city art styles) like:

    <ArtRef Name="generic:an_eu.nif::1x1_01">
    <Attribute Class="Era">ERA_ANCIENT,ERA_CLASSICAL</Attribute>
    <Attribute Class="ArtStyle">ARTSTYLE_EUROPEAN,ARTSTYLE_SOUTH_AMERICA,ARTSTYLE_MIDDLE_EAST,ARTSTYLE_BARBARIAN</Attribute>
    <Attribute Class="Scalar">iBatchGroup:0</Attribute>
    </ArtRef>

    after these entries, the entries of the city improvements begin. For example the obelisk:

    <ArtRef Name="building:BUILDING_OBELISK">
    <Scale>1.25</Scale>
    </ArtRef>

    YOu know that the Obelisk stands on a very small square. If the baseplate of your building has a similar shape than you can copy n paste that entry. I usually paste it directly after the original. For exampel:

    <ArtRef Name="building:BUILDING_OBELISK">
    <Scale>1.25</Scale>
    </ArtRef>
    <ArtRef Name="building:BUILDING_YOURBUILDING">
    <Scale>1.25</Scale>
    </ArtRef>

    If your building has a long baseplate that pick the entry of a building with a long baseplate, for example the academy. You will find the academy in the next leaf.
     
  7. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    You know that buildings like the lighthouse (the water buildings are at the middle of the file. They are the last city improvements in the file) change their look when you discover a certain tech. There are two entries for that building:

    <ArtRef Name="building:BUILDING_LIGHTHOUSE">
    <Attribute Class="Era">ERA_ANCIENT,ERA_CLASSICAL,ERA_MEDIEVAL,ERA_RENAISSANCE</Attribute>
    <Attribute Class="Scalar">bNoWaterTest:1</Attribute>
    <!-- this bypasses water testing -->
    <Attribute Class="Scalar">szSpecialLayout:Water</Attribute>
    <Scale>1.5</Scale>
    </ArtRef>
    <ArtRef Name="building:BUILDING_LIGHTHOUSE">
    <Attribute Class="Scalar">szNIF:Art/Structures/Buildings/Lighthouse/LighthouseModern.nif</Attribute>
    <Attribute Class="Era">ERA_INDUSTRIAL,ERA_MODERN,ERA_FUTURE</Attribute>
    <Attribute Class="Scalar">bNoWaterTest:1</Attribute>
    <!-- this bypasses water testing -->
    <Attribute Class="Scalar">szSpecialLayout:Water</Attribute>
    <Scale>1.5</Scale>
    </ArtRef>

    The first entry is for the ancient lighthouse and the second one is for the modern lighthouse. The tag <Attribute Class="Era"> determins in which eras this art is used.
    See that "<Attribute Class="Scalar">szNIF: ..." in the second entry? This is the path to the art of the modern lighthouse.

    It the same trick for all buildings that change their style: the first entry is for the early ages and uses the path in the artdefbuilding.xml file, and the second entry is for the late game and has the path in it's <Attribute Class="Scalar">szNIF-tag.;)

    btw: If you have build a building and it doesn't appear in the city, the city is maybe just to small. There is a limit how many buildings are shown of a certain city size.:crazyeye:

    @strategyonly: I'm sorry that my first explanation was too short. What errors do you get? If you get hundreds of xml errors there is often a little think messed up in your xml.
     
  8. Tigerclaw

    Tigerclaw Chieftain

    Joined:
    Sep 9, 2003
    Messages:
    81
    Do buildings HAVE to have graphics? New graphics are all well and good, but as your tutorial acknowledges, adding them in is the hardest bit! Now, I want to add a few buildings in to the game, fairly simple ones like Police Stations, whose effects would be relatively conventional, like -25% WW, or something. I'm sure I could work out how to create entries for them in XML, so that shouldn't be a problem. The thing is though, I am not fussed about whether or not they have graphics that show up on the map. I just want them to function. My question is, do buildings HAVE to have a graphic that appears in the city on the main map, and a graphic for the Civpedia entry, or is it possible to do without them?
     
  9. Splinter13

    Splinter13 The Learner

    Joined:
    Aug 7, 2006
    Messages:
    204
    Location:
    Canada
    @Chamaedrys : Thanks for that great explaination. It is well needed :)

    Good Work :)
    Splinter13
     
  10. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    I think they will function without graphic, too
     
  11. esnaz

    esnaz King

    Joined:
    May 7, 2006
    Messages:
    708
    Location:
    USA
    When I create the building for my civ, I click on it to create it, and the game crashes!!! A lot of people say that I have to make sure that my building's art is defined in Civ4ArtDefines_Building.xml file, which it is!!! I copied and pasted the ART_DEF_BUILDING_YOURBUILDING onto the Civ4ArtDefines_Building.xml, and it still doesn't work!!!

    HELP!!!:confused:
     
  12. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    @esnaz: could you please post your changes? So that I can take a look at it.
     
  13. esnaz

    esnaz King

    Joined:
    May 7, 2006
    Messages:
    708
    Location:
    USA
    :confused: changes (?)

    well...i dont know what you mean :blush: but here's my dxdiag info

    i am on warlords...not vanilla

    I've been having the same problem with my unit...but here's the interesting part:
    If I hav a warrior and want to upgrade it to my unit and it works...BUT...
    but if I want to create it from scratch from my city, the game crashes

    I hope this will give more info!!!
     

    Attached Files:

  14. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    I ment what have you wrote in your xml files? I wanted to see that what you have changed in the xml files. Did you receive any xml errors?
     
  15. Civkid1991

    Civkid1991 in shade of poison trees

    Joined:
    Feb 20, 2006
    Messages:
    871
    nice tutorial Chamaedrys :goodjob:

    BTW,
    :(
     
  16. esnaz

    esnaz King

    Joined:
    May 7, 2006
    Messages:
    708
    Location:
    USA
    no.
    ..here are some of the files:
     

    Attached Files:

  17. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    OK, in the artdefbuildings I've found two things:

    The <NIF> tags are looking a bit strange, maybe that's the mistake:

    <BuildingArtInfo>
    <Type>ART_DEF_BUILDING_KHMER_WAT</Type>
    <bAnimated>0</bAnimated>
    <fScale>1.0</fScale>
    <fInterfaceScale>0.7</fInterfaceScale>
    <NIF>Art/Interface/Buildings/Wat/Wat.nif</NIF>
    <KFM/>
    <Button>,Art/Interface/Buildings/Wat/Wat.dds</Button>
    </BuildingArtInfo>

    That looks good. But are you sure you that you have used the interface folder? Thats is no problem if the folder structure is correct.


    <NIF>Canaan/Assets/Art/Interface/Buildings/walls.nif</NIF>
    <KFM/>
    <Button>,Canaan/Assets/Art/Interface/Buildings/kotelbutton.dds</Button>

    The building nifs are normally in the structures/buildings folder and have a folder themselves. And its not nessisary (and might be the problem) to write the mod name and assets in the path. I would use:

    <NIF>Art/Structures/Buildings/walls/walls.nif</NIF>
    <KFM/>
    <ButtonArt/Interface/Buildings/kotelbutton.dds</Button>

    please check that the nif (and their dds) are in the right folders

    Now I will look in the other files.

    EDIT: Now I have checked the other files. They seemed to be allright, but I didn't found anything about Canaan or the kotel there. If your not using the kotel you haven't to correct the tag :lol:

    The cityLsystem wasn't in your post. Have you edit it?
     
  18. esnaz

    esnaz King

    Joined:
    May 7, 2006
    Messages:
    708
    Location:
    USA
    no, i havent't edited cityLsystem.... could that be the problem...

    the Cannaan stuff is an unfinished mod, that has notn to do with the problem

    Its the Wat that's the problem, and my folder structure does go Art/Interface/Buildings/Wat/...

    I've been having the same problem with my unit...but here's the interesting part:
    If I hav a warrior and want to upgrade it to my unit and it works...BUT...
    but if I want to create it from scratch from my city, the game crashes

    I'm not sure if you've seen that, but I think it might be helpful
     
  19. Chamaedrys

    Chamaedrys Emperor

    Joined:
    Mar 14, 2006
    Messages:
    1,267
    Location:
    Germany
    Well, a building without an entry in the cityLsystem will not appear in the game. Make an entry in the cityLsystem and check if it helps.

    An easily made mistake with the folder structure is this: you have downloaded a file from someóne and unzip or unrar it. When the file allready includes a folder and you unzip to a folder you can have two folder instead of one like wat/wat/wat.nif instead of wat/wat.nif.

    The problem with your unit sounds really weird. Does the art of your new unit is shown when upgrade to it?
    I think game crashes can happen if the kfm path is not right. If it's just a nif problem the game should not crash.
     
  20. esnaz

    esnaz King

    Joined:
    May 7, 2006
    Messages:
    708
    Location:
    USA
    well...the graphics on the unit DOES show up, and I think it moves with the animation of the spearman, which I copied into my Phak'ak's (custom unit) folder

    I entered it in CityLSystem under the Library in which my building is replaces and uses the same NIF for it (i reskinned the NIF however...) and it still didn't work :badcomp:

    P.S.: thanks for all the help you've been offering!

    see next page
     

Share This Page