Announcement

Collapse
No announcement yet.

Goods and Trade.

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

  • Goods and Trade.

    Wondering if someone can help with syntax and other questions on goods.

    I know HasGood(location) returns the good number (0-3) for a good or -1 if there is no good. Is there syntax that would identify the specific good there, ie, instead of LAND_GOOD_ONE(returns 0) on a plain, identify Buffalo?

    From goods.txt
    # Rubies #0
    TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE {
    SpriteID 18
    Sound SOUND_ID_RUBIES
    Gold 1
    Food 10
    Production 10
    Probability 0.25
    Icon ICON_GOOD_ARCTIC_MOUNTAIN_ONE
    }

    What does "GOLD" do, what happens if you change it from 1 to something else?

    "Probability 0.25"
    Presume this means 1 in 4 chance that goods on Arctic Mountain will be "ONE", ie Rubies.

    From goodsID.txt
    "87
    TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE 18 # "Rubies""
    I presume the first number(87) is the number of sprites?
    Second no (18) is the goods sprite id no?


    Thanks for any help.

  • #2
    The HasGood function returns the database index of the good.

    I don't know what gold does, but I think it should be 1, Production and Commerce do nothiong at least in Activision's version of the game. My guess it was supposesd to add a terrain bonus to the underlying terrain.

    The first number in goodsID.txt is the number of entries. The other numbers are sprite IDs, but I think this file is not used in CTP2 it is a leftover from CTP1, however I did not tested this, I just filled this file and left the issure alone. Fact is that there is also a dsprite flag in Goods.txt. The probability for goods of one terrain has to be one at maximum.

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

    Comment


    • #3
      "The HasGood function returns the database index of the good." Posted by Martin.

      I thought it only returned 0-3 for the good type ,eg Landclass Good 1 would return a "0". Good 2 a "1". etc.

      Wheres the database index? Cant say I have seen anything that gives each good an id number, except in Goodmod.

      Thanks.

      Comment


      • #4
        Except of course Goods.txt.

        Are you saying Martin that if I use HasGood on a desert tile with oil, it will return 5, the number in CRA_Goods.txt, which I am using now?

        Comment


        • #5
          The probability for goods of one terrain has to be one at maximum.
          I noticed that you dont need to have it equal 1 from the whole goods on one tile, but say if you put:

          Code:
           # Cotton/Flax
          TERRAIN_GRASSLAND_GOOD_ONE {
             SpriteID 5
             Sound SOUND_ID_COTTON
             Gold 1
             Probability 1
             Icon ICON_GOOD_GRASSLAND_ONE
          }
          
          # Tobacco
          TERRAIN_GRASSLAND_GOOD_TWO {
             SpriteID 21
             Sound SOUND_ID_TOBACCO
             Gold 1
             Probability 1
             Icon ICON_GOOD_GRASSLAND_TWO
          which is probability 1 for both, it will always use the first one in the goods.txt (cotton/flax) and ignore the other one. Not very useful information just something i noticed messing with goodmod.
          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


          • #6
            Originally posted by stankarp
            Except of course Goods.txt.

            Are you saying Martin that if I use HasGood on a desert tile with oil, it will return 5, the number in CRA_Goods.txt, which I am using now?
            The database index is given by the order of the entries you find in goods.txt, I added these indices in the comments to GM1_Goods.txt, so that I don't need to count the entries everytime I hardencode an Good index into slic everytime, of course instead of hardencoding the indices you could also use the ResourceDB function to get the index of a certain good:

            Code:
            int_t anIndex;
            anIndex = ResourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE);
            anIndex should after the execution of that piece of code the value 0.

            Originally posted by Maquiladora
            which is probability 1 for both, it will always use the first one in the goods.txt (cotton/flax) and ignore the other one. Not very useful information just something i noticed messing with goodmod.
            That's right and therefore you can have so many goods for a terrain so that the total summed up probability is greater than 1. Of course you can also have a total summed up probability less then 1. In the second case this is not a problem, but it is a problem in the first case, and therefore the maximum total probability is 1 given you want that the game places all the goods onto the map.

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

            Comment


            • #7
              Just checking then, if I use HasGood, it will return 0-3 on a good depending on its class, eg Landgood class 1 would be 0.

              If I use anIndex, I can get the exact number of the good from the Resource DB.
              "int_t anIndex;
              anIndex = ResourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE);
              If(anIndex=0){
              do stuff}
              That be the right syntax?

              I was thinking ahead how to get round the 0-3 from HasGood by re-organising the goods so that class 1 is all the luxury type goods, 2 and 3 strategic types and 4 other types. With the help of IW and Peter Triggs I have created a new unit (migrant) and new tile, colony. Among other things the migrant can disband and create a watch tower that also extends borders like a fort. The colony is a normal improvement except it returns 10 gold to the owner each turn. This doubles if this is on any good. The next step is to adjust happiness if it is on a luxury good. By grouping the classes I can just use HasGood, 0 = a luxury good.

              However, using the index to get the exact type is very useful.

              Thanks.

              Comment


              • #8
                Just checking again ,
                is this the right syntax to use anIndex?

                "int_t anIndex;
                anIndex = ResourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE);
                If(anIndex=5){
                do stuff}

                Comment


                • #9
                  Generally you want to use this index business when you want to cycle through the whole file/database. So you might have something like:

                  Code:
                  for (index=0;index<42;index=index+1){ // 42 should be the number of types in goods.txt
                      if (index == resourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_ONE){ //TRUE when i==0
                           //do stuff
                      }
                      if (index == resourceDB(TERRAIN_ARCTIC_MOUNTAIN_GOOD_TWO){ //TRUE when i==1
                  	    //do stuff
                      }
                      // and so on
                  }
                  Did that special effects thing work? A timer is the last resort.

                  Comment


                  • #10
                    Thanks Peter :-)))))

                    Comment


                    • #11
                      Trying the speceffects thing tonight.

                      Comment


                      • #12
                        Couple of questions re goods please.

                        Is there a limit of 68 goods in the game. I started getting a DataBase error that I could not figure out until I, eventually, deleted my last good no 69 and all references to it in unitcon, gl strings, terrain.txt etc. Then the errors stopped.

                        When you right click on a good, where is the name of the good held, ie the string name. I have altered everything to reorganise goods, but when I right click on the good on the map, the names are wrong. The sprite picture is correct, just the name string is wrong. I have altered gl_string.txt, goodsID.txt, gl.txt where the goods appear between <....>. Altered good txt and good.slic(goodmod)

                        The right click is still showing the old name of that good class on that terrain as far as I can tell.

                        Comment


                        • #13
                          When seeking the place where names are stored, good method is simply to do a full text search of the ctp_data directory (or just the appropriate language subdirectory).

                          Comment


                          • #14
                            I'll try a search but have to be careful as I dont want to muckup the original naming used in other mods.

                            Comment


                            • #15
                              I found the offending problem with the wrong names in the right click good function.

                              In my strings.txt file which I had copied from cradle was a reference to the cradle gl strings txt file which I had not noticed, so it was picking up those first and then going to my new gl strings text file for any missing ones. So my new units were coming up correctly and some goods where there were not old names, were showing. Thats what confused me the most.

                              Phew:-))

                              Comment

                              Working...
                              X