Thread Tools
Old November 18, 2000, 02:56   #1
Frugal_Gourmet
Warlord
 
Local Time: 04:40
Local Date: October 31, 2010
Join Date: Dec 1969
Location: New York City, NY, USA
Posts: 158
Anyone figured out units yet?
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?
Frugal_Gourmet is offline  
Old November 18, 2000, 09:56   #2
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 11:40
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
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]
Edit: I had to change this a little 'cause the script was screwing everything up but you can look at the other entries of the Great_Library file yourself and do it properly.

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
   }
}

############################################################
Now start up the game and prey it works (Yes, it's quite a process, but once you get the hang of it, it probably won't be too difficult or time-consuming).

Hope that helps in any way,

Locutus
[This message has been edited by Locutus (edited November 18, 2000).]
Locutus is offline  
Old November 18, 2000, 15:34   #3
Frugal_Gourmet
Warlord
 
Local Time: 04:40
Local Date: October 31, 2010
Join Date: Dec 1969
Location: New York City, NY, USA
Posts: 158
Wow, thanks alot. I will try that and see if it works!

Frugal_Gourmet is offline  
Old November 18, 2000, 16:25   #4
Frugal_Gourmet
Warlord
 
Local Time: 04:40
Local Date: October 31, 2010
Join Date: Dec 1969
Location: New York City, NY, USA
Posts: 158
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.

Frugal_Gourmet is offline  
Old November 18, 2000, 16:32   #5
Frugal_Gourmet
Warlord
 
Local Time: 04:40
Local Date: October 31, 2010
Join Date: Dec 1969
Location: New York City, NY, USA
Posts: 158
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...
Frugal_Gourmet is offline  
Old November 19, 2000, 11:18   #6
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 11:40
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
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.


Locutus is offline  
Old November 19, 2000, 17:57   #7
Frugal_Gourmet
Warlord
 
Local Time: 04:40
Local Date: October 31, 2010
Join Date: Dec 1969
Location: New York City, NY, USA
Posts: 158
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.
Frugal_Gourmet is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:40.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team