How to add a new building

skodkim

Deity
Joined
Jan 16, 2004
Messages
2,497
Location
Denmark
Hi

I've been trying to add a new building; an improved barracks that gives the combat1 promotion, requires a barracks and can be built once construction has been investigated. The game crashes though :confused: . This is what I did:

CIV4BuildingInfos.xml
Copied the existing barracks and made edits in the follwing lines:
<BuildingClass>BUILDINGCLASS_IMP_BARRACKS</BuildingClass>
<Type>BUILDING_IMP_BARRACKS</Type>
...
<Description>TXT_KEY_BUILDING_IMP_BARRACKS</Description>
...
<PrereqTech>TECH_CONSTRUCTION</PrereqTech>
...
<FreePromotion>PROMOTION_COMBAT1</FreePromotion>
...
<BuildingClassNeededs>
<BuildingClassNeeded>
<BuildingClassType>BUILDINGCLASS_BARRACKS</BuildingClassType>
<bNeededInCity>1</bNeededInCity>
</BuildingClassNeeded>
</BuildingClassNeededs>

CIV4BuildingClassInfos.xml
Copied the existing barracks and made edits in the follwing lines:
<Type>BUILDINGCLASS_IMP_BARRACKS</Type>
<Description>TXT_KEY_BUILDING_IMP_BARRACKS</Description>
...
<DefaultBuilding>BUILDING_IMP_BARRACKS</DefaultBuilding>

CIV4GameTextInfos_Objects.xml
Copied the existing barracks and made edits in the follwing lines:
<Tag>TXT_KEY_BUILDING_IMP_BARRACKS</Tag>
<English>Improved Barracks</English>

As I said it crashes so I must be doing something wrong. Anyone got any ideas?

BTW: Couldn't believe this hadn't been discussed (maybe its too basic?) but I did do a search

\Skodkim
 
skodkim said:
Hi

I've been trying to add a new building; an improved barracks that gives the combat1 promotion, requires a barracks and can be built once construction has been investigated. The game crashes though :confused: . This is what I did:

CIV4BuildingInfos.xml
Copied the existing barracks and made edits in the follwing lines:
<BuildingClass>BUILDINGCLASS_IMP_BARRACKS</BuildingClass>
<Type>BUILDING_IMP_BARRACKS</Type>
...
...


Did you add the new building class BUILDINGCLASS_IMP_BARRACKS to this file:

CIV4BuildingClassInfos.xml

this file determines whether the custom building is a National Wonder/World Wonder/Regular Building

(it can also specify the amount of buildings that can be made)

Rule of Thumb for the CIV4BuildingClassInfos.xml data/taglines:

-1 = Unlimited number of Buildings that can be produced
0 = None
1 = One Building
2 = Two Buildings
3 = Three Buildings...etc


to find out how which line is a national/global wonder/regular building look at the existing "vanilla" versions in that file to find the right entry :goodjob:

FYI usually the specific number (2,3,4..) amount is used for units in the CIV4UnitClassInfos.xml file like for the spy/missionary units...

... but it can apply to buildings also... :crazyeye:

hope that helps ;)


please let me know if that works or not... I'll try to help you as best as I can... :goodjob:
 
Thanks for the help Officer Reene, but I already did that. As said I copied the lines from the existing barracks and made edits in the following lines:

<Type>BUILDINGCLASS_IMP_BARRACKS</Type>
<Description>TXT_KEY_BUILDING_IMP_BARRACKS</Description>
...
<DefaultBuilding>BUILDING_IMP_BARRACKS</DefaultBuilding>

The building is called "BUILDINGCLASS_IMP_BARRACKS" and has DefaultBuilding="BUILDING_IMP_BARRACKS" in the CIV4BuildingInfos.xml

I also made entries in the CIV4GameTextInfos_Objects.xml file

\Skodkim
 
skodkim said:
<BuildingClassNeededs>
<BuildingClassNeeded>
<BuildingClassType>BUILDINGCLASS_BARRACKS</BuildingClassType>
<bNeededInCity>1</bNeededInCity>
</BuildingClassNeeded>
</BuildingClassNeededs>
I don't have the files in front of me so maybe that's how it suppose to look but the bolded parts seem like a typo to me, maybe it should be BuildingClassNeeds?
 
Made it work!

Sorry - it was actually a typo and it turned out I was doing it (almost) right all along.

Thanks!!

\Skodkim
 
EDIT: While typing you posted that you solved the problem...so this post is unnecessary
 
I was having a devil of a time trying to figure out how to add a building: the guides always went into adding a new civ or a new unit instead. None of the wikis seemed to have a basic setup for this and it's a shame that there doesn't seem to be a cross platform editor for the xml files to simply insert/edit the existing files with the new data.

e.g. interface could have a dropdown with all buildings. Select the correct one and buttons like "edit", "copy as template" could be used. As in this example, you'd select "barracks", click "copy as template", and scroll down to the relevant tags and edit their properties using drop downs. I can vaguely see how i would have done this in VB4 but that was soooo long ago, and i don't have access to .net files.

BUILDINGCLASS_IMP_BARRACKS automatically be inserted in the file CIV4BuildingClassInfos.xml when you were done. I'm not sure what other files need to be edited.

Any programmers out their who could knock this up in an exe or java program that doesn't require extra microsoft files?
 
Are CIV4BuildingInfos.xml and CIV4BuildingClassInfos.xml the only two files that need to be edited to add a building? I have been searching and searching and can't find any guide/FAQ on this.
 
You need to edit CIV4ArtDefines_Buliding.xml to allot the graphics, icons etc
 
seady said:
Are CIV4BuildingInfos.xml and CIV4BuildingClassInfos.xml the only two files that need to be edited to add a building? I have been searching and searching and can't find any guide/FAQ on this.


also you need to edit:

CIV4GameTextInfos_Objects.xml

to make the name appear correctly...


and

CIV4GameText_Civilopedia_BuildingsProjects.xml

if you want to add the building in the civilopedia....

try these threads to add button (art image files/.dds files) for your buildings:

http://forums.civfanatics.com/showthread.php?t=148507

http://forums.civfanatics.com/showthread.php?t=156760

http://forums.civfanatics.com/showthread.php?t=151450

The first link is for CIV creation but it explains the button basics :D


FYI the last 2 links are a little hard to follow... but it does explain alot :mischief:


Hope this helps ;)
 
Thanks for the helping hand there, Officer Reene! I think I've got the hang of this now. It's interesting that the graphics part is the difficult bit. Not enough artists with computer skills IMO.
 
seady said:
Thanks for the helping hand there, Officer Reene! I think I've got the hang of this now. It's interesting that the graphics part is the difficult bit. Not enough artists with computer skills IMO.


your welcome let me know if you have any other problems :mischief:
 
Back
Top Bottom