Whether or not the AI is afflicted is a matter of choice.
To reduce the risks of plagues with normal settings, build aqueducts, drug stores, hospitals and aqua filters. Bit of a bugger in the ancient age I admit, but still, Sh!t happens. If you find this particular brand of fecal waste happens too often, open the code:
(locutus
) This is not Cradle code, this is mine own, but Cradle's in very similar.
Code:
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
}
find this line:
and reduce the number x by 10 or 20. This will cut down the chance.
Then /reloadslic in the chat window.
If you want to reduce the effects of the plague, find this line:
Code:
tmpDead = city[0].population/3;
and make the 3 to a 4 or 5. (so 1/4 or 1/5 die instead of 1/3 the population)
Hope this helps
Ben
Bookmarks