Changing Unit Types

Do you want to add another type or change from one to the other?

It's basically just a label so that you can get bonuses vs a type of unit or promotions that are type specific.
 
If all you want to do is change the combat type of an existing unit (Horse Archers from Mounted to Ranged, for instance) all you need to do is find Civ4UnitInfos.xml in the Units folder, search for the unit you want to alter (for Horse Archers, you would just type horse_archer in the search field), and then change the <Combat> tag (The sixth line in the unitinfo section of all units). For Horse Archers, this is UNITCOMBAT_MOUNTED. If you wanted to change it to ranged, you would change that field to read UNITCOMBAT_ARCHER (which is the tag for ranged units).

And of course, do this in a mod folder of your own making so you don't grody up the regular game (very simple, if you don't already know how; you can look up basic modding guides if you don't).
 
deanej said:
This is for the Star Trek mod and I figured that I would change the unit classes so you don't see things like a gunpowder category on the military advisor. Are there any other files that I have to modify?

If you're revamping that, there are 2-4 files you need to mess with:

Either way, you'll be probably be changing the unit combat types in UnitInfos, so that's one file; this is also where you determine whether units get innate bonuses against other units of different combat types (spearmen vs. mounted, for instance).

2nd file: If all you want is the display names to change (don't want to see "Ranged Units" and "Gunpowder Units", and don't care if the graphics and code text for the combat type remain the same (EG Gunpowder Icon, TXT_KEY_UNITCOMBAT_GUN, etc), all you have to mess with is the TXT_KEY entries for the combat types, which can be found in XML/Text/CIV4GameTextInfos_Objects.xml. If you changed the entry for TXT_KEY_UNITCOMBAT_GUN from "Gunpowder Units" to "Phasor Units", then that would replace all instances in-game as well, although any icons would still look the same and you'd have to remember which types you associated with which text.

3rd file: If you want more combat types, or want to change the code text for combat types to avoid confusion and make your mod easier to work with, you have to play with BasicInfos...the entries to mess with are all in <UnitCombatInfos>.

4th file: If you want promotions to work against new combat types you've entered or altered in code, you will need to play with CIV4PromotionInfos.xml, also in the XML/Units folder.
 
Top Bottom