 |
|  |
 |
|
Immortal Wombat
|
 |
in perpetuity
Dec 2000 time: 05:17
|
|
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:
code:
if(PPChance >= x){
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
|
|
|  |
 |
|  |
 |
|
Boney
|
|
Thailand
Jan 2001 time: 05:17
|
|
Yeah, these cradle plagues have been bugging me too. But I have a couple of questions.
quote: why is CityCount (player[0].cities - 1)? |
Firstly if I changed cities - 1 to cities - 5, would this mean that 5 cities would be unaffected by plagues every time they occur?
Secondly, if I was to make these changes would they apply to the game I am currently playing? I have been hit hard by these plagues, but if just a few more cities were unaffected it would be okay.
I think that even in cradle the AI needs all the help it can get, so I don't think I need to give the plague to them too. But I might yet change my mind.
Would it be possible to give the AI plagues to but to a lesser extent than to my self, maybe half as many occurences?
Still loving cradle, but I found that the mega huge map created too much management towards the end of the game. Normal size with ten civs seems good for me right now.
|
|
|  |
 |
|
Locutus
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:17
|
|
quote: Originally posted by Boney
Firstly if I changed cities - 1 to cities - 5, would this mean that 5 cities would be unaffected by plagues every time they occur? |
Yes, but it would always be the 5 youngest cities in your empire: the 5 cities you last founded/conquered. If you don't get new cities for a while it would be the same cities that would be protected all the time, I can't think of a reason why anyone would want this (there are more sophisticated ways of protecting certain cities, IW's idea of recuded risk for cities with certain tile improvements is just one of them).
quote: Secondly, if I was to make these changes would they apply to the game I am currently playing? I have been hit hard by these plagues, but if just a few more cities were unaffected it would be okay. |
You would have to open the chatbox (with the '-key) and type /reloadslic, but yes, that should work.
quote: I think that even in cradle the AI needs all the help it can get, so I don't think I need to give the plague to them too. But I might yet change my mind. |
I agree, I originally wanted to give plagues to the AI to as he was having 40+ cities while I was kept down to somewhere between 8 and 25 (with such a gap you can impossibly compete at Deity level), but with the bug fixed I think I'll keep it the way it is for now.
quote: Would it be possible to give the AI plagues to but to a lesser extent than to my self, maybe half as many occurences? |
That would be entirely possible, simply add a check for 'IsHumanPlayer(tmpPlayer)' before executing the line 'tmpDead = city[0].population/3;' and make an else-clause where you do 'tmpDead = city[0].population/6;' instead (this would result in the city becoming 1/6 of the original size, instead of the 1/3 that is used for humans).
Edit: BTW, Ben, if you want to kill pop you can also use AddPop with a negative number, that way you don't need the entire for-loop thingie. Just use 'AddPop(tmpCity, -2*city[0].population/3)', that would reduce the city to 2/3 of it's original size.
Last edited by Locutus on 10-01-2002 at 12:47
|
|
|  |
 |
|
Immortal Wombat
|
 |
in perpetuity
Dec 2000 time: 05:17
|
|
quote:
why is CityCount (player[0].cities - 1)?
|
Dunno, It made sense at the time
quote:
Edit: BTW, Ben, if you want to kill pop you can also use AddPop with a negative number, that way you don't need the entire for-loop thingie. Just use 'AddPop(tmpCity, -2*city[0].population/3)', that would reduce the city to 2/3 of it's original size.
|
I know. I just found it easier to do everything on different lines rather than have long calculations. No doubt the game thinks otherwise...
quote:
More importantly: you have set the PPChance condition to -40! 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.
|
Hence the rider at the top - this is my test code. I thought I had changed it in the version I posted, and was subsequently put into Cradle. Maybe that one slipped past me.
quote: Would it be possible to give the AI plagues to but to a lesser extent than to my self, maybe half as many occurences? |
You could reduce the effects as Locutus suggests, or you could cut out this bit:
code:
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;
}
and replace it with:
code:
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;
}
Tht way humans get 50% hit, AI gets 20% hit without any building modifications to the probabilities.
Sorry about all the bugs 
multiple edits: code 
Last edited by Immortal Wombat on 10-01-2002 at 18:13
|
|
|  |
 |
|
Boney
|
|
Thailand
Jan 2001 time: 05:17
|
|
I tried to reduce effects of plague cut and pasting as suggested by Immortal Com. Now every time I play cradle it comes up with problems in both lines 178 and 180 in the slic how can this be remedied.
|
|
|  |
 |
|
Boney
|
|
Thailand
Jan 2001 time: 05:17
|
|
The error says:
...disasters,slc.178:symbol'tmpdead' already has a type
and
...disasters,slc.180: symbol 'j' already has a type
I must say your reply was pretty quick
|
|
|  |
All times are GMT. The time now is 05:17. Apolyton Time is 00:17. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|