How to display Civilization specific production modifier?

CivilizationAce

Warlord
Joined
Jan 17, 2017
Messages
240
I have a new mod that provides a bonus percentage to production of certain buildings, which brings me to the following:
Spoiler :

upload_2017-4-23_12-11-46.png

I'd like my bonus percentage to be listed after (or before, I'm not fussy) the "+5% (+0.5) from Amenities" when the user hovers their mouse over the total production amount and to show in the total.

As far as I can tell none of the effects of MODIFIER_PLAYER_CITIES_ADJUST_BUILDING_PRODUCTION display in this manner.

I doubt that it's going to be simple to rectify that, as the effect itself, EFFECT_ADJUST_BUILDING_PRODUCTION, is outside our reach, but does anyone know if the result is exposed in some way we can read with Lua?
 
If it's not already showing up, then probably the only way to do it is to create a custom version of the lua file which generates that particular tooltip. I think that's CityPanel.lua, but I'm not entirely sure.

Only downside to that is it'll make your mod incompatible with any other mod that replaces the same file. The player will get the version from whichever mod happens to load last.

There may be no way to check if the effect itself is in effect, but it should be simple enough to detect whatever the thing is that causes the effect. E.g. if the player is this civ type, of if the city has this building.
 
There are two building_production related effects and a few modifiers based on them. One effect works for only a specific building, and the other for all buildings in city.
  • If the second one is attached and working, the ToolTip displays 'from Modifiers' value. I'm sure of that because I'm currently using this modifier in my mod.
  • The first effect is applied to a specific building, and your city needs to be building that building for the effect to show. Otherwise the production value stays the same, and so does the ToolTip.
 
Thanks. I've looked at TruncateStringWithTooltip to see if that has something to do with it, but I'm dubious and I'm yet to find the function itself. Anyway now I need sleep. Maybe I'll take a look in the morning, but TBH this attempt to outdo the game itself now seems like unnecessary perfectionism, a sometime flaw of mine I'd rather not pander to, so I may settle for it not showing. The ETA still displays correctly at least – That's what counts. Either way I've set a tentative release date of Thursday (27 April) for my new playable civilization mod. It's i's are dotted and it's t's are crossed. I may fiddle with it a bit between now and then, but it's ready.
 
Back
Top Bottom