I'd like to add a small number of custom-made units to the game. Probably way too early to be asking... but when someone figures it out could they let me know?
Announcement
Collapse
No announcement yet.
Anyone figured out units yet?
Collapse
X
-
Well, I haven't actually tried it yet, but I'll give you a description of how I think it should work and if it doesn't it should at least give you a good headstart (keep in mind that I don't have the final product yet so the names of things might be slightly different than the ones I use). 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):
1) place the sprites in [CtP2 folder]\ctp2_data\default\graphics\sprites
2) place the tga's in [CtP2 folder]\ctp2_data\default\graphics\graphics
3) edit [CtP2 folder]\ctp2_data\default\gamedata\spriteID.txt. E.g. if you have a Chariot unit add the line UNIT_CHARIOT2 100. Both the UNIT-name and the number need to be unique and the number needs to be the same as the number as the sprite (same as in CtPI). So in my example you'd need to call you sprite 'Gu100.spr'.
4) edit [CtP2 folder]\ctp2_data\default\gamedata\uniticon.txt. For my Chariot example it might look like this (I copied this for 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" }
5) Then add the appriopriate texts to the bottom of [CtP2 folder]\ctp2_data\english\gamedata\Great_Library.txt. Example:
Code:[UNIT_CHARIOT_PREREQ] Requires: < L : DATABASE_ADVANCES,ADVANCE_THE_WHEEL > The Wheel < e > [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 < L : DATABASE_UNITS,UNIT_ELEPHANT_WARRIOR > War Elephant < e > . Also, it's a flanking unit so it can provide support to other units during combat.[END] [UNIT_CANNON_HISTORICAL] The Chariot was one of the most important Cavalry units of the Ancient Age. [END]
6) Add an entry to [CtP2 folder]\ctp2_data\default\gamedata\Units.txt. It might look like this:
Code:## UNIT 100 UNIT_CANNON { 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_KNIGHT SoundSelect2 SOUND_SELECT2_KNIGHT SoundMove SOUND_MOVE_KNIGHT SoundAcknowledge SOUND_ACKNOWLEDGE_KNIGHT SoundCantMove SOUND_CANTMOVE_KNIGHT SoundAttack SOUND_ATTACK_KNIGHT SoundWork SOUND_WORK_KNIGHT SoundVictory SOUND_VICTORY_KNIGHT SoundDeath SOUND_DEATH_KNIGHT CanAttack: Land CanSee: Standard MovementType: Land Size: Medium VisionClass: Standard CanReform { Sound SOUND_ID_REFORM_CITY Effect SPECEFFECT_REFORMCITY } } ############################################################
Hope that helps in any way,
Locutus
[This message has been edited by Locutus (edited November 18, 2000).]
-
All right. I tried it and *almost* succeeded. I got a couple of error messages. The first said that the unit description string was missing. I filled out another section of a text file to stop that error (apparently this part wasn't necessary in CTP1, as I don't see it in any of the old mods). The second time, I got it to load despite an error message that "sprite not in sprite database". I wasn't sure how to fix that since the sprite was in the right directory and referenced properly in "spriteid.txt", but the game allowed me to continue. However, once I tried to use my new unit the game showed me a brief picture of it and (inexplicably) completely crashed...
I'll keep toying with it and see if I can figure out what else I need to change... I feel like I'm close.
Comment
-
Eureka!
Never mid. I figured it out. Sprite referneces in CTP2 are not to be made in SpriteID.txt. This will cause an error message. Sprite references should now be made in the the file newsprite.txt, which is also located in the "gamedata" directory and looks very similar in content. Apparently, they've devised a separate location for adding new units.
Subtle diffenrece...
Comment
-
Great!
That's very good to hear. Now if you could just tell us how exactly you solved that first error (what section of what text file you changed), that would be a great help to other people trying to add units to the game.
Comment
-
The text file error is caused by an invalid reference in the DESCRIPTION section of the units.txt file. (The first line of any unit). To make it work, I had to reference an already existing description. For instance, for my legion unit I had to use the same description as the swordsman:
Description DESCRIPTION_UNIT_SWORDSMAN
I'm sure there's a way to create your own descriptions, but I haven't figured it out yet.
Comment
Comment