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
    You will want to have a "Steampunk" folder with you current steampunk era project in it. When testing that is the location you will want to put it in to test it out. Inside your Steampunk folder you will want o have the following files ...

    - Steampunk_CIV4ArtDefines_Building.xml
    - Steampunk_CIV4BuildingClassInfos.xml
    - Steampunk_CIV4BuildingInfos.xml
    - Steampunk_CIV4GameText.xml
    - Steampunk_CIV4ArtDefinesSchema.xml
    - Steampunk_CIV4BuildingsSchema.xml

    And then another folder inside the Steampunk folder called "Art". In there you will stick the button/icon you just made.

    You will want it on so you can test it.

    You don't need the Municipal_Computer stuff. You can have all your steampunk related era stuff in the same files. Note that "Steampunk" is the era and not your name. If this was Cyberpunk you would be doing that instead.
     
  2. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Does xml have any way to add text that isn't read by the program like how in java you can make comments by typing // for the program to ignore a line or /* and */ to open and close a block comment?

    Edit: in art defines building if the building IS animated (mine is not, but for reference) What would you put in bAnimated. Also is it possible to add attachments to stuff you've already posted on this forum?
     
  3. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,875
    Gender:
    Male
    Location:
    Canberra, Australia
    1) Comments in XML start with <!-- and end with -->. Note that there are some places in the Civ IV where commenting will make the parser ignore the rest of the XML in a list.

    2)value 0 for not animated 1 for animated.
     
  4. Hydromancerx

    Hydromancerx C2C Modder

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

    Your art define should look similar to this. Except with your own tag and the button address different.

    Code:
    		<BuildingArtInfo>
    			<Type>ART_DEF_BUILDING_SILK_FARM</Type>
    			<LSystem>LSYSTEM_1x1</LSystem>
    			<bAnimated>0</bAnimated>
    			<fScale>0</fScale>
    			<fInterfaceScale>0</fInterfaceScale>
    			<NIF>Art/empty.nif</NIF>
    			<KFM/>
    			<Button>Modules/Hydro/Crops/art/silkfarm.dds</Button>
    		</BuildingArtInfo>
    
     
  5. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    It's ok to add comments to the top right? I mean there's an empty one already there for you.
     
  6. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Anywhere is fine really as long as they have the <!-- --> on wither side of the text.
     
  7. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    I made a cleaned with notes and a steampunk art defines building but I just realized they were saved as .txt files and... not .xml. I had been using notepad to edit the files and it doesn't give me the option to save as: type XML. What else do I need to save as type XML.
     
  8. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    You need to open an existing XML file with notepad. Then save. It should stay as xml if it was xml to start with. You just cannot make a new notepad doc and then save to xml (as far as I know).
     
  9. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    22,875
    Gender:
    Male
    Location:
    Canberra, Australia
    Just rename them to .xml instead of .txt
     
  10. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,384
    Best use a better editor than Notepad like Notepad++ or Notepad2.
     
  11. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Any of those are fine, though Notepad++ is a bit intimidating to new modders.
     
  12. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    @Hoskuld. That worked.

    A template to go in my tools folder, and one to go in the steampunk folder.

    Responding to below: I'll make a note in my template to erase the notes in the working copy

    Edit 10/31/11: Removed Attachments
     
  13. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    They look good but I would not include your notes in the working copy. They just clutter up the file.

    EDIT: spoke too soon. You will need to change this ...

    Code:
    <Civ4ArtDefines xmlns="x-schema:CIV4ArtDefinesSchema.xml">
    to this ...

    Code:
    <Civ4ArtDefines xmlns="x-schema:Steampunk_CIV4ArtDefinesSchema.xml">
    You will also need to change your schema to that name. Its important to make your schema name different from the core files so they do not conflict if they are different.
     
  14. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    So in other words my CleanedWithNotes_Civ4ArtDefines_Building would need to have that changed to:

    <Civ4ArtDefines xmlns="x-schema:CleanedWithNotes_CIV4ArtDefinesSchema.xml">

    What needs to be done to the art defines schema?

    <Schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes">

    Above is unchanged first line after notes from copypasta CIV4ArtDefinesSchema.

    Does something similar need to be done to any hypothetical Steampunk_CIV4GameText.xml ?

    EDIT:
    Oh I understand, just change the name of the ArtDefineSchema to what I put in the ArtDefines_building. Still, does nothing have to be done to the ArtDefinesSchmea beyond changing it's name before I can put it in the steampunk folder?
     
  15. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    The schemas don't need changing at all except for their file name. Don't mes with anything inside of them.

    Note that you will want to keep all your schemas the same name so for you we can just use Steampunk_CIV4ArtDefinesSchema.xml. Mine are Hydro_CIV4ArtDefinesSchema.xml.

    Note its is just by chance you are working on a mod that has the same name as you.

    EDIT: For example in the future you will have files like ...

    - Cyberpunk_CIV4ArtDefines_Building.xml
    - Cyberpunk_CIV4BuildingClassInfos.xml
    - Cyberpunk_CIV4BuildingInfos.xml
    - Cyberpunk_CIV4GameText.xml
    - Steampunk_CIV4ArtDefinesSchema.xml
    - Steampunk_CIV4BuildingsSchema.xml

    Where the schema are the same.
     
  16. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Text file template goes in my tools folder, Finished text file goes in steampunk folder.

    Renamed Buildings and ArtDefines schemata added to steampunk folder.

    I guess the hard stuff starts tomorrow.

    Edit 10/31/11: Removed attachments
     
  17. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Looking good steampunk! :D You are about half way done now. All you really need is Class Info and the Building Info. I suggest the Class Info first since it is easier.
     
  18. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Can someone better explain to me than the modiki what DefaultBuilding and VictoryThresholds in the Civ4BuildingClassInfos.xml does and what an active VictoryThresholds would look like?

    I did read about DefaultBuilding in the Afforess/Hydro tutorial but I still don't understand how it works well enough to explain it succinctly in my notes.
     
  19. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    I don't recall what DefaultBuilding does. All I know is when I make new buildings I write it like this <DefaultBuilding>BUILDING_CRAFT_HUT</DefaultBuilding>

    The Wiki says ...

    Not sure if that helps.

    -----

    And Victory Threshold triggers types of victories such as building the Accession gate enables Scientific Victory.

    Code:
    		<BuildingClassInfo>
    			<Type>BUILDINGCLASS_ASCENSION_GATE</Type>
    			<Description>TXT_KEY_BUILDING_ASCENSION_GATE</Description>
    			<iMaxGlobalInstances>1</iMaxGlobalInstances>
    			<iMaxTeamInstances>-1</iMaxTeamInstances>
    			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
    			<iExtraPlayerInstances>0</iExtraPlayerInstances>
    			<bNoLimit>0</bNoLimit>
    			<bMonument>1</bMonument>
    			<DefaultBuilding>BUILDING_ASCENSION_GATE</DefaultBuilding>
    			<VictoryThresholds>
    				<VictoryThreshold>
    					<VictoryType>VICTORY_SCIENTIFIC</VictoryType>
    					<iThreshold>1</iThreshold>
    				</VictoryThreshold>
    			</VictoryThresholds>
    		</BuildingClassInfo>
    
    I hope that helps.
     
  20. steampunk1880

    steampunk1880 Chieftain

    Joined:
    Feb 22, 2007
    Messages:
    328
    Thanks Hydro.

    BuildingClassInfo template and Building Class info done.

    Edit 10/31/11: Removed attachments
     

Share This Page