Help with mod of civ-specific unit base stats

jofish15

Chieftain
Joined
Jan 29, 2008
Messages
8
Hi,

I was wondering if anyone could help me with a simple mod. Seems like it should be pretty easy, but for a beginner like me it hasn't been so far.

I would like to make a few civilization-specific modifications to some of the basic Units. Say, for example, I would like to make an American Worker with increased base workrate or an Iroquois Scout with increased base sight range. I would prefer to change their base status info so that unit promotions stack on top of them.

I've tried using the <update> tag to change the information for the Worker or Settler or Scout, but that changes the stats for ALL civilizations. I also tried (and failed miserably) of trying to use something like <When Civilization="Iroquois"/> and then the update info, but to no avail. The units retained their normal stats.

I also made a silly attempt to create a separate American Settler (called him LewisClark just for fun) to try and replace the Settler for the American Civ. I basically followed a tutorial on replacing a warrior, making what seemed to me to be the appropriate changes. End result = no Settler when you start the game as America. This was disappointing as I liked the idea of this approach the best, because of the ability to rename Settler, Workers, and Scouts whatever you want.

Another thought I had was that it might be easier to try and apply the bonuses as leader traits (since they are civ-specific) but I am also unsure of how to approach that.

Any help would be much appreciated!
 
To expand on SamBC's answer, you would make a new unit entry with the same unit class as the unit you are wanting to modify, and then add to the Civilization_UnitClassOverrides table.

It's not too hard, just use the existing unique units as a guide. :)
 
To expand on SamBC's answer, you would make a new unit entry with the same unit class as the unit you are wanting to modify, and then add to the Civilization_UnitClassOverrides table.

It's not too hard, just use the existing unique units as a guide. :)

I've tried doing this, to no avail. As I mentioned in my first post no Settler appears at the beginning of the game (just a warrior). Is there perhaps something special I have to do to insert a unique settler and have them be one of your starting units?

Here is my Civilization_UnitClassOverrides table for trying to insert a new settler and worker:

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 2/24/2011 12:58:50 AM -->
<GameData>
	<!-- TODO: Insert table creation example here. -->

	<!-- TODO: Insert table data example here.-->

	<!-- Enter your Game Data here. -->

	<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_IROQUOIS</CivilizationType>
			<UnitClassType>UNITCLASS_SETTLER</UnitClassType>
			<UnitType>UNIT_HAUDENOSAUNEE_SETTLER</UnitType>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_IROQUOIS</CivilizationType>
			<UnitClassType>UNITCLASS_WORKER</UnitClassType>
			<UnitType>UNIT_HAUDENOSAUNEE_WORKER</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>

</GameData>

And below are my unit descriptions. I have basically cut and pasted the Settler and Worker info, with a few tweaks to test the mod (increased movement & sight).

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 2/23/2011 11:58:16 PM -->
<GameData>
	<!-- TODO: Insert table creation example here. -->

	<!-- TODO: Insert table data example here.-->

	<!-- Enter your Game Data here. -->
	<Units>
		<Row>
			<ID>0</ID>
			<Class>UNITCLASS_SETTLER</Class>
			<Type>UNIT_HAUDENOSAUNEE_SETTLER</Type>
			<Moves>7</Moves>
			<BaseSightRange>5</BaseSightRange>
			<Capture>UNITCLASS_WORKER</Capture>
			<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_HIGH_EARLY_GAME_ONLY</CivilianAttackPriority>
			<HurryCostModifier>20</HurryCostModifier>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_SETTLER</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_HAUDENOSAUNEE_SETTLER</Description>
			<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_SETTLER_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_SETTLER_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_HAUDENOSAUNEE_SETTLER</Help>
			<Requirements>TXT_KEY_NO_ACTION_SETTLER_SIZE_LIMIT_HARDCODED</Requirements>
			<Food>true</Food>
			<Found>true</Found>
			<CombatLimit>0</CombatLimit>
			<UnitArtInfo>ART_DEF_UNIT__SETTLER</UnitArtInfo>
			<UnitArtInfoCulturalVariation>true</UnitArtInfoCulturalVariation>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>UNIT_ATLAS_1</IconAtlas>
		</Row>
		<Row>
			<Class>UNITCLASS_WORKER</Class>
			<Type>UNIT_HAUDENOSAUNEE_WORKER</Type>
			<Cost>40</Cost>
			<Moves>8</Moves>
			<Capture>UNITCLASS_WORKER</Capture>
			<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_LOW</CivilianAttackPriority>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_WORKER</DefaultUnitAI>
			<Description>TXT_KEY_UNIT_HAUDENOSAUNEE_WORKER</Description>
			<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_WORKER_TEXT</Civilopedia>
			<Strategy>TXT_KEY_UNIT_WORKER_STRATEGY</Strategy>
			<Help>TXT_KEY_UNIT_HELP_HAUDENOSAUNEE_WORKER</Help>
			<AdvancedStartCost>20</AdvancedStartCost>
			<WorkRate>800</WorkRate>
			<CombatLimit>0</CombatLimit>
			<UnitArtInfo>ART_DEF_UNIT__WORKER</UnitArtInfo>
			<UnitArtInfoEraVariation>true</UnitArtInfoEraVariation>
			<UnitFlagIconOffset>1</UnitFlagIconOffset>
			<PortraitIndex>1</PortraitIndex>
			<IconAtlas>UNIT_ATLAS_1</IconAtlas>
		</Row>
	</Units>
	<Unit_FreePromotions>
		<Row>
			<UnitType>UNIT_HAUDENOSAUNEE_SETTLER</UnitType>
			<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
		</Row>
		<Row>
			<UnitType>UNIT_HAUDENOSAUNEE_WORKER</UnitType>
			<PromotionType>PROMOTION_IGNORE_TERRAIN_COST</PromotionType>
		</Row>
	</Unit_FreePromotions>
	<Unit_AITypes>
		<Row>
			<UnitType>UNIT_HAUDENOSAUNEE_SETTLER</UnitType>
			<UnitAIType>UNITAI_SETTLE</UnitAIType>
		</Row>
		<Row>
			<UnitType>UNIT_HAUDENOSAUNEE_WORKER</UnitType>
			<UnitAIType>UNITAI_WORKER</UnitAIType>
		</Row>
	</Unit_AITypes>
	<Unit_Flavors>
		<Row>
			<UnitType>UNIT_HAUDENOSAUNEE_SETTLER</UnitType>
			<FlavorType>FLAVOR_EXPANSION</FlavorType>
			<Flavor>21</Flavor>
		</Row>
		<Row>
			<UnitType>UNIT_HAUDENOSAUNEE_WORKER</UnitType>
			<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
			<Flavor>15</Flavor>
		</Row>
	</Unit_Flavors>
