Elucidus,
Since I had a little extra time on my hands I made a small example trigger on how obsoleting buildings might work. I implemented it the way I remember it from Civ1/Civ2, namely to destroy all obsolete buildings as soon the advance that makes them obsolete is discovered. One might want to implement it quite differently, but this is just an example. I didn't test this yet (I'm at uni right now, don't have the game here), so I can't guarantee that it will work. In fact, I don't even know what the syntax of the DestroyBuilding function is so I just guessed how it might work, I wouldn't be surprised if it doesn't work like this.
Harlan,
I made a small example trigger for upgrading tile improvements as well. Same disclaimer as above.
I'm a little pressed for time myself but maybe someone else could work these events out to debug them and to add code for other buildings/improvements as well.
[This message has been edited by Locutus (edited December 18, 2000).]
Since I had a little extra time on my hands I made a small example trigger on how obsoleting buildings might work. I implemented it the way I remember it from Civ1/Civ2, namely to destroy all obsolete buildings as soon the advance that makes them obsolete is discovered. One might want to implement it quite differently, but this is just an example. I didn't test this yet (I'm at uni right now, don't have the game here), so I can't guarantee that it will work. In fact, I don't even know what the syntax of the DestroyBuilding function is so I just guessed how it might work, I wouldn't be surprised if it doesn't work like this.
Code:
HandleEvent(GrantAdvance) 'BazaarObsolete' post { // if someone obtains an advance city_t tmpCity; int_t i; int_t tmpPlayer; int_t advanceType; advanceType = value[0]; tmpPlayer = player[0]; // init variables if (advanceType == AdvanceDB(ADVANCE_BANKING)) { // if advance in question is Banking for (i = 0; i < tmpPlayer.cities; i = i + 1) { GetCityByIndex(tmpPlayer, i, tmpCity); // cycle through cities of player if CityHasBuilding(city, "IMPROVE_BAZAAR") { // if city has bazaar DestroyBuilding(tmpCity, BuildingDB(IMPROVE_BAZAAR)); // destroy it } } } }
I made a small example trigger for upgrading tile improvements as well. Same disclaimer as above.
Code:
HandleEvent(CreateImprovement) 'UpgradeFarms' post { // if improvement creation is started location_t tmpLoc; int_t newPW; int_t improveType; int_t tmpPlayer; tmpPlayer = player[0]; improveType = value[0]; // or is it value[1]? tmpLoc = location[0]; // init variables if (improveType = TerrainImprovementDB(TILEIMP_ADVANCED_FARM)) { // if improvement is advanced farm if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_FARM)) { // if farm present newPW = tmpPlayer.pw + 100; SetPW(tmpPlayer, newPW); // give 100 pw back } } }
[This message has been edited by Locutus (edited December 18, 2000).]
Comment