Where do I go to either end plagues, or at least slow them down? I suffered through 4 plagues in 200 years. How's a civ supposed to grow with that looming over their heads????
) This is not Cradle code, this is mine own, but Cradle's in very similar.void_f Plague (int_t thePlayer){
int_t tmpPlayer;
tmpPlayer = thePlayer;
if(IsHumanPlayer(tmpPlayer)){ // take this line out in if you do want to affect the AI
//message(1, 'startdata');
int_t CityCount;
player[0] = tmpPlayer;
CityCount = player[0].cities - 1;
PlaguedCityCounter = 0;
int_t i;
for(i = 0; i < CityCount; i = i + 1){
//message(1, 'testdata');
int_t PPChance;
PPChance = random(100);
city_t PlaguedCity;
GetCityByIndex(tmpPlayer, i, PlaguedCity);
if(PlaguedCity.population >= 3){
//
// Building that reduce plague chance are:
// aqueduct, drug store, aqua-filter, hospital
//
// Start = 50/50 chance of plague in PlaguedCity
// + aqueduct --> 40/60 chance
// + drug store --> 30/70 chance
// + hospital --> 20/80 chance
// + aqua filter --> 10/90 chance
//
if(CityHasBuilding(PlaguedCity, "IMPROVE_AQUEDUCT")){
PPChance = PPChance - 10;
}
if(CityHasBuilding(PlaguedCity, "IMPROVE_DRUG_STORE")){
PPChance = PPChance - 10;
}
if(CityHasBuilding(PlaguedCity, "IMPROVE_HOSPITAL")){
PPChance = PPChance - 10;
}
if(CityHasBuilding(PlaguedCity, "IMPROVE_AQUA_FILTER")){
PPChance = PPChance - 10;
}
if(PPChance >= -40){ // replace to 50 again for a base 50/50 chance of strike
city[0] = PlaguedCity;
int_t tmpDead;
tmpDead = city[0].population/3;
int_t j;
for(j = 0; j < tmpDead; j = j + 1){
Event:KillPop(PlaguedCity);
}
Event:AddHappyTimer(PlaguedCity, 3, -2, 14); // 3 turns of -2 happiness
PlaguedCityCounter = PlaguedCityCounter + 1;
}
}
}
player[0] = tmpPlayer;
if(PlaguedCityCounter >= 1){
if(HasAdvance(tmpPlayer, ID_ADVANCE_MEDICINE)){
message(tmpPlayer, 'EpidemicYou');
if(tmpPlayer != ND_human){
message(ND_human, 'EpidemicOther');
}
}
else{
message(tmpPlayer, 'PlagueHitYou');
if(tmpPlayer != ND_human){
message(ND_human, 'PlagueHitOther');
}
}
}
else{
message(tmpPlayer, 'PlagueDidntHitYou');
if(tmpPlayer != ND_human){
message(ND_human, 'PlagueDidntHitOther');
}
}
} // closing the IsHuman brackets
}
if(PPChance >= x){
tmpDead = city[0].population/3;

Surely, this should be 40 (or 50, judging from the comment behind it). As it is, all cities always get struck by a plague as it is impossible to get a PPChance lower than -40. Without this bug the effects of a plague would be far less severe (esp later on in the game) and thus make this feature much less frustrating, possibly even fun
if(PPChance >= -40){
city[0] = PlaguedCity;
int_t tmpDead;
tmpDead = city[0].population/3;
int_t j;
for(j = 0; j < tmpDead; j = j + 1){
Event:KillPop(PlaguedCity);
}
Event:AddHappyTimer(PlaguedCity, 3, -2, 14); // 3 turns of -2 happiness
PlaguedCityCounter = PlaguedCityCounter + 1;
}
if(PPChance >= 80){ // replace to 50 again for a base 50/50 chance of strike
city[0] = PlaguedCity;
int_t tmpDead;
tmpDead = city[0].population/3;
int_t j;
for(j = 0; j < tmpDead; j = j + 1){
Event:KillPop(PlaguedCity);
}
Event:AddHappyTimer(PlaguedCity, 3, -2, 14); // 3 turns of -2 happiness
PlaguedCityCounter = PlaguedCityCounter + 1;
}
elseif(PPChance >= 50 && IsHumanPlayer(tmpPlayer)){ //bug fix ;)
city[0] = PlaguedCity;
int_t tmpDead;
tmpDead = city[0].population/3;
int_t j;
for(j = 0; j < tmpDead; j = j + 1){
Event:KillPop(PlaguedCity);
}
Event:AddHappyTimer(PlaguedCity, 3, -2, 14); // 3 turns of -2 happiness
PlaguedCityCounter = PlaguedCityCounter + 1;
}


Comment