Unitinfo.xml qustions

Ploeperpengel

academic precarity
Joined
Feb 2, 2006
Messages
4,748
Location
Berlin
I can't find anything about that in the tutorials maybe I missed it? Anyway a couple of questions I want to know what these xml tags below are doing, I have a rough idea of some but what do they do exactly and how to make effects with those?

<Special>NONE</Special>
<bNoBadGoodies>0</bNoBadGoodies>
<FlatMovementCost>0</bFlatMovementCost>
<ProductionTraits/>
<iAIWeight>0</iAIWeight>
<iHurryCostModifier>0</iHurryCostModifier>
<iMinAreaSize>-1</iMinAreaSize>
<iBaseDiscover>0</iBaseDiscover>
<iDiscoverMultiplier>0</iDiscoverMultiplier>
<iBaseHurry>0</iBaseHurry>
<iHurryMultiplier>0</iHurryMultiplier>
<iBaseTrade>0</iBaseTrade>
<iTradeMultiplier>0</iTradeMultiplier>
<iCollateralDamage>0</iCollateralDamage>
<iCollateralDamageLimit>0</iCollateralDamageLimit>
<TerrainNatives/>
<FeatureNatives/>
<DomainMods/>
<BonusProductionModifiers/>
<iCultureGarrison>3</iCultureGarrison>
<iAsset>1</iAsset>
<iPower>1</iPower>
 
<bNoBadGoodies>0</bNoBadGoodies>

make it 1 and it means your units wont get any results tagged as 'bad' in the GameInfo/CIV4GoodyInfo.xml file (use for scouts)

<FlatMovementCost>0</bFlatMovementCost>

flag to 1 to make unit cost 1 movement point irrespective of tile/terrain (use for flying units)

<iBaseHurry>0</iBaseHurry>
<iHurryMultiplier>0</iHurryMultiplier>

These are to allow you to 'sacrifice' the unit for production, the top one works as a fixed rate of production e.g. 25 hammers, bottom is a percentage

<iBaseTrade>0</iBaseTrade>
<iTradeMultiplier>0</iTradeMultiplier>

I havent played with them but think that these do the same except sacrifice to make trade routes (like the vanilla great merchant)

<TerrainNatives/>
<FeatureNatives/>

we use these in Roanoke to make barbarian energy pulses spawn in lattice (jungle) squares
Code:
		<FeatureNatives>
			<FeatureNative>
				<FeatureType>FEATURE_JUNGLE</FeatureType>
				<bFeatureNative>1</bFeatureNative>
			</FeatureNative>
		</FeatureNatives>

<iCollateralDamage>0</iCollateralDamage>
<iCollateralDamageLimit>0</iCollateralDamageLimit>

to set whether or not the unit does collateral damage change the top one up (most units i see use '100'), to turn the maximum collateral it can do change the bottom one (a percentage, most use '50')

<iAsset>1</iAsset>

i think this is the civ score you generate for having built one

<iPower>1</iPower>

i believe is the power weighted to you by AI players judging how powerful you are


NOT SURE ABOUT:
<ProductionTraits/>
<iAIWeight>0</iAIWeight>
<iHurryCostModifier>0</iHurryCostModifier>
<iMinAreaSize>-1</iMinAreaSize>
<iBaseDiscover>0</iBaseDiscover>
<iDiscoverMultiplier>0</iDiscoverMultiplier>
<BonusProductionModifiers/>
<iCultureGarrison>3</iCultureGarrison>
<DomainMods/>
 
I think these are the ones Jenks didn't cover.

<Special>NONE</Special>

Specialunit type. I use it as a tag to describe spells, though you could use it for anything you'd like.

<ProductionTraits/>

Production bonuses based on the players traits. You could use this to make a specific unit cost less if you have a certain trait.

<iAIWeight>0</iAIWeight>

An adjustment to the Ai's weighting to determine how much it likes or dislikes the unit. I use it when units have abilities that are described well in the xml (like spellcasters).

<iHurryCostModifier>0</iHurryCostModifier>

Adjustment to the cost when the unit is hurried with gold.

