CTP2 Bureau : Step By Step Guide To Add A Unit
CTP2 Bureau
The Modding
Knowledgebase
WePlayCiv: CtP2 Downloads
WePlayCiv: Call To Power forum
Apolyton Call To Power forums
Civilization Fanatics: Call To Power

Step By Step Guide To Add A Unit

by Locutus

The Apolyton forum post from which this guide has been extracted can be found here.

This process works for both scenarios and for the standard game, for the standard game all the files should be in [CtP2 folder]\ctp2_data\[name of path I mention] and for scenarios it should be [CtP2 folder]\Scenarios\[name of Scenario Pack]\[(optionally) scenXXXX where XXXX is any number between 0000 and 9999]\[name of path I mention]. Whenever I mention the folder english, this will only work for the English version of the game. When German/French/whatever versions come out, simply replace the foldername english with german/french/whatever to make it work for those versions.

Keep in mind that I don't have the final product yet so the names of things might be slightly different but in general everything should work. Presuming you have all the sprites and graphics that you need/want (if you don't, check the CtPI modification section to find out how to make those or use the list in the CTPII modification section to find out what sprites there were for CtPI and rename them to CtPII style (add an extra 0 if needed and use a non-existing number instead of the old one so you can stll use existing sprites whenever needed)):

1. Place the sprites in default\graphics\sprites.

2. Place any tga's you may have in default\graphics\pictures (make sure they are 16-bit). I don't think it matters what name they have, but these names are used in step 4, so make sure the names correspond with the ones you use in step 4.

3 .Place any sound files you may have (WAV format) in the default\sounds.

4. Edit default\gamedata\newsprite.txt. FE if you have a Chariot unit with the filename of the sprite Cu100.spr, add the line UNIT_CHARIOT2 100. Both the UNIT-name and the number need to be unique and the number must be the same as the number in the filename of the sprite.

5. Edit default\gamedata\uniticon.txt. For my Chariot example it might look like this (I copied this from the CtPII Cannon unit):

ICON_UNIT_CHARIOT { 
FirstFrame "UPUP100L.TGA"
Movie "NULL"
Gameplay "UNIT_CHARIOT_GAMEPLAY"
Historical "UNIT_CHARIOT_HISTORICAL"
Prereq "UNIT_CHARIOT_PREREQ"
Vari "UNIT_CHARIOT_STATISTICS"
Icon "UPUP100A.TGA"
LargeIcon "UPUP100L.TGA"
SmallIcon "UPUP100B.TGA"
StatText "UNIT_CHARIOT_SUMMARY"
}

If you don't have all necessary graphics, it's best to re-use the graphics of an existing unit.

6. Edit default\gamedata\sounds.txt. If you don't have any sounds simply copy the entries of an existing unit or use NULL.WAV (no sound), else add you're own. The various entries you need are all over the file, but here are the ones you might use for the Chariot example (once again, copied from the Cannon entry):

SOUND_ACKNOWLEDGE_CHARIOT "GUV100.WAV"
SOUND_ATTACK_CHARIOT "ACHARIOT2.WAV"
SOUND_CANTMOVE_CHARIOT "GUV100.WAV"
SOUND_DEATH_CHARIOT "VCHARIOT.WAV"
SOUND_MOVE_CHARIOT "WCHARIOT.WAV"
SOUND_SELECT1_CHARIOT "GUV100.WAV"
SOUND_SELECT2_CHARIOT "GUV100B.WAV"
SOUND_SPECIAL_CHARIOT "NULL.WAV"
SOUND_VICTORY_CHARIOT "NULL.WAV"
SOUND_WORK_CHARIOT "NULL.WAV"

For 'special' Situations you might have extra special sounds. You can add those easily, just give them a name here (FE SOUND_CHARGE_CHARIOT) and use that name where ever you need it in the rest of the files (i.e. normally only Units.txt).

7. Now add the appriopriate texts to english\gamedata\Great_Library.txt. Example:

[UNIT_CHARIOT_PREREQ]
Requires:
L:DATABASE_ADVANCES,ADVANCE_THE_WHEEL>The Wheel
[END]

