A small piece of code.

kairob

Biohazard
Joined
May 26, 2005
Messages
3,085
Location
The North
Could someone kindly help me with a problem. I wish to change the unhappiness and unhealthiness penalties for larger cities but do not have the necessary coding ability.

What I would want would be each pop after size 10 to give plus 2 unhappiness and plus 2 unhealthiness instead of just plus 1. I would be very grateful if anybody with more experience that myself would either show me how to do it or just provide the necessary code.

Thanks for any help. :)
 
There unfortunately is no easy way to do this with Python. Its really a SDK job - edit the calculation for city unhealthiness in the source code. Math, basically.

Sure, the extra health level can be changed dynamically on city growth with Python scripting. But it would be rather buggy since the city can shrink in size and then then the negative extra health needs to be reset changed to reflect the new city size. It might be possible, but I think you need a C++ mod for this. Good thing there are programmers abound... ;)
 
get.CityPopulation or whatever the code is, I am a bit lazy...

And then if CityPopulation =< (< is greater, right?) 10
Set.CityRealUnhealth something or whatever.

< means less than. Think of it the way I was taught: The sign is a little alligator that wants to eat the bigger number because he is very hungry. :)
 
Top Bottom