Simple Mod Request

Goweigus

Chieftain
Joined
Jan 25, 2008
Messages
63
Can anyone make it so that city populations cannot increase if you checked that box to avoid growth? I really miss this from Civ IV
 
the city governor is actually pretty good in civ5. I'm not sure what you mean, does the avoid growth button not work as you expected it to?
 
No one else has this problems? Checking the avoid grow box usually does reduce food production but it never actually keeps the population from going up another notch if the city is producing excess food.
 
Bump?

Can anyone keep populations from tipping over and raising in Civ V? I really hate that there is nothing I can do short of manually controlling exactly what tiles and buildings a city works so its population doesn't go up

I just want it to be like in Civ IV where if I tell a city to avoid growing, it won't actually grow once its stock piled enough food.
 
I'll happily take a look at doing this. I have been bit by this same problem. Instead of burning surplus food, the mayor starts using horrible tiles that not only have less food, but also have less gold and production. If there aren't a lot of tile options, citizens start idling, and sometimes the city grows regardless.

Tonight, I'll see what I can do.
 
Thanks a lot! Vanilla Civ V is freaking hard enough without losing happiness because I can't control the population for squat...
 
Got something very ugly working at the moment.

At the start of each of the player's turns, it removes all stockpiled food from those cities that have Avoid Growth checked. I need to test it a bit more to make sure it does in fact work when food yields are sufficient for growth in a single turn. Furthermore, the display growth time is obviously incorrect. Correcting this would be easy, but would require some entirely non-modular changes to UI files. Evenfurthermore, upon unchecking Avoid Growth, the surplus food is not restored to it's original value, and must begin accumulating from nothing.

I'm going to test hooking instead into the city population change event, and see if I can make anything work from there. I don't hold much hope for this approach though. Upon growth I expect to see a notification stating that city x has grown, followed by a one indicating that city x has shrunk. We'll see how it goes.
 
Got something very ugly working at the moment.

At the start of each of the player's turns, it removes all stockpiled food from those cities that have Avoid Growth checked. I need to test it a bit more to make sure it does in fact work when food yields are sufficient for growth in a single turn. Furthermore, the display growth time is obviously incorrect. Correcting this would be easy, but would require some entirely non-modular changes to UI files. Evenfurthermore, upon unchecking Avoid Growth, the surplus food is not restored to it's original value, and must begin accumulating from nothing.

I'm going to test hooking instead into the city population change event, and see if I can make anything work from there. I don't hold much hope for this approach though. Upon growth I expect to see a notification stating that city x has grown, followed by a one indicating that city x has shrunk. We'll see how it goes.

Is it possible to simply reduce the stockpiled food by the amount of food that is added each turn instead of removing it all together ?
 
Man... I wish I was smart/skilled enough to figure this kind of stuff out and change it like you guys can.

Awesome I can live with having to restart with no food supply :P
extra credit points if there are no error messages or interface bugs of some sort
 
Is it possible to simply reduce the stockpiled food by the amount of food that is added each turn instead of removing it all together ?

I can't say that it isn't. I can only say that I haven't found a way to do so, such that it works properly. I must say that I didn't get to spend a whole lot of time on it last night, either.

The limitation appears to be the event hooks. There are two likely candidate event hooks, one that fires at the start of the human player's turn, and one that fires at the end of the human player's turn. The problem I face is that everything happens in an effectively atomic manner in between these two events.

So, let's say that a city is 1 surplus food from growing. I click on end turn, and immediately deduct X food from the surplus, where X was the food income for the turn I just completed. During the between turn shuffle, that annoying barb galley that was blockading the city gets bored and moves away. Food income increases by 1. At the start of the next turn, before my mod has a chance to evaluate the situation, the city has grown.

If I combined this with a notification listener that checked only for growth notification in those towns that have avoid growth checked, it might work, although you would likely see two separate notifications if a city in this condition were to attempt to grow. I shall likely need to look into this no matter which implementation method I finally settle on.

I rather suspect there is a more elegant way to do this, but I'm completely new to modding civ 5. Matter of fact, this is the very first mod I've made, other than retracing Kael's (fantastic) guide. As for wishing you can mod, don't bother. Just do it. I have never used, or even looked at a single line of Lua until civ 5 modding. Don't be intimidated, and above all else, ask questions if you get stuck. Start with small and simple, and I bet you'll be surprised by how simple it can be.

EDIT: I can remove any lingering interface concerns without too much effort. The only problem with this is that the mod will immediately lose it's entirely modular nature. By changing anything in the UI (for instance I would like to display a * as the number of turns until growth occurs, as well as display the surplus food in a different colour font), I need to change a core file. If another mod needs to make a UI alteration to that same component, suddenly these two mods do not function well together. It is unfortunately that this is how it has been implemented, but it's the nature of the beast, in so far as I know it.
That said, I will definitely be making the UI changes for my own personal playing pleasure, and the mod I publish will include them. I expect to have it completed tonight by the way. I'll post the name here once it has been completed.
 
Cool and thanks! I could probably live with a little interface error/message if it means it won't break compatibility with other mods. Will it still have an issue with resetting surplus food to 0?
 
I'll let you know as soon as I do. I'll be taking another stab at it tonight. I will likely make two versions on it: one which integrates seamlessly with other mods, and one with a more polished UI. After all, I need the practise.
 
Maybe something similar to Wealth/Research could be added ? Foreign Export or something that converts 100% of excess food to gold ? This would give additional gold to allow improvements/units to be purchased rather than built..
 
Camping and whatnot got in the way of my modding schedule, so it took until today to get the modular version published.

It's listed under Gameplay mods. Name is Prohibit Growth - Modular.

The only real imperfection I've come across is that if your city would have normally grown, you will receive the notification for city growth, even though the population will be reset before your turn. The non-modular version will address this and pretty a few things up.

EDIT:
Okay, so the game's doing something a bit odd. Even though the population of the city doesn't expand, it appears that the number of assignable citizens (specialists and tile workers) increases as if the city had grown. Eventually this leads to a city of population one being able to work all tiles in it's vicinity. Something is fishy.
 
Something is always fishy, sometimes our noses just don't smell it...? lol
Thanks for the effort, don't jeopardize any camping trips for this! Thanks
 
Okay, fixed that problem, but in testing it brought another to light.

Specifically, during the brief period between when your population grows, and your population gets reset to remove potential growth, city income is calculated. Meaning you receive the production/food/gold from that phantom citizen.

I have one thing left to try, although it removes the guarantee of modularity. That is to override the population growth notification, and readjust the population there, and then pray that this notification is queue before city income is calculated. A long shot, I know, but it's all I have left at the moment.

Camping's done now, so it's all good. Even have tomorrow off too! Woo!

EDIT:
Well, unfortunately, my idea didn't work. It would seem that it performs the increase to population and the following increment to production before I'm allowed to have any input in the process. That means that unless there is another approach lurking out there, it will be impossible to do properly before we have better access to the game logic. Gonna keep digging for a while longer yet, but my hopes are no longer as high as they once were. Especially since a bug in ModBuddy appears to prevent me uploading a new version.
 
Back
Top Bottom