Announcement

Collapse
No announcement yet.

Making the AI Terraform

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

  • #16
    Yep, that should work, if you want it to...

    I should point out, as it was pointed out to me, that tmpPW, and tmpPW2 are not both needed, it could just as easily read:
    Code:
    // declaration here
    int_t   tmpPw;
    
    if (TerrainType(theLoc)==0 || TerrainType(theLoc)==7 )  {
    // 0=forest, 7=jungle
            tmpPw = player[0].publicworkslevel;
            tmpPw = tmpPw + 400;
            setPW(city[0].owner, tmpPw);
            Event:CreateImprovement(city[0].owner,theLoc, 32,0);
            //change to plains 		       
    }
    Concrete, Abstract, or Squoingy?
    "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

    Comment


    • #17
      I am really having trouble understanding all of your Slic language. I want to know what does this code. As far as i understood it is to make the AI terraform from time to time. Is that correct?
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #18
        Technically, the code actually does the terraforming, rather than forcing the AI to do it, but yes, it terraforms the forests and jungles inside the city radius when the city is built, and again when the city radius expands at size 6.
        Concrete, Abstract, or Squoingy?
        "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

        Comment


        • #19
          I get a message that the symbol tertype is not defined or something like that, and that there's a syntax error in line 274 of scenario.slc. I think it's somewhere in the second handler, the one that triggers at size 6. Could one of you slic guys using med mod 2 add this and see if you can get it to work.

          Comment


          • #20
            Delete the line " tertype= TerrainType(theLoc);"; it was a temporary variable I was using to tell me what the terrain type of the location was. Sorry, I should have checked this more thoroughly.

            How about if you attach the SLIC file you've got this in? It should make it easier to see what's happening.

            Comment


            • #21
              well here's my mm2_scenario.slc file. I erased the tertype line from it. You should really get medmod 2 peter, it's very good. If you want to use this in the regular game, remove mm2_ from it.
              Attached Files

              Comment


              • #22
                OK, try this file. When you changed the CreateImprovement event from plains to grassland you left out the closing curly brackets "}" in a couple of places. I stuck this file into a scenario and didn't get any syntax errors. Moreover, it seems to work. I didn't test it thoroughly but give it a try and see what happens.
                Attached Files

                Comment


                • #23
                  I got the file and replaced my mm2_scenario file. I startedthe game and it loaded right. I loaded a game that is in 1000bc or so, and used cheat mode to give myself a settler in a forest area. I settled and the forest was still there, does the create city handler only work for the AI? or is it broken?

                  well I gave the AI a settler right next my border, and it went to a ruin. I kept ending turns and saw that it had not settled. maybe it's not settling because it's to far from home. Well I will give a settler to the greeks since they're sorrounded by forest, and see what happens.

                  I changed the code so that it now tries to terraform the second radius everytime the population grows beyond 2. I think this will most definetly help the civs in my current game (1880 ad) that are sorrounded by forest.

                  Comment


                  • #24
                    Did you reload the SLIC? If you are playing a saved game, then you will have to go into the chat screen ( press ' ) and the type /reloadslic to make the code work.
                    Concrete, Abstract, or Squoingy?
                    "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                    Comment


                    • #25
                      Did you reload the SLIC? yeah uh I forgot to do that! duh!
                      I reloaded slic and it worked. I changed the population line to something like city population>=4 So it will terraform the second radius every time it grows beyond 4. What's the difference between >= and =>? Because peter put 8<=city[0].population and I put it the other way city[0].population>=4. I added a settler again through cheat mode like last time and settled. It changed the area to grassland(from jungle) and it started terraforming the second radius right away. I will try the code with city[0].population=>4 and see if it works. I don't know how I could have forgotten to reload slic, since I do it everytime there's a new version of medmod 2.

                      Comment


                      • #26
                        >= is greater than
                        >= is less than

                        You should be able to use either, as long as you phrase the statemant correctly, ie.

                        if(i >= 0) {

                        is the same as

                        if(0<= i) {

                        The important thing is to put the < or > sign first, then the = sign second.
                        Concrete, Abstract, or Squoingy?
                        "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                        Comment


                        • #27
                          >= is greater than
                          >= is less than
                          Bit early in the morning to be posting, Ben. You should have had a cup of coffee first. He meant:

                          >= is greater than or equal to
                          <= is less than or equal to

                          Comment

                          Working...
                          X