View Full Version : Which XML file to modify


AlleyGator
Jun 24, 2008, 09:05 PM
My question, I know to modify most things you do so in the XML files and I have been able to modify a few things such as the default color of certain civilizations, move points but what I can't figure out is how to make an existing unit specific to only 1 civilization and how do you change the units you start out with, both the kind of units and how many?

Thanks
AlleyGator :D

primordial stew
Jun 24, 2008, 09:16 PM
Both are in: CIV4CivilizationInfos.xml
UU maybe not be so simple, it depends on the classes:

<Unit>
<UnitClassType>UNITCLASS_PRAESIDIUM</UnitClassType>
<UnitType>UNIT_ROMAN_PRAESIDIUM</UnitType>
</Unit>

So here I'm using a generic garrison class of unit, and under the Roman civ they get the Roman flavor of it.

Another way to make a unit buildable by only 1 civ is to require a unique tech, and have that tech enable the unit.

deanej
Jun 25, 2008, 03:09 PM
Actually, no need to use the tech for that. In Civ4UnitClassInfos:
<UnitClassInfo>
<Type>UNITCLASS_STARBASE_I</Type>
<Description>TXT_KEY_UNIT_STARBASE_I</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<iInstanceCostModifier>0</iInstanceCostModifier>
<DefaultUnit>UNIT_STARBASE_I</DefaultUnit>
</UnitClassInfo>

For example, if you wanted to make the Starbase buildable by only 1 civ, you would replace UNIT_STARBASE_I in DefaultUnit to NONE. Then you would do something similar to the unique units as detailed in the post above.

AlleyGator
Jun 25, 2008, 05:43 PM
Thanks I was hoping it would not take creating a new tech, but in the text below, lets say for instance I wanted to make the cannon only available to 1 civ behind "DefaultUnit>UNIT_CANNON" I don't see any number 1 or 0 if I put DefaultUnit>UNIT_CANNON_0 would that do it or am I missing something?


<UnitClassInfo>
<Type>UNITCLASS_GUNSHIP</Type>
<Description>TXT_KEY_UNIT_GUNSHIP</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_GUNSHIP</DefaultUnit>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_CATAPULT</Type>
<Description>TXT_KEY_UNIT_CATAPULT</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_CATAPULT</DefaultUnit>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_CANNON</Type>
<Description>TXT_KEY_UNIT_CANNON</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_CANNON</DefaultUnit>
</UnitClassInfo>

deanej
Jun 25, 2008, 09:06 PM
Just put "NONE" without the quotes. Then for the civ(s) you want to have the cannon:

<Unit>
<UnitClassType>UNITCLASS_CANNON</UnitClassType>
<UnitType>UNIT_CANNON</UnitType>
</Unit>

AlleyGator
Jun 26, 2008, 08:21 AM
Thanks I'll give it a go

I tried that and got this error

181240

and this is the section of the XML file.


<UnitClassInfo>
<Type>UNITCLASS_SCOUT</Type>
<Description>TXT_KEY_UNIT_SCOUT</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_SCOUT</DefaultUnit>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_EXPLORER</Type>
<Description>TXT_KEY_UNIT_EXPLORER</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_EXPLORER_NONE</DefaultUnit>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_SPY</Type>
<Description>TXT_KEY_UNIT_SPY</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>4</iMaxPlayerInstances>
<DefaultUnit>UNIT_SPY</DefaultUnit>

Dryhad
Jun 27, 2008, 12:56 AM
Thanks I'll give it a go

I tried that and got this error

181240

and this is the section of the XML file.


<UnitClassInfo>
<Type>UNITCLASS_SCOUT</Type>
<Description>TXT_KEY_UNIT_SCOUT</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_SCOUT</DefaultUnit>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_EXPLORER</Type>
<Description>TXT_KEY_UNIT_EXPLORER</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_EXPLORER_NONE</DefaultUnit>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_SPY</Type>
<Description>TXT_KEY_UNIT_SPY</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>4</iMaxPlayerInstances>
<DefaultUnit>UNIT_SPY</DefaultUnit>
Well first of all I think what you mean is <DefaultUnit>NONE</DefaultUnit> rather than <DefaultUnit>UNIT_EXPLORER_NONE</DefaultUnit>. But more importantly, what's all this nonsense about FormationInfos? That's UnitClassInfos, not FormationInfos.

deanej
Jun 27, 2008, 10:30 AM
Yes, <DefaultUnit>NONE</DefaultUnit> is what is needed. Also, what expansion pack is this for? BtS doesn't need modifications to Civ4FormationInfos, but Warlords and Vanilla may.

AlleyGator
Jun 27, 2008, 08:21 PM
Well first of all I think what you mean is <DefaultUnit>NONE</DefaultUnit> rather than <DefaultUnit>UNIT_EXPLORER_NONE</DefaultUnit>. But more importantly, what's all this nonsense about FormationInfos? That's UnitClassInfos, not FormationInfos.

Thanks I'll try <DefaultUnit>NONE</DefaultUnit> instead of the way I had it, and I have no idea about the formation infos cause i didn't touch that file.


@deanej
This isn't for any expansion I just have the CIV4 original game

deanej
Jun 27, 2008, 10:00 PM
Since you have vanilla, if you remove any units you will have to find every instance of that unit in Civ4FormationInfos and remove it from there. Unfortunately, the vanilla Civ4FormationInfos file is a huge mess, with everything jumbled together without any formatting to make it easier to read (no new lines for different elements, no tabs, etc.). There are cleaned up versions that are far easier to read on this site. If you add units they will also have to be added to Civ4FormationInfos.

AlleyGator
Jun 30, 2008, 09:03 PM
@Dryhad Using <DefaultUnit>NONE</DefaultUnit> did work the way I wanted it to,THANKS

@deanej Thanks for the info I will keep it in mind but right now I am not wanting to completely remove any units, just restrict which civs have use of them.

AG