<iMinAreaSize>-1</iMinAreaSize>

The minimum area size of land (for land domain units) or connected water units (for domain water units). -1 means there is no limit. You will notice on ships it is set to like 10, that means the city cant build that ship uless it is connected to a water source at least 10 tiles large.

<iBaseDiscover>0</iBaseDiscover>
<iDiscoverMultiplier>0</iDiscoverMultiplier>

Effects the amount of research sacrificing the unit will generate.

<DomainMods/>

Bonus vs specific domains.

<BonusProductionModifiers/>

Production boost based on bonus's the player has access to. So you could have your spearmans production cost haved if you have access to iron, etc.
 
Ploeperpengel said:
Ok thx so far!:) About the icollateral is this a percentage and the second a max number or what?

I think iCollateralDamage is a percentage of the units damage done. iCollateralDamageLimit is the lowest life collateral damage can leave the vicitms at. So iCollateralDamage 40 couldn't reduce units below 40% life.
 
the special tag is useful for grouping a lot of types of units together,

for instance in the vanilla missionarys, great people, spys, scouts and explorers all have the tag
<Special>People</Special>

and later you see carvels having cargo type people, so carvels can carry missionaries, great people and recon units same go's for subs.

You can also use the tag if you want a certain trait or bonus to effect a whole range of units.

So if you wanted the spiritual to make missionaries faster you could lable all missionaries <Special>SPECIALUNIT_MISSIONARY</Special>

and then in your civ4specialunitinfos.xml file you'd put
Code:
		<SpecialUnitInfo>
			<Type>SPECIALUNIT_MISSIONARY</Type>
			<Description>TXT_KEY_SPECIALUNIT_MISSIONARY</Description>
			<bValid>1</bValid>
			<ProductionTraits>
				<ProductionTrait>
					<ProductionTraitType>TRAIT_SPIRITUAL</ProductionTraitType>
					<iProductionTrait>50</iProductionTrait>
				</ProductionTrait>
			</ProductionTraits>
		</SpecialUnitInfo>

and spiritual would make all missionaries 50% faster. basicly you'd need to tie any thing you put into the special tag with specialunitinfo

hope that helps a little
 
Oh yes this all helps alot! Thank you all.:) Still some questions though.
What about the icultural garrison?
Oh and another general question. How to make units national units to restrict the number you can build?
And about the AI-weight. What would be a value making the AI build it for certain?
 
Ploeperpengel said:
Oh yes this all helps alot! Thank you all.:) Still some questions though.
What about the icultural garrison?

Looking at the SDK it looks like CultureGarrison is only really used int he doCulture function. But it doesn't seem to really add culture to the city. Instead the unit with the best CultureGarrison uses its value in part of the calculation to determine if the city culture flips. So the higher the value the less likely the city is to flip.

Oh and another general question. How to make units national units to restrict the number you can build?

Thats set in the unitclass definition.

And about the AI-weight. What would be a value making the AI build it for certain?

Usually a weight range at about 5-100 is a good range. You could put anything in though. If you put 999 in then if the city can build it and you havent messed with the other values its probably going to build it. Chalid was telling me today that the leader flavor is multiplied by the unit flavor and added to this. So if you assume a leader has 10 military (highest flavor used in vanilla civ) and the unit is 10 military then that will weight that leader 100 toward making that unit. That should give you some sort of estimate of the range we are dealing with.
 
These guys answered well. Hey, Ploeperpengel, did you get my PM?
 
the culture garrison is the value it gives to help stop a culture flip.

i can't find the exact formula its around these forums somewhere but basicly

every 10 turns a culture flip test is done, i think it rolls the difference in the 2 cultures, this is then changed by a number of values which are determined in gamedefines.xml (i think) such as religion if your at war or not etc. after the random roll is determined your culture vs thier culture the total of all the iculture garrision is added to thier culture roll and if this is now higher the city does not flip. This is why its extremely hard to flip a city with piles of units in it and also why the AI will pile units into a tiny city that is overwhelmed via culture.
 
Back
Top Bottom