Announcement

Collapse
No announcement yet.

[Utility] UnitsCSV v.1

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Utility] UnitsCSV v.1

    This program will convert the Units.txt file into .csv format and back again. This allows you to edit units in a spreadsheet, which is much easier.

    I've just finished writing the program and there are still some (spacey) formatting issues with the outputted Units.txt file, but it appears to be fully functional. Needless to say, comments do not survive the transition.

    Usage: Stick the UnitsCSV.exe file in the same folder as the Units.txt file. Run UnitsCSV.exe and you will be presented with a menu that will let you chose to create the .csv file or the .txt file.

    In the spreadsheet you'll notice a whole bunch of capitol N's. These indicate a new line appears after that entry. if you add new entry's yourself, don't forget the N!

    Blank cells should be ignored by the program, but i have not tested this extensively.

    If you use OpenOffice, make sure to delete the ' " ' in the "Text delimiter" box when you first load the file. Or bad things will happen. You have been warned!

    Good luck and Good night.
    Attached Files
    Last edited by EPW; May 14, 2009, 18:28.
    "

  • #2
    Does it also work with other database files?

    And by the way, why don't you upload it to our new file database? Our new file database allows the upload of files like the forum does which attachments. Unfortunately it inherits the file size limits from the forums. But you can use it like a post just copy some description into it. Upload the file and an image, probably a snapshot from your program. Image size doesn't matter the database takes care on that. And no-one has to approve your link.

    -Martin
    Civ2 military advisor: "No complaints, Sir!"

    Comment


    • #3
      I haven't explored it fully yet but it looks very useful EPW
      Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
      CtP2 AE Wiki & Modding Reference
      One way to compile the CtP2 Source Code.

      Comment


      • #4
        Version .11 uploaded with fixed indentation of the {'s. Purely hygienic fix.
        "

        Comment


        • #5
          Originally posted by Martin Gühmann View Post
          Does it also work with other database files?
          No, maybe in time.

          Originally posted by Martin Gühmann View Post
          And by the way, why don't you upload it to our new file database? Our new file database allows the upload of files like the forum does which attachments. Unfortunately it inherits the file size limits from the forums. But you can use it like a post just copy some description into it. Upload the file and an image, probably a snapshot from your program. Image size doesn't matter the database takes care on that. And no-one has to approve your link.
          -Martin
          I may when its done. I'm currently rewriting it so it puts all the "tags" in the top row and the "argument" listed below it. As it is now it goes:
          Column A Column B
          Attack 30
          .
          .
          .
          Attack 15

          And I'm trying to change it to:

          Column A
          Attack
          15
          .
          .
          35
          .
          .
          20
          "

          Comment


          • #6
            Progress so far. I'm not sure how I am going to deal with "Abilities" though.


            By badfuzzy at 2009-05-16
            "

            Comment


            • #7
              Looks a lot better so far
              Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
              CtP2 AE Wiki & Modding Reference
              One way to compile the CtP2 Source Code.

              Comment


              • #8
                More progress! Now I have to rewrite the CSV to TXT code.
                Attached Files
                "

                Comment


                • #9
                  Its finished!

                  I still need to finish adding all the unit abilities to the new .cfg file, which is very dull and may take a while.
                  Last edited by EPW; May 21, 2009, 09:01.
                  "

                  Comment


                  • #10
                    Here's the list I have so far. If one of them repeats, its because they can appear more than one time in a unit. Please tell me any I have missed so far:

                    Code:
                    #A "s" means it has an attribute listed after it, a "t" means it doesn't. 
                    #An "a" means its an ability and attributes in brackets come after it. 
                    #Ability attributes start with an "a" and are follewed by an "s" or a "t"
                    Attack s
                    Defense s
                    ZBRangeAttack s
                    Firepower s
                    Armor s
                    MaxHP s
                    MaxMovePoints s
                    VisionRange s
                    ShieldCost s
                    PowerPoints s
                    ShieldHunger s
                    GoldHunger s
                    FoodHunger s
                    MaxFuel s
                    ActiveDefenseRange s
                    ActiveDefenseOnlyWhenCarryingEnablers t
                    BombRounds s
                    BombardRange s
                    Civilian t
                    LossMoveToDmgNone t
                    IgnoreZOC t
                    NoZoc t
                    NoFuelThenCrash t
                    CanBeExpelled t
                    CanEntrench t
                    CanExpel t
                    CanBeSued t
                    CanPillage t
                    CanPirate t
                    CantCaptureCity t
                    ExertsMartialLaw t
                    DeathEffectsHappy t
                    ParatrooperTransport t
                    Explodes t
                    NoSlaves t
                    IsSpecialForces t
                    IsTelevangelist t
                    IsFlanker t
                    IsTrader t
                    CanAttack: s
                    CanAttack: s
                    CanAttack: s
                    CanAttack: s
                    CanAttack: s
                    CanCarry: s
                    CanCarry: s
                    CanCarry: s
                    CanBombard: s
                    CanBombard: s
                    CanBombard: s
                    Defend: s
                    Defend: s
                    CanSee: s
                    CanSee: s
                    CanSee: s
                    CanSee: s
                    CanSee: s
                    MovementType: s
                    MovementType: s
                    MovementType: s
                    Size: s
                    VisionClass: s
                    EnableAdvance s
                    EnableAdvance s
                    ObsoleteAdvance s
                    ObsoleteAdvance s
                    ObsoleteAdvance s
                    UpgradeTo s
                    UpgradeTo s
                    UpgradeTo s
                    UpgradeTo s
                    Description s
                    DefaultIcon s
                    DefaultSprite s
                    Category s
                    SoundSelect1 s
                    SoundSelect2 s
                    SoundMove s
                    SoundAcknowledge s
                    SoundCantMove s
                    SoundAttack s
                    SoundWork s
                    SoundVictory s
                    SoundDeath s
                    CanReform a
                    CargoData a
                    SlaveUprising a
                    UndergroundRailway a
                    CanSoothsay a
                    CauseUnhappiness a
                    ConvertCities a
                    IndulgenceSales a
                    InciteRevolution a
                    InvestigateCity a
                    PlantNuke a
                    StealTechnology a
                    #The following are attributes associated with abilities, best to leave them at the end
                    Chance as
                    EliteChance as
                    EscapeChance as
                    DeathChance as
                    RandomChance as
                    SpecificChance as
                    Timer as
                    Amount as
                    Sound as
                    I'll be back in a while.
                    "

                    Comment


                    • #11
                      v1.0

                      Okay, here's version 1.0. Ive tested it on the vanilla units.txt, Maq's Red Front units.txt and Cradle II units.txt.

                      I know I am still missing some tags in the config file, because the converted units.txt file comes out to be about 3% smaller than the original. So I won't release a "final" version until I know its converting everything. I hope that you, the people(ie Maq), will help me find the missing ones.
                      Attached Files
                      "

                      Comment


                      • #12
                        Here's part of the Cradle II units.txt converted to csv format:
                        Attached Files
                        "

                        Comment


                        • #13
                          Originally posted by EPW View Post
                          Okay, here's version 1.0. Ive tested it on the vanilla units.txt, Maq's Red Front units.txt and Cradle II units.txt.

                          I know I am still missing some tags in the config file, because the converted units.txt file comes out to be about 3% smaller than the original. So I won't release a "final" version until I know its converting everything. I hope that you, the people(ie Maq), will help me find the missing ones.
                          Some I can't find:

                          CanCounterBombard
                          CivilisationOnly (e.g. "CivilisationOnly GERMAN")
                          DefendAgainstSpies (e.g. "DefendAgainstSpies 0.25")
                          GovernmentType (e.g. "GovernmentType GOVERNMENT_THEOCRACY")
                          MoveBonus (e.g. "MoveBonus 33")

                          Here's some from the AE readme:

                          NeedsFeatToBuild Unit needs feat archived by owner to be built.

                          NeedsAnyPlayerFeatToBuild Unit needs feat archived by any player to be built.

                          ProducesEnergy Unit generates energy
                          EnergyHunger Unit consumes energy

                          ExcludedByWonder Unit cannot be built with this wonder.
                          PrerequisiteWonder Unit needs a certain wonder to be built.

                          HostileTerrainCost Unit loses HitPoints in hostile terrain.
                          ImmuneToHostileTerrain Unit is immune to costs of hostile terrain.

                          SettleImprovement Unit finishes with enough PW tileimps when entrenched.
                          SettleBuilding Unit builds building in a foreign city on conversion.

                          CanHarvest Unit that can entrench adds terrain gold to treasury.
                          TargetsCivilians Unit bombard civilians instead other units.
                          PrecisionStrike Unit bombards buildings instead other units.
                          MultipleAttack Unit can attack repeatedly per turn with enough MPs.
                          CanCaptureTile Unit captures an enemy tile instead of pillaging it.

                          CanBeGifted Unit can be gifted to a non-enemy player. A diplomatic
                          regard bonus is awarded. It is based on attack divided
                          by five. (The five should go to ConstDB or DiffDB or
                          CivilisationDB, etc.)

                          ObsoleteUnit Unit it is obsolete by another unit instead by a tech.

                          GoldHunger Unit needs this amount of gold per turn as support.
                          GoldPerUnitSupport Should be the same as above. (No idea what the difference is)

                          GoodyHutExcluded Unit cannot be gained from a goody hut.

                          PopCostsToBuild Unit costs a city these number of population points.
                          A city disband warning is still missing.

                          NeedsCityGoodAll Unit needs all the goods in that list to be built.
                          NeedsCityGood Unit can only be built with this good in the city.
                          NeedsCityGoodAnyCity Unit can only be built if a city in the empire has a
                          certain good.

                          Sneakattack Unit can attack without war being declared.
                          Sneakbombard Unit can bombard without war being declared.
                          CanBombardTiles Unit can bombard tileimps and destroy them.
                          CollateralTileDamage Unit destroys tileimps at attack location.
                          NonLethalBombard Unit bombard only weakens other units.
                          Then there is a bunch of specific unit type battle modifiers, as you can imagine all the ones with "bonus" require a value after them, the rest are just flags. These are the defence/counter-attack modifiers:

                          IsFoot
                          FootBonus (e.g. "FootBonus 0.5" is +50% against a unit with the flag "IsFoot")
                          IsSiege
                          SiegeBonus
                          IsWheeled
                          WheeledBonus
                          IsMechanized
                          MechanizedBonus
                          IsHelicopter
                          HelicopterBonus
                          IsGuerrilla
                          GuerrillaBonus
                          CivilianBonus
                          SpecialForcesBonus
                          IsMounted
                          MountedBonus
                          AirBonus

                          and the attack bonuses and flags:

                          WoodenShip
                          AttackWoodenShipBonus (this is just a flag with no value after it, WoodenShipBonus is where the bonus is given, I'm not sure if this is required but it does exist in the vanilla units.txt)
                          WoodenShipBonus
                          AttackCityBonus
                          IsSubmarine
                          AttackBonusSubmarine (bonus here)

                          And "Defend" can have 5 possible, "Defend: Air/Land/Mountain/Water/Space". Same for CanBombard.

                          Also "Settle: Land/Water/Mountain/Space".

                          CanCarry:

                          #define k_Unit_CanCarry_SmallLand_Bit 0x00000001
                          #define k_Unit_CanCarry_MedLand_Bit 0x00000002
                          #define k_Unit_CanCarry_LargeLand_Bit 0x00000004
                          #define k_Unit_CanCarry_SmallAir_Bit 0x00000008
                          #define k_Unit_CanCarry_MedAir_Bit 0x00000010
                          #define k_Unit_CanCarry_LargeAir_Bit 0x00000020
                          #define k_Unit_CanCarry_SmallWater_Bit 0x00000040
                          #define k_Unit_CanCarry_MedWater_Bit 0x00000080
                          #define k_Unit_CanCarry_LargeWater_Bit 0x00000100
                          #define k_Unit_CanCarry_SmallSpace_Bit 0x00000200
                          #define k_Unit_CanCarry_MedSpace_Bit 0x00000400
                          #define k_Unit_CanCarry_LargeSpace_Bit 0x00000800
                          MovementType:

                          #define k_Unit_MovementType_Land_Bit 0x00000001
                          #define k_Unit_MovementType_Sea_Bit 0x00000002
                          #define k_Unit_MovementType_Air_Bit 0x00000004
                          #define k_Unit_MovementType_Mountain_Bit 0x00000008
                          #define k_Unit_MovementType_Trade_Bit 0x00000010
                          #define k_Unit_MovementType_ShallowWater_Bit 0x00000020
                          #define k_Unit_MovementType_Space_Bit 0x00000040
                          CanAttack:

                          #define k_Unit_CanAttack_Land_Bit 0x00000001
                          #define k_Unit_CanAttack_Sea_Bit 0x00000002
                          #define k_Unit_CanAttack_Air_Bit 0x00000004
                          #define k_Unit_CanAttack_Mountain_Bit 0x00000008
                          #define k_Unit_CanAttack_Trade_Bit 0x00000010
                          #define k_Unit_CanAttack_ShallowWater_Bit 0x00000020
                          #define k_Unit_CanAttack_Space_Bit 0x00000040
                          #define k_Unit_CanAttack_Underwater_Bit 0x00000080
                          There may be others in UnitRecord.h not here, but these I got from a quick scan of it.
                          Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                          CtP2 AE Wiki & Modding Reference
                          One way to compile the CtP2 Source Code.

                          Comment


                          • #14
                            Thanks Maq.

                            I'm still losing about 2% in file size from the conversion, I hope its due to left out spaces within the unit brackets.

                            Code:
                            #A "s" means it has a value listed after it, a "t" means it doesn't. 
                            #An "a" means its an ability and flags in brackets come after it. 
                            #Ability flags start with an "a" and are follewed by an "s" or a "t"
                            Attack s
                            Defense s
                            ZBRangeAttack s
                            Firepower s
                            Armor s
                            MaxHP s
                            MaxMovePoints s
                            VisionRange s
                            ShieldCost s
                            PowerPoints s
                            ShieldHunger s
                            GoldHunger s
                            FoodHunger s
                            MaxFuel s
                            ActiveDefenseRange s
                            ActiveDefenseOnlyWhenCarryingEnablers t
                            BombRounds s
                            BombardRange s
                            DefendAgainstSpies s
                            GovernmentType s
                            MoveBonus s
                            NeedsFeatToBuild s
                            NeedsAnyPlayerFeatToBuild s
                            ProducesEnergy s
                            EnergyHunger s
                            ExcludedByWonder s
                            PrerequisiteWonder s
                            HostileTerrainCost s
                            SettleImprovement s
                            SettleBuilding s
                            PopCostsToBuild s
                            NeedsCityGoodAll t
                            NeedsCityGoodAnyCity t
                            NeedsCityGood s
                            GoodyHutExcluded t
                            CanHarvest t
                            TargetsCivilians t
                            PrecisionStrike t
                            MultipleAttack t
                            CanCaptureTile t
                            CanBeGifted t
                            CanBombardTiles t
                            CollateralTileDamage t
                            NonLethalBombard t
                            ImmuneToHostileTerrain t
                            Civilian t
                            LossMoveToDmgNone t
                            IgnoreZOC t
                            NoZoc t
                            NoFuelThenCrash t
                            Sneakattack t
                            Sneakbombard t
                            CanBeExpelled t
                            CanEntrench t
                            CanExpel t
                            CanBeSued t
                            CanPillage t
                            CanPirate t
                            CanCounterBombard t
                            CantCaptureCity t
                            ExertsMartialLaw t
                            DeathEffectsHappy t
                            ParatrooperTransport t
                            OnlyBuildOne t
                            Explodes t
                            NoSlaves t
                            GLHidden t
                            NoIndex t
                            NeedsNoSupport t
                            CantBuild t
                            HasPopAndCanBuild t
                            CivilisationOnly s
                            CityGrowthCoefficient s
                            IsSpecialForces t
                            IsTelevangelist t
                            IsFlanker t
                            IsTrader t
                            IsFoot t
                            FootBonus s
                            IsSiege t
                            SiegeBonus s
                            IsWheeled t
                            WheeledBonus s
                            IsMechanized t
                            MechanizedBonus s
                            IsHelicopter t
                            HelicopterBonus s
                            IsGuerrilla t
                            GuerrillaBonus s
                            CivilianBonus s
                            SpecialForcesBonus s
                            IsMounted t
                            MountedBonus s
                            AirBonus s
                            WoodenShip t
                            AttackWoodenShipBonus t
                            WoodenShipBonus s
                            AttackCityBonus s
                            IsSubmarine t
                            AttackBonusSubmarine s
                            CanAttack: s
                            CanAttack: s
                            CanAttack: s
                            CanAttack: s
                            CanAttack: s
                            CanAttack: s
                            CanCarry: s
                            CanCarry: s
                            CanCarry: s
                            CanCarry: s
                            CanCarry: s
                            CanCarry: s
                            CanBombard: s
                            CanBombard: s
                            CanBombard: s
                            CanBombard: s
                            CanBombard: s
                            CanBombard: s
                            Defend: s
                            Defend: s
                            Defend: s
                            Defend: s
                            Defend: s
                            CanSee: s
                            CanSee: s
                            CanSee: s
                            CanSee: s
                            CanSee: s
                            MovementType: s
                            MovementType: s
                            MovementType: s
                            MovementType: s
                            MovementType: s
                            MovementType: s
                            Size: s
                            VisionClass: s
                            EnableAdvance s
                            EnableAdvance s
                            ObsoleteAdvance s
                            ObsoleteAdvance s
                            ObsoleteAdvance s
                            ObsoleteUnit s
                            UpgradeTo s
                            UpgradeTo s
                            UpgradeTo s
                            UpgradeTo s
                            Description s
                            DefaultIcon s
                            DefaultSprite s
                            Category s
                            SoundSelect1 s
                            SoundSelect2 s
                            SoundMove s
                            SoundAcknowledge s
                            SoundCantMove s
                            SoundAttack s
                            SoundWork s
                            SoundVictory s
                            SoundDeath s
                            CanReform a
                            CargoData a
                            SlaveUprising a
                            UndergroundRailway a
                            CanSoothsay a
                            CanInjoin a
                            CauseUnhappiness a
                            ConvertCities a
                            CreateFranchise a
                            CreateParks a
                            IndulgenceSales a
                            InciteRevolution a
                            InvestigateCity a
                            PlantNuke a
                            StealTechnology a
                            BioTerror a
                            NanoTerror a
                            Plague a
                            AssasinateRuler a
                            #The following are attributes associated with abilities, best to leave them at the end
                            Chance as
                            EliteChance as
                            EscapeChance as
                            DeathChance as
                            RandomChance as
                            SpecificChance as
                            Timer as
                            Amount as
                            Sound as
                            Effect as
                            MaxCargo as
                            Load as
                            Unload as
                            "

                            Comment


                            • #15
                              BTW, if you add the right tags to the .cfg file, I believe this will work with buildings.txt and advance.txt as well.
                              "

                              Comment

                              Working...
                              X