View Full Version : [TUTORIAL] Modular XML Modding With C2C


Hydromancerx
Oct 24, 2011, 12:41 AM
This is a continuation of [TUTORIAL] Modular XML Modding With A New Dawn by Afforess (http://forums.civfanatics.com/showthread.php?t=354363), except this time rather than I being the student, I will be the teacher and steampunk1880 will be the student.

As said in the other thread, I asked him to follow the tutorial Afforess made for me and ask me any questions. This thread is made to help answer his questions as well as help tech anyone else who find this thread.

Now for the first questions ...

-----

It's bookmarked and I'd like to try to make a Municipal Computing Engine (as in the steampunk thread) as soon as possible but what's the icon and text file about?

First the icon. You can see how it is made here (http://forums.civfanatics.com/showpost.php?p=8921884&postcount=22).

As Afforess says you will need some sort of art program, MS paint works fine.You will need to add the border around it and then use DXTBmp to put on the alpha layer.

----

As for the text, this is the most simple of the stuff. You file will look like this ...



<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by XMLSPY 2004 Professional Ed. Release 2, Installed Multi + SMP for 3 users (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Game Text - New -->
<Civ4GameText xmlns="http://www.firaxis.com">
<TEXT>
<Tag>TXT_KEY_BUILDING_OTTER_CAMP</Tag>
<English>Sea Otter Hunter's Camp</English>
<French>Sea Otter Hunter's Camp</French>
<German>Sea Otter Hunter's Camp</German>
<Italian>Sea Otter Hunter's Camp</Italian>
<Spanish>Sea Otter Hunter's Camp</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_BUILDING_OTTER_CAMP_STRATEGY</Tag>
<English>Build a Sea Otter Hunter's Camp to increase your cities wealth.</English>
<French>Build a Sea Otter Hunter's Camp to increase your cities wealth.</French>
<German>Build a Sea Otter Hunter's Camp to increase your cities wealth.</German>
<Italian>Build a Sea Otter Hunter's Camp to increase your cities wealth.</Italian>
<Spanish>Build a Sea Otter Hunter's Camp to increase your cities wealth.</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_BUILDING_OTTER_CAMP_PEDIA</Tag>
<English>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</English>
<French>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</French>
<German>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</German>
<Italian>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</Italian>
<Spanish>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</Spanish>
</TEXT>
</Civ4GameText>

You first will need to rename your file. The one above was was called Trapping_CIV4GameText.xml. Use Notepad to open it up to see.

1. You will want to keep all the top part the same.

2. The first tag is going to be the same type of tag you use throughout your building. in this case "OTTER_CAMP" but for yours it could be "COMPUTING_ENGINE" or whatever tag you decided for it.

3. Then under that you will want to put the name of the building. Instead of "Sea Otter Hunter's Camp" you will want "Municipal Computing Engine".

4. Next is some more tags with the same tag name as before. But in this strategy text you will want to say something about it such as ...

"Build a Municipal Computing Engine to increase your cities science."

whatever the most important stat is you will want to mention it in the strategy.

5. Lastly the pedia. This is usually taken from Wikipedia and is rather short (like a paragraph) You will also need to remove the foot notes that look like [2] or [5]. Those look ugly and can sometines mess up thing in the game.

6. Then save your file if you have not already.

----

This should get you started. Let me know if you ave any other questions.

Give a man a fish and you feed him for a day. Teach a man to fish, and your feed him for a lifetime.

Thunderbrd
Oct 24, 2011, 12:45 AM
This is awesome to bring up here and be willing to hold lessons on Hydro! Great idea! I could use some review myself... I'll read that thread again and once I've caught back up with this I may have some questions of my own.

Hydromancerx
Oct 24, 2011, 12:59 AM
@Thunderbrd

Well unlike with RoM/AND there was only Afforess to tech stuff. However in C2C we have many skilled and experienced modders who know many areas of the game. I am sure if you (or anyone) asked a question someone on the team would know an answer to it.

I am still very much a student, but I have enough experience to get someone like steampunk1880 started and off to being more independent. I know how frustrating it can be to be begging for stuff to be made and no one responds. This should at least give him a chance learn and contribute to C2C.

Especially when he has such a passion for alternative timelines and hardly anyone is doing anything with it. Seems like its the perfect project for him to both learn and add to C2C's awesome features.

Hydromancerx
Oct 24, 2011, 03:40 PM
@steampunk1880

So how are things going? Having any trouble?

steampunk1880
Oct 24, 2011, 04:31 PM
While I promised I would get started on it, I just got back from a couple hours job searching. Before I leave again in an hour to go to my night job I'll try to make a button out of http://i.neoseeker.com/boxshots/Qm9va3MvU2NpLUZp/the_difference_engine_frontcover_large_dBaezEdsWy3 Kim1.jpg that giant honking computer on the cover.

I should get the "CIV4BuildingsSchema, the CIV4BuildingInfos, and the CIV4BuildingClassInfos" as well as the "CIV4ArtDefinesSchema and the CIV4ArtDefines_Building." from the Cavement2Cosmos-->assets-->XML folder right? I mean, yeah duh nevermind. OK there's gotta be a better .xml reader than the Internet Explorer it always wants to open it with..and then locks up... Notepad works. Should I copy the straight buildings schema or the AFFORESS buildings schema?

where do I get a copy of the standard civ 4 border icon. or i can probably just get it from the post about art

AIAndy
Oct 24, 2011, 04:44 PM
While I promised I would get started on it, I just got back from a couple hours job searching. Before I leave again in an hour to go to my night job I'll try to make a button out of http://i.neoseeker.com/boxshots/Qm9va3MvU2NpLUZp/the_difference_engine_frontcover_large_dBaezEdsWy3 Kim1.jpg that giant honking computer on the cover.

I should get the "CIV4BuildingsSchema, the CIV4BuildingInfos, and the CIV4BuildingClassInfos" as well as the "CIV4ArtDefinesSchema and the CIV4ArtDefines_Building." from the Cavement2Cosmos-->assets-->XML folder right? I mean, yeah duh nevermind. OK there's gotta be a better .xml reader than the Internet Explorer it always wants to open it with..and then locks up... Notepad works. Should I copy the straight buildings schema or the AFFORESS buildings schema?
The Afforess one. I guess maybe we should look if we can't delete the non Afforess one to avoid confusion and then maybe rename the Afforess one.

Dancing Hoskuld
Oct 24, 2011, 04:55 PM
The Afforess one. I guess maybe we should look if we can't delete the non Afforess one to avoid confusion and then maybe rename the Afforess one.

I have been meaning to suggest this for quite awhile. I suspect "we" have made many changes since moving from RoM/AND. Btw how do I request changes to the schema and exposing the fields to python?

Koshling
Oct 24, 2011, 04:58 PM
I have been meaning to suggest this for quite awhile. I suspect "we" have made many changes since moving from RoM/AND. Btw how do I request changes to the schema and exposing the fields to python?

By asking here ;) One of AIAndy or I will get to any such requests the purpose of which seems to have good levels of support before too long.

steampunk1880
Oct 24, 2011, 05:08 PM
Using windows 7 paint I'm trying to paste the frame I got from http://forums.civfanatics.com/showpost.php?p=8921884&postcount=22 over my 64x64 pixel crop of the thingy by selecting "paste from". I get a duplicate of the blank white button. How would I make the whitespace transparent. And does it matter that the pic I'm working from is jpg and the frame I'm pasting is png when I'm going to ultimately save it as DDS.

Edit: gotta go, be back at about 10:00 PM PST

Hydromancerx
Oct 24, 2011, 05:44 PM
@steampunk1880

Using windows 7 paint I'm trying to paste the frame I got from http://forums.civfanatics.com/showpost.php?p=8921884&postcount=22 over my 64x64 pixel crop of the thingy by selecting "paste from". I get a duplicate of the blank white button. How would I make the whitespace transparent. And does it matter that the pic I'm working from is jpg and the frame I'm pasting is png when I'm going to ultimately save it as DDS.

I personally use Adobe Photoshop 7 since I have it. You may want to get GIMP (http://www.gimp.org/) which is a free art program that can do just about everything that Adobe Photoshop can. Its much more versatile than MS Paint. It should help you crop out the computer from the cover.


where do I get a copy of the standard civ 4 border icon. or i can probably just get it from the post about art

Here is the button outline and alpha channel that Affores gave me back when.

Thunderbrd
Oct 24, 2011, 08:34 PM
Yep... Gimp... and I too am trying to work my way around it since I'm proficient with Macromedia Fireworks and find some of its command methods a bit foreign still.

I also suggest you get Notepad++, another free to grab program that makes XML work MUCH nicer. There's a lot of little benefits for the modder in that program - anymore basic notepad bugs my eyes out.

steampunk1880
Oct 24, 2011, 10:38 PM
Are there any other suggestions for specialized tools? For all purposes? I might should put together a civ 4 modding tools folder and populate it with clean blank xml files to copypasta as I make them, and maybe notes on how to do various things in the files when I learn them (IE "to add plus 1 unhealth to a building copy paste __________________* to this and that in these prepared blank files). And then the whole kit could be posted in the modders documentation thread as a do it yourself object maker so average Joes after me can put together their own projects.

Or maybe someone with much more experience than I have should do that. I'm still going to try to learn it the hard way though.

*don't know how to do this yet

Thunderbrd
Oct 24, 2011, 10:49 PM
I'm putting together a C2C database (starting with buildings) that will also help us keep track of what ALL our tags do... this will help guys like you and I still a bit new to some of those tags. It'll also help us all as a mod team to balance a great deal of the mod as a whole. Should be pretty cool when that comes together.

Creating a basic building template with all tags listed in a blank field xml format as a modder's building shell would be a really good idea too.

Hydromancerx
Oct 25, 2011, 12:05 AM
@steampunk1880

If you are going to have your own graphics you will need your own FPK which means you need to use "PakBuild". You can get it here (http://forums.civfanatics.com/showthread.php?t=136023). Note this also allows you to unpack existing FPKs.

Here are the example files that Affores gave me back when I was learning. They are kind of old but they should get you started.

Note the best way to find something you want is to look though civpedia and then find a building the stat you want. Then either go into the core or mods and just copy that line of code. OR ask where to find it. The attachment below should have a lot of example files.

steampunk1880
Oct 25, 2011, 12:20 AM
Ok, messing around in GIMP for an hour hasn't helped me put the frame over that attachment. Afforess says it's as simple as pasting the frame over the picture you made but no in Paint that gets me a blank white frame. And I'll be really very happy if I don't need to use GIMP ever again. Too many buttons and knobs.

Edit: one thing at a time please. I'd just like to make a button, save it as a DDS, and maybe tomorrow I can fill out the Civ4ArtDefines_Building. If I can't make a button then I'm thinking, darn, what makes me think I can do all this xml stuff.

Edit 10/31/11: removed attachment

EldrinFal
Oct 25, 2011, 12:27 AM
Ok, messing around in GIMP for an hour hasn't helped me put the frame over that attachment. Afforess says it's as simple as pasting the frame over the picture you made but no in Paint that gets me a blank white frame. And I'll be really very happy if I don't need to use GIMP ever again. Too many buttons and knobs.

Try Paint.net. I haven't done picture editing for C2C but it's what I use for all my other photo/image editing needs. It is fairly straightforward and has much less features than GIMP.

Hydromancerx
Oct 25, 2011, 12:27 AM
@steampunk1880

Sadly buildings need buttons. You can get away with no model but the button is a requirement. Since this is your first button, its ok to make mistakes, but you will need to make it yourself.

I am not as familiar with GIMP but from what I hear its similar to Photoshop. You will need to make different "layers". With your picture there on the bottom and then the file in post #3 the next layer up. It will have a big white thing in the middle which you will have to select and then delete. Once the white space is removed you should be able to see the frame on to of your picture.

Note that I personally save an Photoshop file with it already removed and just paste stuff under the layer. I would give you the file but I do not think it would work in GIMP.

steampunk1880
Oct 25, 2011, 01:48 AM
Erasing! Of course!

fifteen minutes later.

Button.

Hmm. Of course as soon as I try to post this the forums go down.

Edit 10/25/11:
I took jpg I had found from the internet, opened it in paint. Under view I zoomed in until I felt I could work with precision. Then using the select tool under the home tab I outlined a square 190x190 pixels and hit crop. Next I hit the resize button, changed the option from percentage to pixels and changed the 190 to 64 and saved it as a png.

I opened the png in GIMP. I selected file-->open as layers and found where i stashed the empty button.png. My picture became the background and the empty button became the first layer. Next I painstakingly used the erase tool to remove all the white from the inside of the button, having to pass multiple times in several areas to get rid of all the white (which was really annoying so I later went and made a pre-erased empty button named Actually Empty Button.png) Last, under the layer tab I hit merge down which placed the border over my picture.

The rest of the instructions on how to add the alpha layer and save it as a DDS are in that link in the OP. /end blow-by-blow

Edit 10/31/11: Removed attachment

Hydromancerx
Oct 25, 2011, 02:17 AM
@steampunk1880

Looking good! Looks like you got the alpha channel and everything!

For now you don't need an FPK yet if you don't want to.

Sicne this will be alternative timeline stuff you will want to put your mod in Caveman2Cosmos/Assets/Modules/Alt_Timelines.

There you can make a new Folder called "Steampunk".

In the Alt_Timelines Folder you will see a file called MLF_CIV4ModularLoadingControls.xml You will want to open that up with note pad and add your mod folder to it.


<Modules>
<Module>
<Directory>Lara_Croft</Directory>
<bLoad>1</bLoad>
</Module>
<Module>
<Directory>Dangers_Of_The_Deep</Directory>
<bLoad>1</bLoad>
</Module>
<Module>
<Directory>Megafauna</Directory>
<bLoad>1</bLoad>
</Module>
<Module>
<Directory>Sabretooth</Directory>
<bLoad>0</bLoad>
</Module>
<Module>
<Directory>Zebra</Directory>
<bLoad>1</bLoad>
</Module>
<Module>
<Directory>Zebra_Cavalry</Directory>
<bLoad>1</bLoad>
</Module>
<Module>
<Directory>Steampunk</Directory>
<bLoad>1</bLoad>
</Module>
</Modules>


What you want to add is in bold. The bLoad is set to 1 so it will be active. If you want the mod turned off then set it to 0.

Let me know if you have any questions.

steampunk1880
Oct 25, 2011, 04:23 PM
On my desktop i have a folder called Municip Comp Project. It consists of 5 untouched xml documents and an art folder with a dds button in it. If I understand correctly you want me to move everything in my project folder over to a new folder called Steampunk in the Alt Timelines folder. Taking the MegaFauna folder for example would it be better to, after making a Steampunk folder, create a folder in that for the building I am creating?

And is it correct to assume the mod should be turned off by default until all of the xml is set up or it could cause bad things to happen if I tried to play C2C?

Then, in the ArtDefines_building xml, between the button tags I should write: Modules/Alt_Timelines/Steampunk/Municipal_Computer/Art/computing_engine_button.dds ?
(To keep with convention I should probably resave the button with caps at each word)

Hydromancerx
Oct 25, 2011, 04:47 PM
On my desktop i have a folder called Municip Comp Project. It consists of 5 untouched xml documents and an art folder with a dds button in it. If I understand correctly you want me to move everything in my project folder over to a new folder called Steampunk in the Alt Timelines folder. Taking the MegaFauna folder for example would it be better to, after making a Steampunk folder, create a folder in that for the building I am creating?

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.

And is it correct to assume the mod should be turned off by default until all of the xml is set up or it could cause bad things to happen if I tried to play C2C?

You will want it on so you can test it.

Then, in the ArtDefines_building xml, between the button tags I should write: Modules/Alt_Timelines/Steampunk/Municipal_Computer/Art/computing_engine_button.dds ?
(To keep with convention I should probably resave the button with caps at each word)

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.

steampunk1880
Oct 26, 2011, 02:51 PM
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?

Dancing Hoskuld
Oct 26, 2011, 03:04 PM
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

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.

Hydromancerx
Oct 26, 2011, 03:12 PM
@steampunk1880

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


<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>

steampunk1880
Oct 26, 2011, 03:19 PM
It's ok to add comments to the top right? I mean there's an empty one already there for you.

Hydromancerx
Oct 26, 2011, 03:23 PM
It's ok to add comments to the top right? I mean there's an empty one already there for you.

Anywhere is fine really as long as they have the <!-- --> on wither side of the text.

steampunk1880
Oct 26, 2011, 03:36 PM
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.

Hydromancerx
Oct 26, 2011, 03:45 PM
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).

Dancing Hoskuld
Oct 26, 2011, 03:46 PM
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.

Just rename them to .xml instead of .txt

AIAndy
Oct 26, 2011, 03:50 PM
Best use a better editor than Notepad like Notepad++ or Notepad2.

Hydromancerx
Oct 26, 2011, 03:54 PM
Best use a better editor than Notepad like Notepad++ or Notepad2.

Any of those are fine, though Notepad++ is a bit intimidating to new modders.

steampunk1880
Oct 26, 2011, 04:01 PM
@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

Hydromancerx
Oct 26, 2011, 04:11 PM
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 ...

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

to this ...

<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.

steampunk1880
Oct 26, 2011, 04:29 PM
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?

Hydromancerx
Oct 26, 2011, 04:40 PM
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.

steampunk1880
Oct 26, 2011, 05:40 PM
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

Hydromancerx
Oct 26, 2011, 08:11 PM
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.

steampunk1880
Oct 27, 2011, 04:03 PM
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.

Hydromancerx
Oct 27, 2011, 10:58 PM
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.

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 ...

The default building used when there is no unique building replacing it

Not sure if that helps.

-----

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


<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.

steampunk1880
Oct 27, 2011, 11:29 PM
Thanks Hydro.

BuildingClassInfo template and Building Class info done.

Edit 10/31/11: Removed attachments

Hydromancerx
Oct 27, 2011, 11:43 PM
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.

steampunk1880
Oct 29, 2011, 08:11 PM
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?

ls612
Oct 29, 2011, 08:57 PM
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?

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.

steampunk1880
Oct 29, 2011, 09:13 PM
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.

steampunk1880
Oct 29, 2011, 10:45 PM
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.

Koshling
Oct 30, 2011, 09:58 AM
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.

Science isn't a yield. Its a commerce type.

steampunk1880
Oct 30, 2011, 04:44 PM
Ok, but I don't think that helps me. How would one get additional science % from the presence of electricity?

Hydromancerx
Oct 30, 2011, 05:34 PM
Ok, but I don't think that helps me. How would one get additional science % from the presence of electricity?

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>

steampunk1880
Oct 30, 2011, 08:41 PM
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?

steampunk1880
Oct 30, 2011, 10:54 PM
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

Hydromancerx
Oct 31, 2011, 12:42 AM
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?

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.

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.

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.

steampunk1880
Oct 31, 2011, 03:31 PM
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.

steampunk1880
Oct 31, 2011, 04:55 PM
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.

Hydromancerx
Oct 31, 2011, 07:48 PM
@steampunk1880

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.

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

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.

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

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. -->

I would have to see it to see why.

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

Wha ...?

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.

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.

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

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.

steampunk1880
Nov 08, 2011, 04:17 PM
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.

Hydromancerx
Nov 08, 2011, 04:20 PM
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.

I usually list them in the chronological order. But the order doesn't really matter. Many of the core files are grouped by type.

steampunk1880
Nov 08, 2011, 04:37 PM
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.

Hydromancerx
Nov 08, 2011, 04:46 PM
You would go to Caveman2Cosmos/Assets/XML/Art/CIV4ArtDefines_Building.xml. The look up the opera house tag. Then you would see ...


<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.

Dancing Hoskuld
Nov 08, 2011, 04:48 PM
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.

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.

steampunk1880
Nov 08, 2011, 05:03 PM
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?

Hydromancerx
Nov 08, 2011, 05:44 PM
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?


That's the button. And that's because buttons are on a huge graphics sheet rather than individual icons like we make. The other numbers are locations on the sheet. No need to worry about that since your using the NIF 3D Graphic not the DDS icon/button.


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?

I am not sure what you mean. Where are you looking?

steampunk1880
Nov 08, 2011, 05:54 PM
I was poking around the CIV4ArtDefines_Building.xml looking for various things to nick. Factory was one of them. Afforess mentioned certain things like Palace had predefined LSYSTEMs. I think this may be because they may be placed specially in the city, Like how the palace is always near the center. I was just worrying that having two buildings with the same special LSYSTEM tag might make it argue or at least try to place two buildings in the same place.

Hydromancerx
Nov 08, 2011, 06:01 PM
I was poking around the CIV4ArtDefines_Building.xml looking for various things to nick. Factory was one of them. Afforess mentioned certain things like Palace had predefined LSYSTEMs. I think this may be because they may be placed specially in the city, Like how the palace is always near the center. I was just worrying that having two buildings with the same special LSYSTEM tag might make it argue or at least try to place two buildings in the same place.

Ah ok, that makes sense. Like I said I don't use the 3D models for my buildings so I don't worry about that stuff. Best you don't mess with that stuff either unless have to have a graphic, such as a wonder, but even then you don't need a graphic for the wonder either.

In short its better to leave them blank.

Dancing Hoskuld
Jun 18, 2012, 11:10 PM
If you are going to make this into a complete tutorial perhaps you should include points 2-8 from here (http://forums.civfanatics.com/showpost.php?p=11580084&postcount=130). They probably need expanding a bit. Point 1 is specific to that modmod and I would not recommend it under most circumstances.

RidetheSpiral23
Jul 26, 2012, 04:50 PM
Is there an easy way to disable a unit modularly? Also, is there an easier way to change unit names depending on culture that just making up a new unitinfo file?

Dancing Hoskuld
Jul 26, 2012, 04:54 PM
Is there an easy way to disable a unit modularly? Also, is there an easier way to change unit names depending on culture that just making up a new unitinfo file?

Maybe. WoC modular does not allow you to set values to the default but you could try something like

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Alex Mantzaris (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- Modified by Strategyonly -->
<!-- -->
<!-- Unit Infos -->
<Civ4UnitInfos xmlns="x-schema:C2C_CIV4UnitSchema.xml">
<UnitInfos>
<UnitInfo>
<Class>UNITCLASS_class_name_here</Class>
<Type>UNIT_unit_name_here</Type>
<iCost>-1</iCost>
</UnitInfo>
</UnitInfos>
</Civ4UnitInfos>

RidetheSpiral23
Jul 26, 2012, 04:57 PM
Wow thanks for the fast response DH! Hum so setting it to -1 would make cause it to not show up? That actually makes sense. Thank you!

Dancing Hoskuld
Jul 26, 2012, 05:00 PM
Wow thanks for the fast response DH! Hum so setting it to -1 would make cause it to not show up? That actually makes sense. Thank you!

It shows in the pedia but you can't build it. That is how the GP work.

anunknownman
Jul 29, 2012, 04:18 AM
right so i have been working on my first wonder lately and i finished it, the only problem is that it appears in the buildings catagory rather than the wonders one. any idea why???:confused:

Dancing Hoskuld
Jul 29, 2012, 06:09 AM
right so i have been working on my first wonder lately and i finished it, the only problem is that it appears in the buildings catagory rather than the wonders one. any idea why???:confused:

For it to be a national wonder the iMaxPlayerInstances needs to be 1 in the BuildingClassInfos file. For it to be a Great wonder iMaxGlobalInstances needs to be 1.

anunknownman
Jul 29, 2012, 03:36 PM
For it to be a national wonder the iMaxPlayerInstances needs to be 1 in the BuildingClassInfos file. For it to be a Great wonder iMaxGlobalInstances needs to be 1.

thanks!!!:goodjob: once again you saved the day!!!:thanx::worship:

rightfuture
Jul 30, 2012, 09:53 PM
This is very useful.
Once players learn how easy XML is to edit, they might start making more of their own mod-mods.
If you already know html, you should try also.
For the most part, all you have to know to play around with it, is to open notepad, and know how to edit things.
Hint, It's a lot easier than basic. If you can cut and paste, then you can probably figure it out.
:)

anunknownman
Jul 31, 2012, 04:33 AM
This is very useful.
Once players learn how easy XML is to edit, they might start making more of their own mod-mods.
If you already know html, you should try also.
For the most part, all you have to know to play around with it, is to open notepad, and know how to edit things.
Hint, It's a lot easier than basic. If you can cut and paste, then you can probably figure it out.
:)

yeah, that's exactly what i do all the time!!!!:mischief: