Announcement

Collapse
No announcement yet.

SLIC terraforming puzzles

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

  • SLIC terraforming puzzles

    OK, I'm trying to implement a nuclear meltdown trigger for my modpack. I thought this would be easy, but...

    Here's what I have so far (With changes so it's certain to meltdown if happiness drops below 72, for testing):

    (EDIT - sorry all my indentation got killed by something when I submitted the post)

    //Location used for making dead tiles and whatnot round nukes
    TypeLocation NuclearMeltdownLoc;

    trigger 'NuclearMeltdown' when (city.happiness < 72 && CityHasBuilding(city, "IMPROVE_NUCLEAR_PLANT"))
    { //if (Random(50)<(72-city.happiness)
    if (1)
    { if (city.owner == g.player)
    { AddCenter(city.location);
    }
    Message(city.owner, 'NuclearMeltdownInCity');
    AddEffect(city.location, "SPECEFFECT_NUCLEAR_ATTACK", "SOUND_ID_NUCLEAR_ATTACK");

    AddPops(city, -(city.population/2));
    i=0;
    while (i<8)
    { if (GetNeighbor(city.location, i, NuclearMeltdownLoc))
    { if (Random(10)<5)
    {
    j=TerrainType(NuclearMeltdownLoc);
    Message(city.owner, 'JunkMessage');
    if (j>=0 && j<=7) //Change flat land to dead tile
    { Terraform(NuclearMeltdownLoc, 18);
    }
    if (j==9 || j==19 || j==21) //Change hills to dead hills
    { Terraform(NuclearMeltdownLoc, 23);
    }
    }
    }
    i=i+1;
    }
    }
    }

    Which mostly works OK, the population is halved, you get a pretty picture and a message, but the terraforming to make dead tiles is apparently doing nothing at all. The junk message appears 3-5 times, as you would expect, but no terrain changes.

    I'd also like to know how to destroy the nuclear plant improvement together with a random selection of others.

    Am I going about this the right way, or is there a NukeHere() function . You can't start creating nuclear missiles and moving them around, I'm sure that would cause far too many problems (e.g. SDI, nanite defuser, active defense).

    If I can't even make this work, I'm certainly not going to try for the partisan effect...

    John

  • #2
    Firstly, ded hills don't exist...
    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


    • #3
      Right... I've often wondered why I'd never seen them. Anything else?

      Comment


      • #4
        Secondly... nope, I don't know

        Just a suggestion that might help though...
        In CTP2 (sorry, I don't and never have SLICed CTP1 ), to get the terraintype, I have always seen used something like this:
        Code:
        int_t    TType;
        TType = TerrainType(NuclearmeltDownLoc);
        if(TType == TerrainDB(TERRAIN_GRASSLAND) ||
           TType == TerrainDB(TERRAIN_PLAINS) ||
           .....){
               Terraform(NuclearMeltDownLoc, 18);
        }
        Its longer, but it means the TerrainType isn't working directly as a number, so you can see what it is doing directly, and also, it seems to work (figers crossed).
        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


        • #5
          I've tried a few variations and it only got worse, it started crashing CTP. So, I've changed tack, and now the meltdown is merely a leakage of radioactive material (Three-mile Island, not Chernobyl). This cuts the population down to 25% and kills all military units in the square. This seems to work, and is quite sufficient. And I've also got partisans working a treat - that was much easier .

          Nearly finished now - will be looking for playtesters soon...

          John

          Comment


          • #6
            Oops, sorry
            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


            • #7
              JB: Here a link to some slic changing tiles.



              Maybe you can use it.

              Have fun.
              First they ignore you. Then they laugh at you. Then they fight you. Then you win.

              Gandhi

              Comment

              Working...
              X