Thread Tools
Old August 12, 2001, 13:31   #1
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
Making the AI Terraform
I have heard people say that the AI doesn't terraform it's terrain. Having played for a while I am starting to agree. I opened the tile improvement file and saw that there are improvements that start with TILEIMP_TERRAFORM and have a terrain type there. So I decided to put this in the improvementlist.txt file. So I put the terraform grassland and terraform plains improvement on the growth list and mountains, forest, and hills in the production list.

Well I put it in and I didn't get an error, but the thing is that I have been playing for about 50 or so turns and The AI hasn't terraformed. What am I doing wrong? I know the AI can terraform, becuase it cleans up pollution. so why is it not terraforming the terrain even though I put it in the list. Has anyone been succesful in getting the AI to terraform? If so how? Is ther a way to make the AI terraform through slic or some other way I'm overlooking.
Cube is offline  
Old August 12, 2001, 16:18   #2
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 14:22
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Hmmm, well, 50 isn't exactly very long, maybe you should play a little longer. Also, making the priority of terraforming very high could help (presuming you can somehow set a priority for this). Of course it can be done through SLIC but that would be like the Frenzy SLIC code: it will get the AI to terraform but it won't do it in a very intelligent way.
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old August 20, 2001, 18:41   #3
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
In Mars 2020 (new version soon), I have had to do that, but its a long code, and for not very good results. You would have to make the AI consider more than just the top 50 (I think) tile improvements it is defaulted to. The actual terraforming doesn't improve it enough to make the AI consider it worthwhile, but in the long-term (which the AI can't plan for) it is benefitial.
Immortal Wombat is offline  
Old August 21, 2001, 19:14   #4
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
hi, IW so what you're basically saying is that I need a code and to make the AI consider more than 50 tile improvements. Did you put the improvement tile improvement in the improvementlists.txt file or did you just use the code. I will go to your website and get the mars2020 mod and look for the code. I want this because in my current game I have AIs surrounded by jungles and forest so they dont grow much.
Cube is offline  
Old August 21, 2001, 20:20   #5
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 12:22
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Cube,

If it's just forests and jungles you're worried about, that's no problem. I've got a couple of handlers that'll cut down the trees. It's getting late here now, but I'll pull them out of my scenario.slc and post them tomorrow.
Peter Triggs is offline  
Old August 22, 2001, 04:54   #6
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
To increase the amount of proposals the AI will think about, so into strategies.txt and for each strategy (warlike, economic, etc) there is a number (commented for clarity) that tells you how many imporvements the AI will consider using. This will work in conjunction with the terraforming in the improvementslist.txt to let the AI choose.
I found that the AI didn't terraform no matter what I did, so I made some code that automatically terraforms terrain into a special AI terrain on settlement, and then at certain random times, terraforms bits of grassland and forest in places.
Immortal Wombat is offline  
Old August 22, 2001, 17:53   #7
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 12:22
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
The promised code is attached. It's been so long since I actually played the game (as opposed to trying to reprogramme it) that I almost forgot I had them. I hope that I've put everything in that you need and that it's working properly.

But I think a few words of explanation might be called for. There's two handlers: NewCityTileImprovement, which triggers whenever a city is created, and ExpandingCityTileImprovement, which triggers whenever a city's population reaches six, the default min population for citysize1.

