/////////////////////////////////////////////////////////////////////////////////////////// //Martin Gühmann's MG_FortsForAIs.slc version 1.0 for CTP2 // /////////////////////////////////////////////////////////////////////////////////////////// //As the AI don't build forts to connect the parts of its empire, here is a slic file // //that will solve the problem. Of coarse it is a little AI cheat but AI are cheating // //anyway. // /////////////////////////////////////////////////////////////////////////////////////////// HandleEvent(ImprovementComplete) 'MG_BuildFortification' post { int_t MG_tilimpcomplete; MG_tilimpcomplete = value[0]; improvement[0] = MG_tilimpcomplete; location_t MGFortLoc; int_t k; int_t MG_OK; MG_OK = 0; unit_t MGFortUnit; int_t MGPw; if(!(IsHumanPlayer(player[0]))){ if ((MG_tilimpcomplete == TerrainImprovementDB(TILEIMP_ROAD))// check if terrain has roads, railroads or maglevs ||(MG_tilimpcomplete == TerrainImprovementDB(TILEIMP_RAILROAD)) ||(MG_tilimpcomplete == TerrainImprovementDB(TILEIMP_MAGLEV))){ for (k=7; k>=0 ; k=k-1) { //directions GetNeighbor(location[0], k, MGFortLoc);//look around if ((TerrainType(MGFortLoc)<=9)||(18<=(TerrainType(MGFortLoc))<=21)) {//check if neighbour tile is a land tile if ((CellOwner(MGFortLoc)==-1)&&(MG_OK == 0)) {//make shure that neighbour tile is owned by noone MGPw = player[0].publicworkslevel;// get AI players current public works level MGPw = MGPw + 1000; setPW(CellOwner(location[0]), MGPw);// make shure that AI player has enough puplic works to build a fort CreateUnit(CellOwner(location[0]), UnitDB(UNIT_DIPLOMAT), MGFortLoc, 1, MGFortUnit);//creates a unit to make shure that fort location is in the vision range of the AI player Event:CreateImprovement(CellOwner(location[0]),MGFortLoc, 8,0 );//create fort Event: DisbandUnit(MGFortUnit);//disband unit at fort location MG_OK = 1;// make shure that only one fort is build } } } } } }