Announcement

Collapse
No announcement yet.

Can i make disband add a pop?

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

  • Can i make disband add a pop?

    What can i do to make disband a unit add a pop when it is done in a city?
    Please if it is not possible tell me. I need to get this answer.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

  • #2
    Code:
    HandleEvent(DisbandUnit) 'addpopsinpedrunnscity' pre {
    city_t  tmpCity;
         GetCityByLocation(unit[0].location, tmpCity);
         if(CityIsValid(tmpCity)){
               AddPops(tmpCity, 1);
         }
    }
    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
      Thanks IW, i really wouldnt know what to do without you.

      This is just a small request. If it gives too much work do not do it.
      Can you make a prerequisite wich the only units to add pop when disbanded must have the following line in their data in the unit.txt
      Code:
      BuildingRemovesAPop
      "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


      • #4
        Code:
        HandleEvent(DisbandUnit) 'addpopsinpedrunnscity' pre {
        city_t  tmpCity;
        message(1,'addpops2');
        	GetCityByLocation(unit[0].location, tmpCity);
        	if(CityIsValid(tmpCity)){
        		if ((unit[0].type == UnitDB(UNIT_SEA_ENGINEER))
        		||(unit[0].type == UnitDB(UNIT_SETTLER))
        		||(unit[0].type == UnitDB(UNIT_URBAN_PLANNER))) {
        			AddPops(tmpCity, 1);
        			message(1,'addpops1');
        		}
        	}
        }
        
        Messagebox 'addpops1' {
        	Show();
        }
        
        Messagebox 'addpops2' {
        	Show();
        }
        That should be the code, but it doesn't work. Ben's code only works if you disband a fortified unit from the City Manager. Therefore the two message boxes in the code to check what is really executed and so far there is nothing executed if the unit is not fortified. I also experimented with the DisbandArmyOrder but so far no real success.

        -Martin
        Civ2 military advisor: "No complaints, Sir!"

        Comment


        • #5
          Very strange This is why I hate SLIC. This is why I love SLIC, and love to hate SLIC, and hate to love SLIC

          I guess what to do is fortify it...

          Code:
          HandleEvent(DisbandUnit) 'addpopsinpedrunnscity' pre {
          city_t  tmpCity;
          message(1,'addpops2');
          	GetCityByLocation(unit[0].location, tmpCity);
          	if(CityIsValid(tmpCity)){
          		if ((unit[0].type == UnitDB(UNIT_SEA_ENGINEER))
          		 ||(unit[0].type == UnitDB(UNIT_SETTLER))
          	                 ||(unit[0].type == UnitDB(UNIT_URBAN_PLANNER))) {
          			AddPops(tmpCity, 1);
          			message(1,'addpops1');
          		}
          	}
          }
          
          HandleEvent(DisbandArmyOrder) 'tryagain' pre {
                   int_t  i;
                   unit_t  tmpUnit;
                   for(i = 0; i < army[0].size; i = i + 1){
                         GetUnitFromArmy(army[0], i, tmpUnit);
                                      unit[0] = tmpUnit;
                                      if ((unit[0].type == UnitDB(UNIT_SEA_ENGINEER))
          		            ||(unit[0].type == UnitDB(UNIT_SETTLER))
          		            ||(unit[0].type == UnitDB(UNIT_URBAN_PLANNER))) {
                                                     GetCityByLocation(unit[0].location, tmpCity);
          	                                    if(CityIsValid(tmpCity)){
                                                                    AddPops(tmpCity, 1);
                                                         }
                                      }
                  }
          }
          Sorry about the mess, but this should check through any armies you're disbanding too.
          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


          • #6
            IW, you forgot to define the simbol tmpCity. But it was defined in the first code so i just copied and paste it in the second. The code is now working .
            Thanks again.

            PS: This is my first code fixing . I am almost feeling like a Slic Writter now
            "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