//===================================== // // Volcanic Eruptions // Location_t VOLC_LOC[]; HandleEvent(BeginTurn) 'IWN_place_volcano' pre{ int_t i; int_t j; location_t tmpLoc; int_t volc; unit_t BarbUnit; int_t num_volcs; num_volcs = 3; // this is the number of volcanoes that will appear. if (GetCurrentRound () == 0) { if(!HasAdvance(0, ID_ADVANCE_SUBNEURAL_ADS)){ GrantAdvance(0, AdvanceDB(ADVANCE_SUBNEURAL_ADS)); // make the advance for both timps subneural ads } volc = 0; while(volc <= num_volcs){ i = random(GetMapWidth() -1); j = random(GetMapHeight() -1); MakeLocation(tmpLoc, i, j); if(TerrainType(tmpLoc) == terrainDB(TERRAIN_MOUNTAIN) && volc < num_volcs){ CreateUnit(0, UnitDB(UNIT_BOMBER), tmpLoc, 1, BarbUnit); Event:CreateImprovement(0,tmpLoc, TerrainImprovementDB(TILEIMP_VOLCANO_1),0 ); FinishImprovements(tmpLoc); Event: DisbandUnit(BarbUnit); volc = volc + 1; VOLC_LOC[volc] = tmpLoc; } } } DisableTrigger('IWN_place_volcano'); } HandleEvent(BeginTurn) 'IWN_volcano_erupts' pre { int_t rnd; location_t tmpLoc; unit_t BarbUnit; if(IsHumanPLayer(player[0])){ // not too frequently... rnd = random(100); if(rnd < VOLC_LOC.#){ tmpLoc = VOLC_LOC[rnd]; if(!HasAdvance(0, ID_ADVANCE_SUBNEURAL_ADS)){ GrantAdvance(0, AdvanceDB(ADVANCE_SUBNEURAL_ADS)); } CreateUnit(0, UnitDB(UNIT_BOMBER), tmpLoc, 1, BarbUnit); Event:CreateImprovement(0,tmpLoc, TerrainImprovementDB(TILEIMP_VOLCANO_2),0 ); FinishImprovements(tmpLoc); Event: DisbandUnit(BarbUnit); } } }