Announcement

Collapse
No announcement yet.

Terrain fields

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

  • Terrain fields

    Can anybody explain why those terrains that can be terraformed have an EnableAdvance field and a RemoveAdvance field, even though both advances are exactly the same?

    Consider ...


    TERRAIN_BROWN_HILL {
    TilesetIndex 18
    Icon ICON_TERRAIN_BHILLS
    InternalType: BrownHill
    CanDie

    AddAdvance ADVANCE_EXPLOSIVES
    TransformAdd {
    Time 2
    Materials 1600
    }

    RemoveAdvance ADVANCE_EXPLOSIVES
    TransformRemove {
    Time 3
    Materials 600
    }

  • #2
    Quite simple it indicates when you can transform terrain to brown hill (AddAdvance) or from brown hill (Remove Advance).

    Comment


    • #3
      Originally posted by Dale
      Quite simple it indicates when you can transform terrain to brown hill (AddAdvance) or from brown hill (Remove Advance).
      Oh, I feel so stupid.

      I was focusing on the word "Advance" thinking you had the "added" ability when you got the advance. And the ability was "removed" when you lost it. But obviously that didn't make any sense.

      Thanks Dale!

      Comment


      • #4
        I have a problem with terraform.slc from mymod ( OK, I use it in a normal game) . The AI terraforms swamp and dessert to plains or grass land (should be OK), but it also changes wood to plains and (and this makes no sense w/o a mine) plain to brown hill. Would it help to increase materials for such changes? I tried to understand the slc but without any success...

        Comment


        • #5
          Actually, terraform.slc is based on an earlier program that I wrote. player1 improved and expanded it, but, although I haven't checked it looks like he was using a different version of tileimp.txt.

          Where it says, for example,

          Code:
              Event:CreateImprovement(city[0].owner,theLoc, 24,0);
              //change to grassland
          the "24" is supposed to be the tileimp.txt data base index (it's position in the file, "0" is first) of TILEIMP_TERRAFORM_GRASSLAND. But 24 gives TILEIMP_TERRAFORM_BROWN_HILL, it should be "28" for grassland and "32" for plains.

          And, as Martin G later pointed out, a better way of doing it (this makes it independent of whatever version of the tileimp.txt and terrain.txt files are being used) is to use the TerrainImprovementDB(...) and TerrainDB(...) functions. So where you want to change swamp at theLoc (the location) to grassland you'd have:

          Code:
              if ((TerrainType(theLoc)==TerrainDB(TERRAIN_SWAMP))
           && HasAdvance(player[0], ID_ADVANCE_INDUSTRIAL_REVOLUTION)) {
              // 6=swamp
                   pw_level = pw_level + 1200;
                   SetPW(player[0], pw_level);	//add pw
          	   Event:CreateImprovement(city[0].owner,theLoc,TerrainImprovementDB(TILEIMP_TERRAFORM_GRASSLAND),0);
                   //change to grassland
              }
          or, where you want to change tundra or desert into plains,

          Code:
              if ((TerrainType(theLoc)==TerrainDB(TERRAIN_TUNDRA) || TerrainType(theLoc)==TerrainDB(TERRAIN_DESERT)) 
              && HasAdvance(player[0], ID_ADVANCE_CONSERVATION)) {//this restriction is probably unnecessary
              // 2=tundra, 5=desert
          	    pw_level = pw_level + 1000;
          	    SetPW(player[0], pw_level);	//add pw
          	    Event:CreateImprovement(city[0].owner,theLoc, TerrainImprovementDB(TILEIMP_TERRAFORM_PLAINS),0);
                   //change to plains
              }
          Or, you can do whatever you want. I'll leave you the fun of doing the editing, but if you have any problems either post here or e-mail me.

          Comment


          • #6
            I have removed "if TerrainType(theLoc)==0" for terraforming wood and replaced the terrain number with the TerrainImprovementDB(TILEIMP_TERRAFORM... statement and it produces no error message. A good start . Now I want to test it. Have I to start a new game or can I use a saved game started with the unmodified terraform.slc? And a second problem: I think it would be a good idea to terraform wood and hills if there are to much tiles of it. I want to include a counter like : if (TerrainType(theLoc)==0 then w = w+1 and then if ((TerrainType(theLoc)==0) && HasAdvance(player[0], ID_ADVANCE_AGRICULTURAL_REVOLUTION) && w>2)) then terraform (with higher values for w if city size > 6 and a second parameter for the second terrain. Is something like this already available?

            Comment


            • #7
              I'm currently working on a system which completely replaces the AI's terraforming and terrain improvements (excluding non-misc/transportation improvements.)

              In the initialization, you manually enter data into arrays, to define how you want the system to work:

              You define personalities. E.G. Agressive Settler
              Personalities have (multiple) Strategies E.G. Smallest Cities, LeastProductive Cities, Highest growth cities, in that order.
              Strategies have (multiple) Virtual Improvements - just numeric indexes
              Virtual Improvements are defined- they have requirements (like the terrain, the technologies, whether there can be existing improvements, whether the improvement is intended to upgrade another improvement, which improvement to upgrade, its cost) and effects (what improvement or terraforming to actually do.

              The system will take into account the tiles that a city is actually working, rather than assuming all tiles around it are available.

              Its taking a while, because I've been refining the data structures used to define the data... and creating a system to guarantee tile ownership by a particular city, is not easy.

              It is however, intended to be completely flexible, allowing human like priority definition and allow SLIC to encourage specific TI behavior from AI players... based on the personality set for that AI.

              MrBaggins

              Comment

              Working...
              X