NewCityTileImprovement basically just terraforms any forest or jungle tiles (that don't have trade goods on them) in a new city's radius into plains. It actually does a bit more because I had to overcome an AI design fault. Any human player who is about to build a city and discovers there's a Goody Hut next door will automatically look in the Goody Hut. The AI doesn't do this: because the GOAL_SETTLE priorities have to be so much higher than all the other goals, settlers will ignore Goody Huts. So the situation can arise where the AI builds a city adjacent to a Goody Hut and then later discovers that the Goody Hut is one of those city generating ones. But you can't build a city inside another city's radius, so this situation has to be excluded, otherwise the handler causes the game to crash. While doing this I thought I'd exclude another irksome AI feature where the city generating Goody Hut is not actually in another city's radius but close to it so that the AI ends up with two cities that are *very* close together. The bit of code

Code:
if (Distance(location[0], THE_NEAREST_CITY.location)<7 
			          && !IsHumanPlayer(player[0])) {//but it's in a lousy location, so
                                  event: DisbandCity(tmpCity);    
			     }
will disband any AI city that comes from a Goody Hut and is within a radius of 7 of an existing city. You might want to adjust the "7"; I play on big maps and like my AI cities far apart.

There's also a couple of lines further down:

Code:
if (TerrainType(theLoc)==18) { //brown (desert) hills
		        Terraform(theLoc, 9);//change to hills 
		   }
Sometimes the AI builds cities next to those 'Sand Dune'-like hills. I think this is a waste of time so this just changes them to ordinary hills. Actually, I guess you could add code like this, here and in the corresponding slots in the ExpandingCityTileImprovement handler, to terraform anything you want. Here's the numbers you need:

CTP2 Terrain Indices:

0 TERRAIN_FOREST
1 TERRAIN_PLAINS
2 TERRAIN_TUNDRA
3 TERRAIN_GLACIER
4 TERRAIN_GRASSLAND
5 TERRAIN_DESERT
6 TERRAIN_SWAMP
7 TERRAIN_JUNGLE
8 TERRAIN_MOUNTAIN
9 TERRAIN_HILL
10 TERRAIN_WATER_SHALLOW
11 TERRAIN_WATER_DEEP
12 TERRAIN_WATER_VOLCANO
13 TERRAIN_WATER_BEACH
14 TERRAIN_WATER_SHELF
15 TERRAIN_WATER_TRENCH
16 TERRAIN_WATER_RIFT
17 TERRAIN_DEAD
18 TERRAIN_BROWN_HILL
19 TERRAIN_TYPE_BROWN_MOUNTAIN
20 TERRAIN_WHITE_HILL
21 TERRAIN_WHITE_MOUNTAIN
22 TERRAIN_WATER_KELP
23 TERRAIN_WATER_REEF
24 TERRAIN_SPECIAL1
25 TERRAIN_SPECIAL1


ExpandingCityTileImprovement is a bit different. The SLIC terraform function works instantaneously and doesn't have any prerequisites. The event CreateImprovement, on the other hand, requires both that the cell owner has any Advances that are needed for the type of improvement you want to carry out and also that he has enough PW stored up to pay for them. It also doesn't work instantaneously but more realistically takes a few turns just like when you do it manually.

So you'll need to adjust the RemoveAdvance lines for forest and jungle in terrain.txt from agricultural revolution to something really basic like agriculture. Also, to make sure that the AI has enough PW to pay for these improvements you might have to lower their cost. If there's a problem here, tell me about it because another possibility is to use SLIC to give the AI whatever PW it needs. (In the mod I was working on, the AI is a bit different and always has lots of reserve PW; so I never had to worry about this.)

What happens here is that when the city grows to 6, you get a message saying

Quote:
"Sire, The city of {city[0].name} is bursting at the seams. We have
sent squads of workers to scour the surrounding countryside and collect building
materials for it's expansion."
and most, but not all, of the forests/jungles in the cells that the city is about to expand out into will start to be transformed into plains.

While we're on the topic of terraforming, the reason, IMHO, why you need to terraform so much is because the map generator is so lousy. Here's the settings from Const.txt that I use for my map generator:

Quote:
# all numbers are integers ranging from 0 to 100

PERCENT_LAND 40 # how much of the world is land
PERCENT_CONTINENT 50 # how much of the world tends toward big continents verses small islands
PERCENT_HOMOGENOUS 5 ## how "clumpy" the land terrain is

# the meridians are normalized on the map at 0 to 100 - 0 is all the way north
# and 100 is all the way south - 50 is the middle - this works on a map of
# any size

MERIDIANA 1 # north of this is north pole
MERIDIANB 44 # north of this is north mild
MERIDIANC 48 # north of this is north desert
MERIDIAND 52 # north of this is the equatorial region
MERIDIANE 56 # north of this is south desert
MERIDIANF 99 # north of this is the south mild, south is the south pole

# the humidity controls the distribution of forest, jungle, swamp, grass, plains, desert
# tundra and glacier
# A bump map is randomly generated. The bumps range from 0 to 100. High bumps are
# wet terrain, low vallies are dry terrain.
# What terrain is used depends on what meridian you are in

# The height values have a gaussian distribution, with middle values being the most
# common. The HLEVEL values should be adjusted to take into account the integral
# of the gaussian.

# HLEVELA must be greater than HLEVELB, HLEVELB must be greater than HLEVELC etc

HLEVELA 99 # above this is the wet terrain
HLEVELB 95 # above this is sort of wet terrain
# here's the middle
HLEVELC 5 # below this is sort of dry terrain
HLEVELD 1 # below this is dry terrain

# The wet/dry slider on the custommap screen uses these values.
# The sum of all the wet values together with the swamp wet value will add to 100.
# Similarly for the dry values. Actually, swamp = 100 - (forest + grass + plains + desert).

FORESTWET 20
GRASSWET 70
PLAINSWET 10
DESERTWET 0
# This leaves 0 for swamp.

FORESTDRY 20
GRASSDRY 70
PLAINSDRY 10
DESERTDRY 0
# This leaves 0 for swamp.

# The warm/cold slider on the custommap screen uses these values.

WHITEWARM 1#5
BROWNWARM 5#30
TEMPERATURERANGEADJUSTWARM 1#75

WHITECOLD 1#30
BROWNCOLD 5
TEMPERATURERANGEADJUSTCOLD 1#120

# The goodcount slider on the custommap screen uses these values.

RICHNESSFEWGOODS 25
RIVERCELLWIDTHFEWGOODS 25
RIVERCELLHEIGHTFEWGOODS 25

RICHNESSMANYGOODS 75
RIVERCELLWIDTHMANYGOODS 5
RIVERCELLHEIGHTMANYGOODS 5


PERCENT_MOUNTAIN 5 # percentage of land with mountains on it - this is a target only
MOUNTAIN_CELL 10#5 # length of a side of a cell - one cell contains at most 1 mountain chain.

PERCENT_HILLS 15 # percent of land with hills on it
MOUNTAIN_SPREAD 25 # chance that the mountain chain spreads out
MOUNTAIN_LENGTH 3 #25 # average length of a mountain chain

GLACIER_EXTENT 1#3 # number of tiles the glacier extends - should be normalized
PERCENT_VOLCANO 1 # percent of deep sea floor with volcanos
PERCENT_TRENCH 4 # percent chance that a trench is seeded - then it spreads automatically

# Swamps are placed at humidity levels above what forest works out to.
PERCENT_FOREST 20
PERCENT_GRASS 40
PERCENT_PLAINS 25
PERCENT_DESERT 1#10
PERCENT_WHITE 2#20
PERCENT_BROWN 2#20
TEMPERATURE_RANGE_ADJUST 10#60
# Adjust the temperature height map by negative this amount at the
# poles, positive at the equator, linear scale in between

NICE_RADIUS 10 # radius of effect when calculating niceness of player placement
# the mininum start distance between players is 2 * NICE_RADIUS

PERCENT_RIVER 5 # percent of land with a river on it
RIVER_LENGTH 15 # average river length
RIVER_CELL_WIDTH 5 # Size of cells to be searched for river starts
RIVER_CELL_HEIGHT 5 # (highest point in each cell)
These give (dare I say it in the context of the current civ3 vs CTP2 controversy) more civ2 like maps. They're by no means perfect: I can't get rid of the big clumps of hills and mountains. As I recall Scorpion59 had an excellent map generator but he'd never tell us the secret of it. Whenever the topic came up he'd just say something like 'It's an ongoing process. It just takes patience and fiddling around with the settings a bit.' Maybe if anyone reading this can get really good results, they could post them or start a discussion or something.

Finally, it looks like we can safely conclude that the terraforming/tileimprovement apparatus as given in Strategies.txt is broken. When you first posted I thought 'Good luck to him. Maybe he'll find something I overlooked.' But now Wombat says he never could get it to work, and that makes three of us. It's clear that it's only half exposed: there's no mention of nets in ImprovementLists.txt yet the AI builds them quite happily. It looks like using SLIC is the only way you can get the terraforming/tileimprovements you want.
Attached Files:
File Type: slc treecutters.slc (6.2 KB, 13 views)
Peter Triggs is offline  
Old August 22, 2001, 19:28   #8
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
Hi Peter,

I'm using medmod 2 and city sizes change at size 8. I was wondering if there's a way to make it so that this triggers when a city reaches a low growth rate, or if not size 3. I would also like it to look within it's radius and terraform( in the real way using create improvement) forest jungles and other terrain to grassland or plains(whichever the AI has enough PW to build).

I would also like the AI to build hills or mountains in its low production cities or remove them in order to reduce pollution. I was also wondering if it's possible to make the AI build commerce Improvements when it's science gets low, because as it stands it only builds them on swamps tundras and other bad terrains.

this is how I edited the file, to try to make it terraform at size 3 and in the current raduis.

HandleEvent(MakePop)'ExpandingCityTileImprovement' post {

location_t theLoc;
location_t firstLoc;

// this triggers when the city's population grows to
// 3

int_t i;
int_t j;

if (city[0].population==3) {
for (j=0; j<=7 ; j=j+1) { //directions
GetNeighbor(firstLoc, j, theLoc);//look around

if ( CellOwner(theLoc)==city[0].owner && HasGood(theLoc)==-1) {
if (TerrainType(theLoc)==0 || TerrainType(theLoc)==7 ) {
// 0=forest, 7=jungle
Event:CreateImprovement(city[0].owner,theLoc, 32,0);
//change to plains
}
}
}
}

will it work?

Last edited by Cube; August 22, 2001 at 20:01.
Cube is offline  
Old August 22, 2001, 20:13   #9
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
No. Because that only fires when the city grows in size, the event is (makepop).

The code does everything in the city radius, and you only need to terraform the next ring out when it is size 6. To allow for MedMod, change the 3 you added, to 8. When the city is size 3, the other handler will have taken care of everything.

Immortal Wombat is offline  
Old August 22, 2001, 20:34   #10
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
I don't like the other handler because it uses terraform instead of createimprovement, so I'll just change that. Will the make pop trigger(the second one) stop when the City gets bigger than 6( or in my case 8)? Would I have to make more trigger for size 20( when it reaches maxsize again for the second radius in medmod), size 36(max for 3rd radius), size 44(max for 4th radius), and size 56( max for 5th raduis)?

I added the code to my mm2_scenario.slc and it says that there's a syntax error in the code on line 189, which is somewhere in the beginning of the code.

Last edited by Cube; August 22, 2001 at 23:40.
Cube is offline  
Old August 23, 2001, 04:51   #11
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
You would have to make an extra bit of code for each size, but the code would get increasingly complicated as you tried to find the affected squares. By that time, a few forests shouldn't matter much.
Immortal Wombat is offline  
Old August 23, 2001, 09:21   #12
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 12:22
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
There should be a semi-colon after THE_NEAREST_CITY declaration.

The reason I used the terraform function for the NewCity handler is that I think it corresponds with the way the city is created: one second there's a settler then 'whosh' there's a city. What did they build it from? So I thought it's reasonable to have any nearby trees disappear as the city materializes out of nowhere. If you prefer to do it by the CreateImprovement event, go ahead; but it's not going to make a lot of difference.

The way it's set up the AI only gets one chance at doing the terraforming: if it doesn't have enough PW when the events occur, it won't get another whack at it. The alternative would be to check every tile in every city's radius at every turn. I didn't even think about trying this because it would be bound to slow the game down to a snail's pace.
Peter Triggs is offline  
Old August 23, 2001, 19:17   #13
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
I guess that makes sense, I think I'll leave it like that, but change it to grassland. Is there a way to make it so that it does it if a city is larger than or equal to 8, by using >= instead of ==. How would I make it so that it does this at citysizes 3, 4, etc... how would it look at the tiles?

I was wondering does this work for the human player or just the AI? I think the create one should work for the human and the AI, but the second one should only work for the AI, seeing as how the human knows how to terraform.

Last edited by Cube; August 23, 2001 at 19:37.
Cube is offline  
Old August 23, 2001, 19:49   #14
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 12:22
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Hmm, I never thought of that. If you were to use 3<=city[0].population then, I think that what should happen is that every time the city's population increases beyond 2 it'll do a search of the tiles (within the citysize1 radius) and try to do the terraforming. If it's got enough PW, it'll do it and after that nothing happens. If it doesn't have enough PW, it'll do whatever it can and then try again when the city's pop increases again. Sounds like a good idea. See if it works.

Edit: This is assuming you're not using the NewCity handler. Otherwise, make it 8<=city[0].population. This would be my choice because it should ensure that the AI gets off to a better start.

Last edited by Peter Triggs; August 23, 2001 at 20:25.
Peter Triggs is offline  
Old August 24, 2001, 13:54   #15
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: 14:22
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
Originially posted by Peter Triggs
The way it's set up the AI only gets one chance at doing the terraforming: if it doesn't have enough PW when the events occur, it won't get another whack at it.
There is a way to make shure when the event occurs that the AI has enough PW. In the Mars 2020 scenario there is a code that gives the player extra PW. Here is the code that I found in the treecutters.slc modified with Ben's Mars 2020 PW add code.

Code:
if (TerrainType(theLoc)==0 || TerrainType(theLoc)==7 )  {
// 0=forest, 7=jungle
        tmpPw = player[0].publicworkslevel;
        tmpPw2 = tmpPw + 400;
        setPW(city[0].owner, tmpPw2);
        Event:CreateImprovement(city[0].owner,theLoc, 32,0);
        //change to plains 		       
}
Of course tmpPw and tmpPw2 must be declared before in the event handler.

PS: Disclamer: untested, untried

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old August 24, 2001, 14:27   #16
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Yep, that should work, if you want it to...

I should point out, as it was pointed out to me, that tmpPW, and tmpPW2 are not both needed, it could just as easily read:
Code:
// declaration here
int_t   tmpPw;

if (TerrainType(theLoc)==0 || TerrainType(theLoc)==7 )  {
// 0=forest, 7=jungle
        tmpPw = player[0].publicworkslevel;
        tmpPw = tmpPw + 400;
        setPW(city[0].owner, tmpPw);
        Event:CreateImprovement(city[0].owner,theLoc, 32,0);
        //change to plains 		       
}
Immortal Wombat is offline  
Old August 24, 2001, 15:42   #17
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 09:22
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
I am really having trouble understanding all of your Slic language. I want to know what does this code. As far as i understood it is to make the AI terraform from time to time. Is that correct?
__________________
"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 August 24, 2001, 16:28   #18
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Technically, the code actually does the terraforming, rather than forcing the AI to do it, but yes, it terraforms the forests and jungles inside the city radius when the city is built, and again when the city radius expands at size 6.
Immortal Wombat is offline  
Old August 24, 2001, 19:30   #19
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
I get a message that the symbol tertype is not defined or something like that, and that there's a syntax error in line 274 of scenario.slc. I think it's somewhere in the second handler, the one that triggers at size 6. Could one of you slic guys using med mod 2 add this and see if you can get it to work.
Cube is offline  
Old August 25, 2001, 06:03   #20
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 12:22
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Delete the line " tertype= TerrainType(theLoc);"; it was a temporary variable I was using to tell me what the terrain type of the location was. Sorry, I should have checked this more thoroughly.

How about if you attach the SLIC file you've got this in? It should make it easier to see what's happening.
Peter Triggs is offline  
Old August 25, 2001, 15:07   #21
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
well here's my mm2_scenario.slc file. I erased the tertype line from it. You should really get medmod 2 peter, it's very good. If you want to use this in the regular game, remove mm2_ from it.
Attached Files:
File Type: slc mm2_scenario.slc (12.8 KB, 9 views)
Cube is offline  
Old August 25, 2001, 17:43   #22
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 12:22
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
OK, try this file. When you changed the CreateImprovement event from plains to grassland you left out the closing curly brackets "}" in a couple of places. I stuck this file into a scenario and didn't get any syntax errors. Moreover, it seems to work. I didn't test it thoroughly but give it a try and see what happens.
Attached Files:
File Type: slc mm2_scenario.slc (13.0 KB, 13 views)
Peter Triggs is offline  
Old August 26, 2001, 13:55   #23
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
I got the file and replaced my mm2_scenario file. I startedthe game and it loaded right. I loaded a game that is in 1000bc or so, and used cheat mode to give myself a settler in a forest area. I settled and the forest was still there, does the create city handler only work for the AI? or is it broken?

well I gave the AI a settler right next my border, and it went to a ruin. I kept ending turns and saw that it had not settled. maybe it's not settling because it's to far from home. Well I will give a settler to the greeks since they're sorrounded by forest, and see what happens.

I changed the code so that it now tries to terraform the second radius everytime the population grows beyond 2. I think this will most definetly help the civs in my current game (1880 ad) that are sorrounded by forest.
Cube is offline  
Old August 26, 2001, 14:22   #24
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Did you reload the SLIC? If you are playing a saved game, then you will have to go into the chat screen ( press ' ) and the type /reloadslic to make the code work.
Immortal Wombat is offline  
Old August 26, 2001, 16:32   #25
Cube
Warlord
 
Cube's Avatar
 
Local Time: 05:22
Local Date: October 31, 2010
Join Date: Nov 2000
Location: El Paso, Tx
Posts: 120
Did you reload the SLIC? yeah uh I forgot to do that! duh!
I reloaded slic and it worked. I changed the population line to something like city population>=4 So it will terraform the second radius every time it grows beyond 4. What's the difference between >= and =>? Because peter put 8<=city[0].population and I put it the other way city[0].population>=4. I added a settler again through cheat mode like last time and settled. It changed the area to grassland(from jungle) and it started terraforming the second radius right away. I will try the code with city[0].population=>4 and see if it works. I don't know how I could have forgotten to reload slic, since I do it everytime there's a new version of medmod 2.
Cube is offline  
Old August 27, 2001, 01:54   #26
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:22
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
>= is greater than
>= is less than

You should be able to use either, as long as you phrase the statemant correctly, ie.

if(i >= 0) {

is the same as

if(0<= i) {

The important thing is to put the < or > sign first, then the = sign second.
Immortal Wombat is offline  
Old August 27, 2001, 02:50   #27
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 12:22
Local Date: October 31, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Quote:
>= is greater than
>= is less than
Bit early in the morning to be posting, Ben. You should have had a cup of coffee first. He meant:

Quote:
>= is greater than or equal to
<= is less than or equal to
Peter Triggs 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 08:22.


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