Which XML file to modify

AlleyGator

Chieftain
Joined
Jun 22, 2008
Messages
11
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
 
Both are in: CIV4CivilizationInfos.xml
UU maybe not be so simple, it depends on the classes:

Code:
<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.
 
Actually, no need to use the tech for that. In Civ4UnitClassInfos:
Code:
		<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.
 
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?


Code:
<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>
 
Thanks I'll give it a go

I tried that and got this error

XMLERROR.jpg

and this is the section of the XML file.


Code:
<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>
 
Thanks I'll give it a go

I tried that and got this error

View attachment 181240

and this is the section of the XML file.


Code:
<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.
 
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
 
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.
 
@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
 
Back
Top Bottom