Where to find database entries for unique unit upgrades?

rian222

Chieftain
Joined
Jul 31, 2013
Messages
39
Location
Japan
Specifically, I am looking for the entry that makes cossacks upgradable from horsemen so that I can copy it to make it possible to upgrade into other Civ's unique units. When I look in the UnitUpgrades table(using SQLiteStudio), I see what units can upgrade TO but not FROM. Presumably there is some code that changes this value to Cossacks instead of Cavalry while playing Russia, but I can't find it.
 
UNIT_RUSSIAN_COSSACK

it is in the UnitUpgrades table.
Code:
	<UnitUpgrades>
		....snipped out lines for the default units...
		<!--Unique-->
		<Row Unit="UNIT_EGYPTIAN_CHARIOT_ARCHER" UpgradeUnit="UNIT_CROSSBOWMAN"/>
		<Row Unit="UNIT_GREEK_HOPLITE" UpgradeUnit="UNIT_PIKEMAN"/>
		<Row Unit="UNIT_SCYTHIAN_HORSE_ARCHER" UpgradeUnit="UNIT_FIELD_CANNON"/>
		<Row Unit="UNIT_SUMERIAN_WAR_CART" UpgradeUnit="UNIT_KNIGHT"/>
		<Row Unit="UNIT_ENGLISH_REDCOAT" UpgradeUnit="UNIT_MECHANIZED_INFANTRY"/>
		<Row Unit="UNIT_ENGLISH_SEADOG" UpgradeUnit="UNIT_SUBMARINE"/>
		<Row Unit="UNIT_SPANISH_CONQUISTADOR" UpgradeUnit="UNIT_INFANTRY"/>
		<Row Unit="UNIT_AMERICAN_ROUGH_RIDER" UpgradeUnit="UNIT_MODERN_ARMOR"/>
		<Row Unit="UNIT_ROMAN_LEGION" UpgradeUnit="UNIT_MUSKETMAN"/>
		<Row Unit="UNIT_JAPANESE_SAMURAI" UpgradeUnit="UNIT_MUSKETMAN"/>
		<Row Unit="UNIT_NORWEGIAN_BERSERKER" UpgradeUnit="UNIT_MUSKETMAN"/>
		<Row Unit="UNIT_NORWEGIAN_LONGSHIP" UpgradeUnit="UNIT_CARAVEL"/>
		<Row Unit="UNIT_RUSSIAN_COSSACK" UpgradeUnit="UNIT_HELICOPTER"/>
		<Row Unit="UNIT_INDIAN_VARU" UpgradeUnit="UNIT_TANK"/>
		<Row Unit="UNIT_ARABIAN_MAMLUK" UpgradeUnit="UNIT_TANK"/>
		<Row Unit="UNIT_KONGO_SHIELD_BEARER" UpgradeUnit="UNIT_MUSKETMAN"/>
		<Row Unit="UNIT_FRENCH_GARDE_IMPERIALE" UpgradeUnit="UNIT_MECHANIZED_INFANTRY"/>
		<Row Unit="UNIT_GERMAN_UBOAT" UpgradeUnit="UNIT_NUCLEAR_SUBMARINE"/>
		<Row Unit="UNIT_AMERICAN_P51" UpgradeUnit="UNIT_JET_FIGHTER"/>
		<Row Unit="UNIT_BRAZILIAN_MINAS_GERAES" UpgradeUnit="UNIT_MISSILE_CRUISER"/>
		<Row Unit="UNIT_CHINESE_CROUCHING_TIGER" UpgradeUnit="UNIT_FIELD_CANNON"/>
	</UnitUpgrades>


as a general (but not 100% consistent) rule Firaxis will name unique units in a format of UNIT_[CIVILZATION-ADJECTIVE]_SOMETHING rather than directly UNIT_SOMETHING
 
Last edited:
Yes, I found the same thing in the UnitUpgrades table, however, this:

Code:
<Row Unit="UNIT_RUSSIAN_COSSACK" UpgradeUnit="UNIT_HELICOPTER"/>

Is the only mention I find of the Cossacks. It shows that they upgrade INTO helicopters. What I am looking for is how they upgrade FROM horsemen. I see no mention of this here. What I might expect is something like:

Code:
<Row Unit="UNIT_HORSEMAN" UpgradeUnit="UNIT_RUSSIAN_COSSACK" WHILE Civilization="Russia"/>

I'm sure what I just wrote is wrong though, which is why I would like to find it in the database.
 
Last edited:
The key to this lies here

Code:
<Row CivUniqueUnitType="UNIT_RUSSIAN_COSSACK" ReplacesUnitType="UNIT_CAVALRY"/>

and here

Code:
<Row Unit="UNIT_HORSEMAN" UpgradeUnit="UNIT_CAVALRY"/>

Units automatically upgrade into the unique version of the UnitType that gets replaced when playing with that Civ.
 
Last edited:
That is what I was looking for and I was hoping it would give me a clue as to how to make the changes I wanted, but it unfortunately doesn't help except maybe in the case of Winged Hussars(To replace Knights). Specifically, what I would like to do is change upgrade paths for units as follows:

Knight->RoughRider->Tank
Swordsman->Samurai->Musketman
Swordsman->Berzerker->Musketman
Musketman->Redocat->Infantry
Musketman->GardeImperial->Infantry

Additionally, it would be nice if I could make a second upgrade button for archers while playing Chinese. One to Crossbowmen and one to Crouching Tigers. Although I know this would probably be much more difficult.
 
Well that might be difficult, since the current system only allows upgrading TO a unique unit as long as it is a replacer, while non-replacer uniques can only be build as new units.

You could create an exact copy of their predecessors for that Civ (a fake-unique Swordsman so to say with the very same stats, looks and descs as the original, that upgrades into a Samurai), but the drawback would be, that this fake-unique would also appear in the list of unique units when selecting this civ. Or wait... isn't there an option to hide specific traits? :hmm: If so, and if it could be used to hide a unique unit, then this would be the solution, I guess.

The other approach would be to replace a standard unit with the unique (Swordsman with Samurai with toned down combat strength), but I guess that's not what you want.


Alternative upgrade options would be awesome, but unless Firaxis implements this into the vanilla game, you will have to wait for modders to have access to the source code before you will see fancy stuff like this. whoward69 created something similar for Civ5 (including a conversion of upgrades to fit the new class) and it worked very good, but he modified the DLL to achieve this.
 
Just taking a look at one particular case, I'm assuming you want to also make the Gardeimperial a standard unit instead of a unique unit for France. There's a two main things you need to do here.

- Change the unit so it is available to everyone by placing NULL in the TraitType on the Units table
- Delete or update any existing rows in UnitUpgrades that go down the "wrong " upgrade path and point them to the correct unit

I think that should be it.

As for the multiple upgrades path thing, I don't think that's doable in the way you're trying to do it. You could possibly create a unique ability similar to a Great Person that kills the existing unit and spawns a new one as a "replacement" but that will be difficult and likely have lots of issues.
 
Actually I'm just trying to make all unique units fit into the standard upgrade path of their unit class. I don't want to make them available to everyone.
 
Back
Top Bottom