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] Modular XML Modding With C2C

Discussion in 'C2C mod mods' started by Hydromancerx, Oct 24, 2011.

  1. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Looking good Steampunk. Now all that's left is the most important file ... Steampunk_CIV4BuildingInfos.xml!!

    Please read over the stuff carefully since there are lots of fields some in the examples and other made new. These files can look very different from each other. Some just have the minimum info with other have lots of fields even if its 0 or NONE. I personally like the middle route where i have the basics but not any new stuff unless its called for.

    I recommend taking a look in the Hydro folder and look at my different building mods. It should give you an idea on what code makes what result.

    Let me know if you have any questions.
     
  2. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    I could have sworn there was a building that gave additional % science with power. I thought it was accelerator but that wasn't it. Does anyone know what building that might be? Or better yet, does anyone know how to add ###% science in the presence of power?
     
  3. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,062
    Location:
    America
    Looking at the Modiki and Afforess' AND documentation I think such an XML tag does not exist. However, Koshling or AIAndy could make such a tag if it's that important.
     
  4. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Well I know you can add production percent (like from factories) and food percent (food processing plant) I guess I assumed there was something for all potential yields.
     
  5. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Also any idea what a good base number for iAdvancedStartCost should be? Palace is at -1, most stuff is at 100 which makes me think it might be a percent and -1 would be you can't build it using the advanced start mode.
     
  6. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Science isn't a yield. Its a commerce type.
     
  7. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Ok, but I don't think that helps me. How would one get additional science % from the presence of electricity?
     
  8. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Well you could make the building require electricity and then give it normal +:science:%. The down side would be it could not be built without electricity. Here is the tag if you need it.

    <bPrereqPower>1</bPrereqPower>
     
  9. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    That won't work... I guess I'll have to make another building that does that requiring you having already built a municipal computer in the city. An Electromechanical Municipal Computer Addendum. No that's a dumb name. What's a short sweet name for an addition to a building for expanded use. Annex. My next project I guess.

    So you can specify that a building requires x AND y techs using techtypes. But there is no way to set up an OR for buildings?

    Edit: one last thing. Cavemen2Cosmos/Assets/XML/Technologies is the only place I should be looking for technology tags, amirite? There isn't another CIV4TechInfos.xml squirreled away somewhere?
     
  10. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Oh well, I guess you guys are busy. In any case I think I've got a template whereby if someone follows the notes and fills in the blanks they'll get a building that does zip. Is there anything I missed?

    Oh and my other questions still stand.

    Edit 10/31/11: removed attachment
     
  11. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Sorry I was busy, Halloween weekend ya know. Anywho ...

    <BuildingClassNeededs> = Requires Building X AND Building Y

    <PrereqOrBuildingClasses> = Requires Building X OR Building Y

    <PrereqBuildingClasses/> = Requires 1 or More Building X (cane be used like <BuildingClassNeededs>)

    <ReplaceBuildings> = Building X replaces your building.

    <PrereqNotBuildingClasses> = Cannot be built in the same city as Building X.

    Hope this helps.

    In general its risky to use completely blank ones. I usually use nearly empty ones or similar ones. For instance You will need an <Advisor> and the <iMinLatitude>0</iMinLatitude and <iMaxLatitude>90</iMaxLatitude> are almost always 0 and 90.

    Just take a look at some in my mods and you can see how I did them. Especially mods like Crops, Seafood and Minerals were they are very similar to each other.
     
  12. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    I was asking about x OR y TECHS. Not buildings. But that other stuff is good to know. And it isn't blanked completely of course, just the stuff that HAS to be filled in by the modder like the tags and cost, everything else is hopefully set up to making a building show up that does absolutely nothing.

    I just tested such a setup and got an XML load error. It's not too bad though, I just used incorrect syntax in a comment. It's a pretty long comment though and it doesn't tell me which part is incorrect so I'm going to have to mess with it.

    Line: 18, 5
    Source: <!-- NOTES FOR FILLING OUT VALUES: PrereqTech: This is the technology needed to buld this building. If your building needs more than one technology to build it see how to fill out tech types in the comment directly below this one. The tech tags are found in the CIV4TechInfos.xml file under type and look like TECH_NAME_OF_TECHNOLGY. It's currently set as NONE which is self explanatory. -->

    it's just a guess but i think the error is in having something called .xml in the note so I'm going to separate that out with spaces and try again

    Edit: I was wrong. still working on it. Any ideas?

    Edit Again: Tch. What am I wasting time on this for. I usually just delete the notes when I'm done with them.

    Edit Third Time: Go me! I now have a 300 cost building requiring Analyze Strings that does absolutely nothing. It has strategy and civilopedia and a button and everything. Working on filling out values now. One more time: is it true that it is currently impossible for a building to provide any additional percentage of science with the presence of power?

    Edit Once More: is it or is it not advisable to start a list (multi-line) type entry with <ThisIsAList> instead of <ThisIsAList/> ? I think i answered this question when a <ThisIsAList/> type thing generated an error.

    Return of the Edit Electric Boogaloo: I'm guessing the copper bonus's tag is BONUS_COPPER. Whoops, it produced extra gold.
     
  13. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Here is my cleaned XML files folder to hopefully be used by other people???
    And all the steampunk work to go in the alt timelines folder. It gives you a building. That does stuff.

    Now how do I remove all of the old attachments from my posts in this thread.
     
  14. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    @steampunk1880

    Oops. I don't recall what tag is for OR techs, I just know AND techs.

    That's good. I make syntax mistakes all the time (however I have been getting better). One of the best ways to avoid mistakes is copy and paste. Then you know your spelling them all the same. Thus if 1 is wrong they are all wrong. LOL

    I would have to see it to see why.

    Wha ...?

    From what I can see it looks good. I guess future tech is an ok place holder tech until we have more appropriate techs for it.

    Go to Private Messages and then scroll down to attachments to delete the old ones. Or go into each post to edit and manually removed them.
     
  15. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    When writing files with multiple entries, a suite of clockwork age related buildings for example, is there any convention to what order they are in? Otherwise I was going to go with alphabetical.
     
  16. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    I usually list them in the chronological order. But the order doesn't really matter. Many of the core files are grouped by type.
     
  17. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    If I wanted to, for example, borrow the .nif from the opera house (assuming it has one, haven't checked) where would I find it and would I have to stick a copy in my module's art folder?

    Basically how do I make my building appear like an opera house or theater or factory or something on map.
     
  18. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    You would go to Caveman2Cosmos/Assets/XML/Art/CIV4ArtDefines_Building.xml. The look up the opera house tag. Then you would see ...

    Code:
    		<BuildingArtInfo>
    			<Type>ART_DEF_BUILDING_OPERA</Type>
    			<LSystem>LSYSTEM_3x3</LSystem>
       			<bAnimated>0</bAnimated>
       			<fScale>1.5</fScale>
    		    <fInterfaceScale>0.50</fInterfaceScale>
    			<NIF>Art/Structures/Buildings/opera_houses/OldOpera.nif</NIF>
    			<KFM/>
    			<Button>,Art/Interface/Buttons/Buildings/OldOpera_Button.dds,Art/Interface/Buttons/RoM_Building_Atlas.dds,4,9</Button>
    		</BuildingArtInfo>
    
    You would want to copy all of it except for the <Type> (which you will rename) and <Button> (which you will provide your own new button). This will give you the right 3D model for that building.

    But beware, the more buildings with 3D models, the slower it will make the game. This is why most of my buildings have none, to help reduce slowing down the game.
     
  19. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,879
    Gender:
    Male
    Location:
    Canberra, Australia
    You don't need to duplicate art you can reuse it just use the same nif definition as appears in the opera house.

    if you want to have your own copy then use PakBuild to expand the C2C.FPK.
     
  20. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    in the CIV4ArtDefinesBuilding.xml I have noticed that most entries have two numbers after the button path

    ,Art/Interface/Buttons/Buildings/OldOpera_Button.dds,Art/Interface/Buttons/RoM_Building_Atlas.dds,4,9

    and a few extraneous commas. And that one has two buttons? What's going on here?

    Edit: Factories appear to have a special LSYSTEM_FACTORY. Would it cause problems or at least some graphical oddities if there were multiple buildings with LSYSTEM_FACTORY?
     

Share This Page