Announcement

Collapse
No announcement yet.

Step By Step Guide To Add A Unit?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Step By Step Guide To Add A Unit?

    anyone??

  • #2
    Well, I already described it in another thread in this forum but I admit it was a bit rough, so let me try again:

    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) Nown add the appriopriate texts to english\gamedata\Great_Library.txt. Example:


    Requires:
    ATABASE_ADVANCES,ADVANCE_THE_WHEEL%gt The Wheel

    [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 ATABASE_UNITS,UNIT_ELEPHANT_WARRIOR>War Elephant. 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]


    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.
    [This message has been edited by Locutus (edited November 24, 2000).]
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #3
      I recently tried adding some of the units that were already provided in the Alexander the Great Scenario to the standard game. I followed all the steps you gave,except I skipped the great library, but when I loaded it crashed and said the sprites didn't exist. I tried putting it in scenario format, by the way. Next, I put all the sprites in the correct place in the scenario folder, but it still wouldn't load. Can anyone tell me what I did wrong?????
      "It is ridiculous claiming that video games influence children. For instance, if Pac-Man affected kids born in the 80's we should by now have a bunch of teenagers who run around in darkened rooms and eat pills while listening to monotonous electronic music."

      Comment


      • #4
        Sprites for the special units that are part of the shipped scenarios are stored in the standard game section, not the scenario section. I haven't looked in to how they did this, yet. Perhaps someone who wants to dig out those werewolves will take the time to figure it out. To summarize: there are no sprites in the shipped scenario folders, and that is why you are getting your error message.

        I have found out a few things working with inserting units from ctp1:
        1)The sound files for Attack, Move and Death are included in Ctp2, but not the other sounds, apparently.
        You need to go into the Ctp1 sounds.txt, and copy the appropriate lines into your Ctp2 scenario sounds.txt.
        If you wanted to use other types of sounds from Ctp1, you could copy the sound files into your scenario as well, but the most important ones are already in there.
        2)The tgas for the Ctp1 units are apparently NOT in Ctp2, or they have different names if they are. We need to get one of the Activisioners to explain this for us. This is bad because the Ctp1 tgas are all in one enormous file in the Ctp1 pictures folder, which can't be opened by standard programs, as far as I know.
        3)Tga sizes are different for the small icon pics in Ctp2. The large icons from the Ctp1 units will work fine. The small pics for Ctp2 have the same size ratios as the large pics, so you can simply take the large pics, and resize them to the appropriate sizes. The size of the "a" pic is 32x24, and that of the "b" pic is 24x18. (That of the large pic is 160x120.)
        4)I finally figured out the relationship between spriteID and newsprite. Basically, newsprite trumps spriteID. This means if both files have the same unit listed, the game will use the sprite number listed in newsprite.
        Also, their are two sets of sprites in the game. One set is labeled GU08, for example, and the other GU008. The first set is the Ctp1 sprites, and the second set the Ctp2 sprites. Like the sprite files, the second set trumps the first set. Thus, if newsprite refers to a sprite 8, the game looks in the sprites folder for GU08, which MUST be there. Then, the game checks for GU008. If it finds a GU008, then it uses this sprite in the game rather than GU08.
        To use one of the included Ctp1 sprites in the game, you need to copy the sprite out of the standard folder and place it into your scenario folder. There, you need to either:
        1)re-name it to the Ctp2-system name that you choose (with a zero in front) if you wanted it to replace a ctp2 sprite, or
        2)re-name it to an unused sprite number, using the Ctp1 system. (Note that GU28 cannot be used, since there is a Ctp2 sprite of an Artillery piece named GU028 that was not used in the game. This sprite may be used for mods, however.)

        This same naming system is used to add user-created sprites as well.
        [This message has been edited by WesW (edited December 23, 2000).]

        Comment


        • #5
          Chris,
          Sorry for the late reply but I've been offline a while. Email me your scenario folder and I'll see if I can solve your problem.
          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

          Comment


          • #6
            WHERE DO YOU GET THE SPRITES AND TGAs FROM???
            "Nothing exists except atoms and empty space; everything else is opinion"
            -Democritus of Abdera

            Comment


            • #7
              ThaddeusAlexander,

              Don't yell like that, I hear you fine.
              You can either get them from the CtPI download-section of Apolyton, use existing ones from CtPII (or CtPI, they are included in CtPII, only the TGAs seem to be missing) or make them yourself
              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

              Comment


              • #8
                Sorry, I've been off a while , 2. my problem was i used spriteID, not newsprite. But now I have an even fishier problem. The game loads, but it can't find the english side. For instance, in the build queue, rather than saying Legion, it says: UNIT_LEGION.
                I have gl_str all done in the right format.
                "It is ridiculous claiming that video games influence children. For instance, if Pac-Man affected kids born in the 80's we should by now have a bunch of teenagers who run around in darkened rooms and eat pills while listening to monotonous electronic music."

                Comment


                • #9
                  This post moved up and merged with my earlier post.
                  [This message has been edited by WesW (edited December 23, 2000).]

                  Comment


                  • #10
                    What does the file Units_release.txt do? Anything?

                    I was curious what I was pointing to when I copied the line that reads

                    Description DESCRIPTION_UNIT_WARRIOR

                    So I did a search on DESCRIPTION_UNIT_WARRIOR

                    That string shows up in units.txt, units_historical.txt, units_release.txt and junk_str.txt. But in everycase it seems that the string is something that is being pointed to, not something that is defined. So I'm still curious as to what it does, if anyone knows?

                    I went to Units_release.txt to find the string. What I found instead made me wonder what this file is. Here's what I found in Units_release.txt. It looks like an whole 'nother definition of the unit similar to units.txt

                    UNIT_WARRIOR {
                    SHIELD_COST 135
                    POWER_POINTS 100
                    MAX_HP 10
                    ATTACK 10
                    DEFENSE 10
                    FIREPOWER 2
                    ZB_RANGE_ATTACK 0

                    BATTLEFIELD_RANGE 1
                    BATTLEFIELD_RADIUS 1

                    VISION_RANGE 2

                    ACTIVE_DEFENSE_RANGE 0
                    ELECTRONIC_COMBAT_FACTOR 0

                    MAX_MOVEMENT 100
                    FUEL 0

                    SHIELD_HUNGER 4.05
                    FOOD_HUNGER 0

                    DEFAULT_SPRITE SPRITE_WARRIOR
                    DEFAULT_ICON ICON_UNIT_WARRIOR
                    DESCRIPTION DESCRIPTION_UNIT_WARRIOR
                    # #id string of the default sprite

                    SOUND_SELECT1 SOUND_SELECT1_WARRIOR
                    SOUND_SELECT2 SOUND_SELECT2_WARRIOR
                    SOUND_MOVE SOUND_MOVE_WARRIOR
                    SOUND_ACKNOWLEDGE SOUND_ACKNOWLEDGE_WARRIOR
                    SOUND_CANTMOVE SOUND_CANTMOVE_WARRIOR
                    SOUND_ATTACK SOUND_ATTACK_WARRIOR
                    SOUND_WORK SOUND_WORK_WARRIOR
                    SOUND_VICTORY SOUND_VICTORY_WARRIOR
                    SOUND_DEATH SOUND_DEATH_WARRIOR
                    ENABLING_ADVANCE ADVANCE_TOOLMAKING
                    OBSOLETE_ADVANCE ADVANCE_BUREAUCRACY
                    OBSOLETE_ADVANCE ADVANCE_NATIONALISM
                    ############## special flags #############################
                    MOVEMENT_TYPE_LAND
                    MOVEMENT_TYPE_MOUNTAIN
                    LOSS_MOVE_TO_DMG_NONE
                    SIZE_SMALL


                    VISIBILITY_CLASS_0

                    VISIBILITY_CAN_SEE_0

                    EXERTS_MARTIAL_LAW

                    CAN_EXPEL_POP
                    DEATH_EFFECTS_HAPPY
                    CAN_REFORM SOUND_ID_REFORM_CITY SPECEFFECT_REFORMCITY
                    CAN_PILLAGE
                    CAN_EXPEL
                    CAN_PIRATE

                    CHEAT_INDEX 1
                    }

                    ### UNIT DONE ###
                    Fear not the path of truth for the lack of others walking it.

                    Comment


                    • #11
                      units_release.txt and units_historic.txt are two of those left-ov er files from CTP1 that was never deleted. They don't do anything.

                      The DECRIPTION_ flag doesn't do anything either, at least it didn't in CTP1.

                      Comment


                      • #12
                        I followed the instructions for adding a unit, and I get an error message that I am missing the following entries in the following fields in the units.txt

                        Attack
                        Defense
                        ZBRangeAttack
                        Firepower

                        and so forth...

                        I get the same error messages when I also try to add a government, only I get the error message in the govern.txt.

                        Any input???
                        Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
                        ...aisdhieort...dticcok...

                        Comment


                        • #13
                          Most likely you forgot a { or } or you put a space in one of the unit flags. I can't say more without knowing exactly what you changed.

                          Comment


                          • #14
                            I had the same problem as Hexagonian. If anybody comes up with a solution, please post it. I know I had all my brackets, rechecked instructions like 5 times but the same crash and error message happens each time.

                            Comment


                            • #15
                              Basically, I would cut and paste a duplicate section (in govern.txt for example, highlight and select Monarchy and paste it within the document), select only the text I was going to change and then change it. I checked the spacing between each of the sections too.

                              This one has got me stymied...
                              [This message has been edited by hexagonian (edited December 24, 2000).]
                              Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
                              ...aisdhieort...dticcok...

                              Comment

                              Working...
                              X