// This file contains all additional slic code. Currently in this file // are the PW mod, Martin's soundfix, and David's population boom code. // added for Terraforming: // Global Variable city_t THE_NEAREST_CITY; // Function // Finds thePlayer's THE_NEAREST_CITY; beyond or equal to theDistance to theLocation int_f FindTheNearestCity( int_t thePlayer, location_t theLocation, int_t theDistance){ int_t smlDist; int_t tmpDist; int_t i; location_t tmpLocation; city_t tmpCity; smlDist=90000; //initialize to some absurdly large number tmpLocation=theLocation; if (IsPlayerAlive(thePlayer)) { if (PlayerCityCount(thePlayer)> 0) { for(i = 0; i < PlayerCityCount(thePlayer); i = i + 1) { if(GetCityByIndex(thePlayer, i, tmpCity)) { tmpDist=SquaredDistance(tmpLocation, tmpCity.location); if (theDistance <= tmpDist && tmpDist < smlDist) { smlDist = tmpDist; THE_NEAREST_CITY = tmpCity; } } } if (smlDist<90000) { return Distance(tmpLocation, THE_NEAREST_CITY); } else{ return -1;// no such city exists } } } else{ return -1; // no cities at all or not a valid player } } /////////////////////////////////////////////////////////////////////////////// // Scenario script for PW Mod by Mr. Ogre (Joe Rumsey) // /////////////////////////////////////////////////////////////////////////////// HandleEvent(NextStrategicState) 'ChangeHumanMayorStrategy' pre { // increase PW reserve for human players int_t db_index; int_t ss_priority; db_index = StrategyDB(STRATEGY_LARGE_PW_RESERVE); ss_priority = 500; if (db_index >= 0 && IsHumanPlayer(player[0])) { ConsiderStrategicState(player[0], ss_priority, db_index); } } //////////////////////////////////////////////////////////////////////////////////////////////// //Martin Gühmann's Soundfix V1.1 //////////////////////////////////////////////////////////////////////////////////////////////// // //This file contains a small sound fix for CTP2. I never liked the fact that I never heard //a sound when I built a tile improvement. This small slic file will solve that problem. //Feel free to copy, modify or use it for your own mod as it is. // //To install this file open the file script.slc in your ..\ctp2_data\default\gamedata\ derectory. //Go to the end of this file and add the line: //#include "MG_soundfix.slc" //If you load your old savegames you have to open the Chat-Window. Use this key without the //brackets ('). And type /reloadslic. // //Unfortunatly I couldn't find sounds for the tile improvements new CTP2. Therefore I used //the sound of the Elephant good for the nature preserve, the road sound for outlet mall and //trading post, the net sound for the port, the water mine sound for the drilling platform and //the sound for the science fiction screen for the endgame obelisk. Maybe you have better ideas. //Let me know. // //Changes from V1.0 to V1.1: //You only hear now a sound if the human player creates a tile improvement, as it was in CTP1. //I used the little piece of slic that Ben aka The Immortal Wombat suggested in the Apolyton //forum. The second change is that you will now hear a sound if you use terraforming. It is //also the road sound. //////////////////////////////////////////////////////////////////////////////////////////////// HandleEvent(CreateImprovement) 'MG_createimprovement' pre { int_t MG_tilimpcreate; MG_tilimpcreate = value[0]; improvement[0] = MG_tilimpcreate; if(IsHumanPlayer(player[0])){ if (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_FARMS)){ PlaySound("SOUND_ID_IRRIGATION_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_ADVANCED_FARMS)){ PlaySound("SOUND_ID_IRRIGATION_2"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_HYDROPONIC_FARMS)){ PlaySound("SOUND_ID_IRRIGATION_3"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_NETS)){ PlaySound("SOUND_ID_IRRIGATION_1_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_FISHERIES)){ PlaySound("SOUND_ID_IRRIGATION_2_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_AUTOMATED_FISHERIES)){ PlaySound("SOUND_ID_IRRIGATION_3_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_MINES)){ PlaySound("SOUND_ID_MINE_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_ADVANCED_MINES)){ PlaySound("SOUND_ID_MINE_2"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_MEGA_MINES)){ PlaySound("SOUND_ID_MINE_3"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_UNDERSEA_MINES)){ PlaySound("SOUND_ID_MINE_1_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_ADVANCED_UNDERSEA_MINES)){ PlaySound("SOUND_ID_MINE_2_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_MEGA_UNDERSEA_MINES)){ PlaySound("SOUND_ID_MINE_3_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_ROAD)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_RAILROAD)){ PlaySound("SOUND_ID_ROAD_2"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_MAGLEV)){ PlaySound("SOUND_ID_ROAD_3"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_UNDERSEA_TUNNEL)){ PlaySound("SOUND_ID_ROAD_3_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_LISTENING_POSTS)){ PlaySound("SOUND_ID_LISTENING_POSTS"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_RADAR_STATIONS)){ PlaySound("SOUND_ID_RADAR_STATIONS"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_AIR_BASES)){ PlaySound("SOUND_ID_AIR_BASES"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_SONAR_BUOYS)){ PlaySound("SOUND_ID_SONAR_BUOYS"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_FORTIFICATIONS)){ PlaySound("SOUND_ID_FORTIFICATIONS"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_DRILLING_PLATFORM)){ PlaySound("SOUND_ID_MINE_2_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_NATURE_PRESERVE)){ PlaySound("SOUND_ID_ELEPHANT"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_OUTLET_MALL)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_PORT)){ PlaySound("SOUND_ID_IRRIGATION_1_WATER"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_PROCESSING_TOWER)){ PlaySound("SOUND_ID_SCIFI_SCREEN"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TRADING_POST)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_BROWN_HILL)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_BROWN_MOUNTAIN)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_DESERT)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_FOREST)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_GRASSLAND)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_HILL)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_JUNGLE)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_MOUNTAIN)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_PLAINS)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_SWAMP)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_WHITE_HILL)){ PlaySound("SOUND_ID_ROAD_1"); } elseif (MG_tilimpcreate == TerrainImprovementDB(TILEIMP_TERRAFORM_WHITE_MOUNTAIN)){ PlaySound("SOUND_ID_ROAD_1"); } } } ///////////////////////////////////////////////////////////////////////////////////////////////// // terraform slic //////////////////////////////////////////////////////////////////////////////////////////////// // Handlers HandleEvent(CreateCity)'NewCityTileImprovement' post { //one for new cities location_t theLoc; city_t tmpCity; int_t i; int_t j; int_t CityOK; CityOK=0; if (value[1]==-1) {// if it came from a goody hut if (PlayerCityCount(player[0])==1) {// it was the first city CityOK=1; } elseif (PlayerCityCount(player[0])>0) { for(i=0; i