Thread Tools
Old September 7, 2001, 11:20   #1
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 10:09
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
Pedrunn is offline  
Old September 7, 2001, 13:02   #2
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 14:09
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
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
Immortal Wombat is offline  
Old September 7, 2001, 13:19   #3
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 10:09
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
Pedrunn is offline  
Old September 7, 2001, 17:52   #4
Martin Gühmann
staff
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Super Moderator
 
Martin Gühmann's Avatar
 
Local Time: 15:09
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
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!"
Martin Gühmann is offline  
Old September 7, 2001, 19:09   #5
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 14:09
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
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
Immortal Wombat is offline  
Old September 8, 2001, 16:14   #6
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 10:09
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
Pedrunn is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 09:09.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team