Announcement

Collapse
No announcement yet.

The ghost civ problem. (Eliminated civ still there)

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

  • The ghost civ problem. (Eliminated civ still there)

    Back in May I started a thread over in the help section calle: Eliminated AI still there!!! the problem in short is as follows:

    Some times when a civ is eliminated the civ will still appear on the diplomacy screen effectively making a conquest victory impossible, then if you turn on the cheat mode the civ will disappear. I believe I have found the cause.

    I was playing the Vikings and had eliminated the Swedes but at the next turn they were still there.
    In an attempt to find the problem I turned on cheat mode gave the Swedes a new city and subsequently eliminating it, now to my surprise I saw a unit die when I pressed the button I then reloaded the game from a save prior to entering cheat mode, and sent a bomber over the square and lo and behold there was a Swedish diplomat and a lawyer, since I was at war with them my bomber killed them right away. Now there are no more Swedes.

    Normally when the last city of a civ has been eliminated or conquered the civ's remaining units will die at the beginning of that civ's next turn, thus eliminating the civ from the game. This however does not always happen, in fact it will not happen if you save and reload the game before completing the turn in which the civ was eliminated.
    You don't have to eliminate all the orphaned tropes in order to eliminate the dead civ, one will do, unless you make a save reload after killing the unit. (I did )

    I don't know if any of you SLIC wizards can think up a fix to that, what about some check to see it the civ has any cities, and if not eliminate any remaining units, has to take the beginning of the game into account though.

    [This message has been edited by Martin the Dane (edited October 30, 2000).]
    Visit my CTP-page and get TileEdit and a few other CTP related programs.
    Download and test SpriteEdit development build.

  • #2
    Well, that shouldn't be too hard to do, how about this:

    Code:
    trigger 'CivDies' when (city.captured) {
       if (player.1.cities == 0) {
          i = 0;
          while (i < player.total) {
             SetUnitByIndex(i, city.owner, tmp);
             i = i + 1;
          }
       }
    }
    I made this up in 3 minutes or so and didn't test it, so I can't guarantee it'll work, but it should be very close to working. I'll see if I can test it out tonight (can't promiss anything, since I'm rather busy and I don't have the game installed at the moment), or maybe someone else can.
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #3
      Ah yes, thanks for fixing those bugs, Gedrin, it looks much better like that. One thing though, I'm not sure if city.owner will be the new or the old owner of the city, so I replaced it with player.1. Also, I'm not sure if player.1 is the player that conquers the city or the player that has it's city conquered, so it might be that player.1 should be player.2. So if anyone wants to try this (Martin?), use the code below (it looks like I won't have time for it until at least Friday, maybe even later). If this doesn't work, try replacing all three instances of player.1 with player.2.

      Code:
      trigger 'CivDies' when (city.captured) {
         if (player.1.cities == 0) {
            i = 0;
            while (i < player.1.totalunits) {
                SetUnitByIndex(2, player.1, i);
                KillUnit(unit.2);
                i = i + 1;
            }
         }
      }
      For ease of testing the 0 in the if-line could also be replaced with 1 (or any other number for that matter) so that all units get destroyed when the civ has exactly 1 city left after conquering a city.
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • #4
        Thanks guys. What should we mere mortals do without you people

        I went along and did some testing (Where is the sweating smilie ). As Locutos sugested the player getting killed might be player.2 and not player.1. There was however a comon bug in your code: Don't increase i when using it to iterate through a list that you want to clear.
        The code ends up as follows:

        Code:
        trigger 'CivDies' when (city.captured) {
           if (player.2.cities == 0) {
              while (0 < player.2.totalunits) {
                  SetUnitByIndex(1, player.2, 0);
                  KillUnit(unit.1);
              }
           }
        }
        I tested this, and it's kind of fun waching a whole load of units die just because you walked right into their last undefended city.

        Ok, who includes this in a mod, seems like a little overkill to send out a mod containing only this.

        Martin the Dane

        [This message has been edited by Martin the Dane (edited October 31, 2000).]
        Visit my CTP-page and get TileEdit and a few other CTP related programs.
        Download and test SpriteEdit development build.

        Comment


        • #5
          I have a few improvements to suggest:


          trigger 'CivDies' when (city.captured) {
          if (player.1.cities == 0) {
          i = 0;
          while (i < player.totalunits) {
          // player.1 == city.owner and unit.1 is a unit in the capturing army so use index 2 so as to not clear it out.
          SetUnitByIndex(2, city.owner, i);
          KillUnit(unit.2);
          i = i + 1;
          }
          }
          }


          Same disclaimer as above.


          Gedrin
          [This message has been edited by Gedrin (edited October 31, 2000).]
          [This message has been edited by Gedrin (edited October 31, 2000).]

          Comment


          • #6
            Well gee Martin, you a mere mortal picked up on something we missed, incrementing i.

            Locutus good point about city.owner but I believe player.1 is the victim and player.2 is the aggressor. Trouble is Martin I see your code differs in that regard. So please let me know if that was accurate since if I am correct then the trigger would have done nothing at all... except hit false in the if condition...so any units that died have been CTP itself doing it not your trigger.

            I believe that city.owner would already have been updated to player.2 since in my Refugee trigger I get a message with the city.name is colour coded to match the agressor... Hmmm... IIRC that is. I'll check on that. Oh and it's my Refugee trigger that makes me think player.1 is the victim, See:
            *snip*
            // pick a random number in [0,Cities(player.1))... in not inclusive!
            destCityIdx = Random (Cities(player.1));
            SetCityByIndex(2, player.1, destCityIdx);
            AddPops (city.2, 1);
            *snip*
            If player.1 is the agressor and I pick a random city of his then the pop should flee to the attackers cities... that of course does not happen.

            Gedrin


            Comment


            • #7
              quote:

              Well gee Martin, you a mere mortal picked up on something we missed, incrementing i.

              "Elemtary my dear Watson" and by the way I didn't say stupid, just mortal you se my SLIC knowledge is at the same level as my German, understanding but not writing/speking it.

              Well Gerdin, I tried bot player.1 and player.2 and with player.1 nothing happend while with player.2 the units were killed one at a time. Just checked again, so player.2 is the victim while player.1 is the agressor.
              (The code is directly copy poasete from the .slc file.)

              CTP will not kill the units untill after the player press END, that's why the problem is there in the first place.

              You wrote something about not using index 1 to select the units for 'execution', I have however not experienced any problems doung so.


              quote:

              If player.1 is the agressor and I pick a random city of his then the pop should flee to the attackers cities... that of course does not happen.

              Are you so sure about that? It did when I tried your code.
              The city.owner has ben updated though, I got the growth in the captured city once (out of a total of three attempts) and by the way you wouldn't get the city growth message if the city recieving the refugies was not yours.

              Martin the Dane
              Visit my CTP-page and get TileEdit and a few other CTP related programs.
              Download and test SpriteEdit development build.

              Comment


              • #8
                Hmmm....Well it looks like I need to look at my refugee trigger anew.

                I can confirm that city.owner is updated to the aggressors civ. Tried it last night and its certain I was mis-remembering.

                And if player.1 is the agressor then I would expect my refugees to flee into the attackers waiting arms. I don't think was happening... mind you this depends on my copy here being that same as the one I have at home... which I can't check right at this momment.

                My comments about not using unit index 1 is only because other triggers that execute on city.captured (if there are any) *may funtion* on a unit in the attacking army *and* be executed after this one. Unlikely so you probably will not see anything, but it is a minor bug waiting, lurking...

                Gedrin

                Comment

                Working...
                X