Announcement

Collapse
No announcement yet.

Unit Updater Questions

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

  • #16
    The reason I asked about what mod you were playing with, is because the version I posted earlier used Martin's GoodMod1.slc, so it would only work in mods that already have that included. Here's a version that I've ripped out of it; this should work with any setup. Anyone who wants to use this needs to go to the file ...\ctp2_data\default\gamedata\script.slc and at the very bottom of it, add the line

    #include "MAQ_Terra.slc"
    and then just put the attached file in the folder ...\ctp2_data\default\gamedata

    I don't know how familiar you are with SLIC, but it's all done with the terraform function:


    VOID Terraform(location, terrain)

    Change location into a different terrain type.

    0 TERRAIN_TYPE_FOREST
    1 TERRAIN_TYPE_PLAINS
    2 TERRAIN_TYPE_TUNDRA
    3 TERRAIN_TYPE_GLACIER
    4 TERRAIN_TYPE_GRASSLAND
    5 TERRAIN_TYPE_DESERT
    6 TERRAIN_TYPE_SWAMP
    7 TERRAIN_TYPE_JUNGLE
    8 TERRAIN_TYPE_MOUNTAIN
    9 TERRAIN_TYPE_HILL
    10 TERRAIN_TYPE_WATER_SHALLOW
    11 TERRAIN_TYPE_WATER_DEEP
    12 TERRAIN_TYPE_WATER_VOLCANO
    13 TERRAIN_TYPE_SPACE
    14 TERRAIN_TYPE_WATER_BEACH
    15 TERRAIN_TYPE_WATER_SHELF
    16 TERRAIN_TYPE_WATER_TRENCH
    17 TERRAIN_TYPE_WATER_RIFT
    18 TERRAIN_TYPE_DEAD
    19 TERRAIN_TYPE_BROWN_HILL
    20 TERRAIN_TYPE_BROWN_MOUNTAIN
    21 TERRAIN_TYPE_WHITE_HILL
    22 TERRAIN_TYPE_WHITE_MOUNTAIN
    23 TERRAIN_TYPE_DEAD_HILL
    The numbers in the left hand column are used in the code as follows. MGGoodLoc is the tile location being looked at.

    Code:
         ran=random(3); //generate a random number 0 <= ran < 3
         if (TerrainType(MGGoodLoc)==2 || TerrainType(MGGoodLoc)==3){
         //if the location is tundra or glacier
    	    if (ran==0){//33% chance of changing it to grassland
    	        terraform(MGGoodLoc,4);//change to grassland 
    	    }
              elseif (ran==1){//33% chance of changing it to plains
    		  terraform(MGGoodLoc,1);//change to plains 
    	    }
    	    else{//33% chance of changing it to forest
    		  terraform(MGGoodLoc,0);//change to forest
    	    }
         }
    I put the random number bit in so that it would break up the big clumps of terrain (tundra/glacier above) that you often find.

    I hope that's enough info to let you get on with changing it if you want to. If not, feel free to ask for advice.

    It works fine for me but this may be because of the way I've modified some of the data in const.txt. Tell me how it works with the data you're using.


    PS, The new updater code will take a few more days. I'm, er uhm, having too much fun beta testing Call to Bloodlust.
    Attached Files

    Comment


    • #17
      if you, er... need any help beta-testing...
      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


      • #18
        Thanks Peter. Ill have a little dabble around and find my way. Unfortunately what i know about writing/interpreting slic you could write on the back of a stamp, but this looks alright.
        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


        • #19
          A small sugestion, Peter. It is not going to affect the code but i really think you shoul change numbers to
          TerrainDB(TERRAIN_*).
          That was the first thing i did when i got BlueO's original city expansion. This prevents incompatibilities with mods (There isnt a mod that changed the order of the terrains but it might have in the future), and really save you the time of having to look this chart you showed, prevents small mistakes with huge consequences and makes editing easier.
          "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

          Working...
          X