Mod that lowers city population when a unit is created?

sman1975

Emperor
Joined
Aug 27, 2016
Messages
1,370
Location
Dallas, TX
Does anyone know of a mod that reduces the city's population when a unit is trained and/or purchased in a city?

I'm working on a mod that needs this kind of capability. I've referred to @Machiavelli24's snippet here (as well as several other posts that reference this mod):

https://forums.civfanatics.com/threads/unit-created-event.547441/

Overall, the functions work quite well. However it relies on a "dummy promotion" to mark units that were just created. My problem with that, is the dummy promotion appears in the Unit Panel in the lower left-side of the game screen, and also in the Civilopedia - reusing the "Blitz" promotion icon. For those a***-retentive types such as myself, these artifacts harm the immersive quality of the mod.

So, if anyone knows of a mod that actually has already solved this problem (removing pop by 1 for each unit created/purchased), or a way to hide the dummy promotion from the Unit Panel UI and Civilopedia (a solution that doesn't require replacing the UIs), please let me know.

Thanks!
 
Thanks, @whoward69 - I found the answer about 2 "oh-no seconds" after I posted this. Sent a report to the moderators to delete the post entirely.

The best method to use was found, ironically, at that link you sent, specifically this one:

Code:
GameEvents.CityTrained(ownerId, cityId, unitId, bGold, bFaithOrCulture)

It provides exactly the functionality I needed, plus reminded me that I can't simply rely on the Modiki for everything.

This particular method fires any time a unit is trained or bought (via gold, faith, or culture), which easily allowed me to know when I should test to see if that city's (cityId) population should be dropped.

Thanks, and sorry for the interruption... :crazyeye:
 
This particular method fires ...

I know, I wrote the code :)

Everyone of those events were taken from my DLL mod and added to the base game
 
Firaxis took your code and added it? Man, talking about stretching the Modiquette to the limit! :lol:

Dare I ask if they threw a bob or two your way for the effort? :lol:

Seriously, that's quite a reference. I'm amazed (even moreso today) at your contributions to this game, and to making my mods what they are. I don't think any modder on the forum would have made even half their contributions if not for you.

So thanks, again!
 
Read the small print of the game you're playing and you'll see that Firaxis have the rights to use anything players develop for it - no remuneration required.
 
Top Bottom