Dynamic TopPanel Yields

JFD

Kathigitarkh
Joined
Oct 19, 2010
Messages
9,132
Location
The Kingdom of New Zealand
This is a mod designed to allow modders to add custom Yield Per Turn rates to the Top Panel with an associated Tooltip, without the need for complicated workarounds such as by overwriting the TopPanel.lua file. It will also be used by mod-users to allow that support. This mod is compatible with any mods which edit the TopPanel (including EUI, and Health and Plague), but may have odd interactions with those which already use similar methods to add values to the TopPanel (such as my Armenia civ, which adds a new source of Faith Per Turn. This will be updated asap). These methods should be depreciated into using the one prepared here. In the case of EUI, a special edition of this mod will be necessary to accommodate the differences in Tooltip structure, but this will come later.

aXuckRu.jpg


Important This version is currently outdated and won't be used for a while. P&P has the latest version.

It should be noted that this mod will be incorporated into my Piety & Prestige mod, as that mod makes more robust changes to the Faith and Culture tooltips.

Download

Mods with support:

JFD's The Kingdom of Hungary
JFD's The Holy Roman Empire

For Users

Download and install the mod as any other.

For Modders

Using this mod is fairly simple. All you need is this file, which will explain the process of adding a new YieldPerTurn + Tooltip to the TopPanel.

Please let me know of any bugs, and if anyone would like me to expand this to allow tooltips to be added to other parts of the TopPanel.

Changelog

  • 6/11: Fixed a bug with the Culture Per Turn display
    7/11: Fixed an issue where the playerID wouldn't pass to the string functions.
 
For some reason, this:

Code:
local numGold = loadstring("return " .. sourceFunction .. "(iPlayerID)")()

doesn't work. The player ID parameter is valid, but it won't pass it to the function (maybe not possible?).

So for now I've switched it to Game.GetActivePlayer(), but if anyone knows why the above didn't work, please let me know.
 
Out of curiosity, does this mod allow the display of new yields on the top bar? I've considered making civs that generated new yields (for example, something like "Mana" for a magical fantasy civ). According to ViceVirtuoso, making the yield within the game isn't terribly hard, but getting it to display on the top bar as part of the UI is the tricky part. So I'm curious if this mod would enable that...
 
Out of curiosity, does this mod allow the display of new yields on the top bar? I've considered making civs that generated new yields (for example, something like "Mana" for a magical fantasy civ). According to ViceVirtuoso, making the yield within the game isn't terribly hard, but getting it to display on the top bar as part of the UI is the tricky part. So I'm curious if this mod would enable that...

You could if you didn't mind tacking the new yield onto an existing one. It would show up adjacent to that existing one, and, if clicked, would send you to the same place as the existing one. It would also use that existing one's tooltip. It can work for what you need, if there is a relationship between the new yield and an existing one. I do this with Piety, which is added to the Faith part of the TopPanel.

The variables must be global.

Ah, okay. Thanks
 
It's not presently in a state that I can support, as quite a few changes have been made to the P&P version since. I'll need to update this version, but I don't know when that'll be. If there's a reason you need it other than for use with my mods, then I'll look at hurrying the update.
 
Back
Top Bottom