</GameData>

And finally here is the text info:

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 2/24/2011 12:46:53 AM -->
<GameData>
	<!-- TODO: Insert table creation example here. -->

	<!-- TODO: Insert table data example here.-->

	<!-- Enter your Game Data here. -->
	<Language_en_US> 
		<Row Tag="TXT_KEY_UNIT_HAUDENOSAUNEE_SETTLER">
			<Text>HAUDENOSAUNEE_SETTLER</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_HELP_HAUDENOSAUNEE_SETTLER">
			<Text>Gifted with a high endurance and familiarity with the wild, this unit's keen eye and ability to move swiftly and ignore terrain allow it to quickly discover and settle new lands.</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_HAUDENOSAUNEE_WORKER">
			<Text>Haudenosaunee Worker</Text>
		</Row>
		<Row Tag="TXT_KEY_UNIT_HELP_HAUDENOSAUNEE_WORKER">
			<Text>This unit's strong work ethic and familiarity with local terrain allow it to finsih tasks and cover ground quickly.</Text>
		</Row>
	</Language_en_US>
</GameData>

Am I missing something?

As always, any help is appreciated!
 
I've tried doing this, to no avail. As I mentioned in my first post no Settler appears at the beginning of the game (just a warrior). Is there perhaps something special I have to do to insert a unique settler and have them be one of your starting units?

No. Generally speaking, the game picks the best available unit that can found cities, the best available unit that can do worker actions, and the best available military unit when you start games. (In later eras you start with multiple settlers and military units.) So if you've correctly replaced the old unit with the new one, it should work.
But you might want to check the Civilizations file, to ensure that it's not listing the Settler as a "free unit", in which case you'd have to change the Iroquois entry.

But it's your Units that are the problem.

Let's start with the Settler:


Code:
	<Units>
		<Row>
			<ID>0</ID>
			<Class>UNITCLASS_SETTLER</Class>
			<Type>UNIT_HAUDENOSAUNEE_SETTLER</Type>
			<Moves>7</Moves>
			<BaseSightRange>5</BaseSightRange>
			<Capture>UNITCLASS_WORKER</Capture>

The fact that BaseSightRange doesn't actually work right is only a minor issue. The big problem is that you set the ID. That's BAD. The game auto-indexes units from 0 to N-1, and the only reason the Settler in the core game has that explicit ID=0 is because the game needs somewhere to start counting from. So you're not adding a new unit here, you're overwriting the existing Settler with the new unit. And the game can't handle that, because XML updates don't work that way. So it breaks.
(Translation: Remove the ID line.)

Your Worker is broken for a different reason. In the Units table, there's a list of Unit_Builds, which tells each unit what build actions it can take. You haven't assigned any of these to your worker, so it can't DO anything. And therefore, the game doesn't classify it as a Worker unit in situations that would otherwise give a free worker.
So you need to find all of the worker build actions, copy the whole lot of them, and change the name on the copies.

As for the rest, like the insane movement rates? If you want to play God mode, play the game on Chieftain or something.
 
Thanks for the help!

Removing the <ID> from the settler solves that issue; he now appears at the start. Much appreciated.

As for the worker, l'll have to go scrounge up all that info. It would have taken me a LONG time to figure that out, if at all.

Oh, and the only reason for the insane movement rates and sight range was for testing purposes, not that it really matters.
 
Top Bottom