Thread Tools
Old January 9, 2002, 18:15   #1
The Raptor
Settler
 
Local Time: 13:09
Local Date: October 31, 2010
Join Date: Jan 2002
Location: Lincoln, NE
Posts: 14
Cradle plagues
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????
The Raptor is offline  
Old January 9, 2002, 18:22   #2
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 21:09
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
I agree, random events are cool but Cradle's plagues are a little over the edge... it's plain frustrating. I haven't gotten around to looking at the code yet, so I don't know how easily it can be changed. BTW does this code only work for human players of something? I never noticed the AI getting struck by a plague (plenty of earthquakes though)...
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old January 9, 2002, 19:43   #3
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
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
Immortal Wombat is offline  
Old January 9, 2002, 20:08   #4
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 21:09
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Okay, this explains a few things. First: why is CityCount (player[0].cities - 1)? This way the 'youngest' city of the empire never gets hit by a plague. This looks very odd: at one point, all my cities had shrunken to size 8 or thereabouts while 1 city was still size 45

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. 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
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old January 9, 2002, 22:15   #5
Boney
Call to Power II MultiplayerCall to Power Multiplayer
Warlord
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Jan 2001
Location: Thailand
Posts: 273
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.
Boney is offline  
Old January 10, 2002, 03:39   #6
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 21:09
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
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.
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

Last edited by Locutus; January 10, 2002 at 03:47.
Locutus is offline  
Old January 10, 2002, 09:06   #7
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
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
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

Last edited by Immortal Wombat; January 10, 2002 at 09:13.
Immortal Wombat is offline  
Old January 10, 2002, 12:44   #8
hexagonian
The Courts of Candle'Bre
Emperor
 
hexagonian's Avatar
 
Local Time: 14:09
Local Date: October 31, 2010
Join Date: Jun 1999
Location: Smemperor
Posts: 3,405
The percentages of plagues in Cradle are reduced by building the medical tree buildings (Apothecaries, Physician, Bathhouse and so forth).

I agree that the effects at this point in time are a little over the edge, especially since the effect is so powerful. I had tried to take out the line that would allow them to occur to the AI, so at least the same effect would be across the board, but I got a lot of SLIC errors, so I just reverted back to the original.

Send me a revised SLIC file and I'll post it.
__________________
Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
...aisdhieort...dticcok...
hexagonian is offline  
Old January 10, 2002, 15:17   #9
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
It shouldn't affect the AI anyway...

Here is an updated file. 50/50 chance in each city. 20% population killed off rather than 33%. Only for human, and should hit your youngest city now too.
Attached Files:
File Type: slc nd_main.slc (27.7 KB, 25 views)
Immortal Wombat is offline  
Old January 12, 2002, 10:21   #10
Boney
Call to Power II MultiplayerCall to Power Multiplayer
Warlord
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Jan 2001
Location: Thailand
Posts: 273
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 is offline  
Old January 12, 2002, 10:27   #11
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
What did the errors say?
I can't find any bugs in the attachment above, did you try that?
Probably you cut out a { or } where it shouldn't, or left it in. Could be that my cut-paste suggestion was wrong.
Immortal Wombat is offline  
Old January 12, 2002, 10:51   #12
Boney
Call to Power II MultiplayerCall to Power Multiplayer
Warlord
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Jan 2001
Location: Thailand
Posts: 273
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
Boney is offline  
Old January 14, 2002, 10:27   #13
hexagonian
The Courts of Candle'Bre
Emperor
 
hexagonian's Avatar
 
Local Time: 14:09
Local Date: October 31, 2010
Join Date: Jun 1999
Location: Smemperor
Posts: 3,405
I tried downloading the revised SLIC file and got a file with a lot of gibberish in it.

Ben, email me your revised file. Thanks

Dave
__________________
Yes, let's be optimistic until we have reason to be otherwise...No, let's be pessimistic until we are forced to do otherwise...Maybe, let's be balanced until we are convinced to do otherwise. -- DrSpike, Skanky Burns, Shogun Gunner
...aisdhieort...dticcok...
hexagonian is offline  
Old January 14, 2002, 12:05   #14
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 20:09
Local Date: October 31, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Quote:
Originally posted by Boney
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
Well, I was just leaving when I saw your reply, so I came back

I'll upload the fixed file to the Modders Depot this evening (GMT) and email it to Dave too. Sorry
Immortal Wombat is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 15:09.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team