Originally posted by
sun_tzu_159
The SLIC completes its checking loop correctly but does not put the good back on the square it came from with the above command - any ideas.
In GoodMod you can devide the goods into two parts. On the one hand the invisible part, the tile improvement that adds the boni to the tile and on the other hand the trade good, that is also in the original game. And it is the visible part of the Good.
So you want to recreate the entire good. You have to recreate the tile improvement. Note that the first argument must be the owner of the cell or the owner of an unit that has this location in its vision range. If the future owner does not own the location he can only build there tile improvements with fort like characteristics.
Maybe you should rather use the version of the goods restoration code:
PHP Code:
Event:CreateImprovement(CellOwner(location[0]), location[0], 52, 0);
Instead of the number for the third argument you can also use a funktion that returns the DB index of the improvment here is an example from BlueO:
PHP Code:
Event: CreateImprovement(tmpCity.owner, tmpLoc, TerrainImprovementDB(TILEIMP_ROAD), TerrainImprovementDB(TILEIMP_ROAD));
You notice that he used the fourth argument it requres an Int but I have also no idea what it does. From BlueO's example you might think this could the an option for a second improvment, but I think it does nothing it is just there. Otherwise my code would create a lot of advanced farms.
With this funktion you don't need to take so much care on your improvemnt database as you have to do it if you use the numbers.
If the the tile improvment is back on the map than it needs a certain time until it is finished. All good improvments have a contruction time of ten turns. As long as you don't use this function on the given location:
PHP Code:
FinishImprovements(MGUnitLoc);
So the improvment will be finished but in your case the good would be still missing just the terrain boni would be back. So finally or at first you have to plant a good that is the funktion that will do the job:
PHP Code:
PlantGood(MGGoodLoc);
But why do it in a so complecate way just prevent the AI and the mayors from terraforming the good. From your ImprovementsList.txt I know that you considered more terraforming options for the AI (I just use the grassland option), but that means that you have to modify my code that I gave above.
PHP Code:
HandleEvent (CreateImprovement)'MG_ImpOnGoodStop' pre {
int_t MG_tilimpcreate;
MG_tilimpcreate = value[0];
improvement[0] = MG_tilimpcreate;
if (GetCurrentRound () > 1) {
if (HasGood(MGGoodLoc)>-1) {
if ((MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_GRASSLAND))
||(MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_PLAINS))
||(MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_JUNGLE))
||(MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_FOREST))
||(MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_SWAMP))) {
return STOP;
}
}
}
}
Another note about the improvment list the original file looks unfinished and the AI was able to improve its terrain. It uses also some of my good improvments. So I guess this file is there but completely useless.
-Martin
Bookmarks