[UNIT_CHARIOT_STATISTICS]
Attack: {UnitDB(UnitRecord[0]).Attack / 100}
Ranged: {UnitDB(UnitRecord[0]).ZBRangeAttack}
Defense: {UnitDB(UnitRecord[0]).Defense / 100}
Armor: {UnitDB(UnitRecord[0]).Armor / 100}
Damage: {UnitDB(UnitRecord[0]).Firepower}
Vision: {UnitDB(UnitRecord[0]).VisionRange}
Movement: {UnitDB(UnitRecord[0]).MaxMovePoints / 10000}
[END]

[UNIT_CHARIOT_SUMMARY]
Ancient Flanking Unit
[END]

[UNIT_CHARIOT_GAMEPLAY]
Due to it's large attack factor the Chariot is one of the most formidable Ancient
attack units and, though slower, only surpassed by the
War Elephant. Also, it's a flanking unit so it can provide support to other units during combat.
[END]

[UNIT_CHARIOT_HISTORICAL]
The Chariot was one of the most important Cavalry units of the Ancient Age.
[END]

8. Add an entry to default\gamedata\Units.txt. It might look like this:

## UNIT 100
UNIT_CHARIOT {
Description DESCRIPTION_UNIT_CHARIOT
DefaultIcon ICON_UNIT_CHARIOT
DefaultSprite SPRITE_CHARIOT
Category UNIT_CATEGORY_FLANKER
Attack 20
Defense 10
ZBRangeAttack 0
Firepower 2
Armor 1
MaxHP 10
ShieldCost 500
PowerPoints 400
ShieldHunger 6
FoodHunger 0
MaxMovePoints 300
VisionRange 2
EnableAdvance ADVANCE_THE_WHEEL
ObsoleteAdvance ADVANCE_FEUDALISM
ActiveDefenseRange 0
LossMoveToDmgNone
MaxFuel 0
CanEntrench
CanExpel
CanPillage
CanPirate
ExertsMartialLaw
DeathEffectsHappy
IsFlanker
SoundSelect1 SOUND_SELECT1_CHARIOT
SoundSelect2 SOUND_SELECT2_CHARIOT
SoundMove SOUND_MOVE_CHARIOT
SoundAcknowledge SOUND_ACKNOWLEDGE_CHARIOT
SoundCantMove SOUND_CANTMOVE_CHARIOT
SoundAttack SOUND_ATTACK_CHARIOT
SoundWork SOUND_WORK_CHARIOT
SoundVictory SOUND_VICTORY_CHARIOT
SoundDeath SOUND_DEATH_CHARIOT
CanAttack: Land
CanSee: Standard
MovementType: Land
Size: Medium
VisionClass: Standard
CanReform {
Sound SOUND_ID_REFORM_CITY
Effect SPECEFFECT_REFORMCITY
}
}
##################################################
##########

9. Edit english\gamedata\gl_str.txt to give the unit a name for in the game. For the Chariot it would look like this:

UNIT_CHARIOT "Chariot"

10. Now start up the game and test if it works. If it does and if you're happy with the stats and everything, you only have to get the AI to use the unit.

11. This can be done by adding it in the build lists, in the file default\gamedata\UnitBuildLists.txt. Just insert it at the correct position in the correct buildlist(s). Unless I'm mistaken the AI will see the units further down the list as more advanced, so in case of the Chariot it might look like this:

UNIT_BUILD_LIST_OFFENSE {
Unit UNIT_WARRIOR
Unit UNIT_SWORDSMAN
Unit UNIT_CHARIOT
Unit UNIT_KNIGHT
Unit UNIT_CAVALRY
Unit UNIT_MARINE
Unit UNIT_FASCIST
Unit UNIT_MACHINE_GUNNER
Unit UNIT_PARATROOPER
Unit UNIT_WAR_WALKER
Unit UNIT_FUSION_TANK
Unit UNIT_CRUISE_MISSILE
}

Unless I forgot anything or made a mistakes, that should be all to get it to work.

  Administration
This site is currently maintained by: BureauBert (Webmaster)  Maquiladora (Manager)  Legal Notice: Legal Notice Statistics: 71242 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne
Share this page:  VK Facebook Twitter LiveJournal OK MR Google+ LinkedIn tumblr Pinterest Blogger Digg Evernote