1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[BNW] Custom TopPanel ?

Discussion in 'Civ5 - SDK / LUA' started by Ohura196, Apr 12, 2021.

  1. Ohura196

    Ohura196 Chieftain

    Joined:
    Apr 17, 2020
    Messages:
    16
    Gender:
    Male
    Location:
    Japan
    Namely, "X gold earned by trait"
    What if I want to display this in the top panel?
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    You'll need to be more specific, where exactly in the top panel?
     
  3. Ohura196

    Ohura196 Chieftain

    Joined:
    Apr 17, 2020
    Messages:
    16
    Gender:
    Male
    Location:
    Japan
    For example, JFD's The Confederation of Switzerland receives 10% gold income of other civilizations, which is written in the section of this image.

    ss.png
     
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,532
    Location:
    Near Portsmouth, UK
    I don't know the answer off the top of my head to this, so this is how I found the file
    1) Using a good quality search tool (I use Agent Ransack), search all the game xml files for "available to spend" - this gives one file CIV5GameTextInfos_WorldView.xml
    2) Open this file, search for the text and find the associated TXT_KEY (it's TXT_KEY_TP_AVAILABLE_GOLD)
    3) Now search all the lua files for this TXT_KEY, it's in TopPanel.lua
    4) I have 5 of these, so I open the one from Expansion2 and search for the key, in my copy it's on line 543 and lines 547 to 561 is the code that generates the green text, so you'll need to make a mod that replaces TopPanel.lua with one of your own and add your required changes.

    It should be noted that changing TopPanel.lua is not recommended if you're going to redistribute your mod as it will conflict with things like EUI and VP. It would be better to replace just the GoldTipHandler, but you'll need to understand UI tooltip processing to implement that.
     
  5. Troller0001

    Troller0001 Watching from a safe distance

    Joined:
    Mar 9, 2016
    Messages:
    747
    Gender:
    Male
    Location:
    The Netherlands
    I'm unsure how up-to-date it is (and even if people even use it anymore), but JFD made a top-panel replacement for modders: https://forums.civfanatics.com/threads/dynamic-top-panel.548485/#post-13849057

    I believe, however, that Suktritact's MCIS is more popular for commonly used "mod-support" since (IIRC) it doesn't replace any of the core game files: https://forums.civfanatics.com/threads/sukritacts-modular-city-info-stack.539332/
    It's also a bit more dynamic since it allows for fancy stuff like triggering popups.
     
  6. Ohura196

    Ohura196 Chieftain

    Joined:
    Apr 17, 2020
    Messages:
    16
    Gender:
    Male
    Location:
    Japan
    GoldTipHandler seems to be getting to the heart of the matter. To change it externally, I think you need a code like this...
    Code:
    ContextPtr:LookUpControl("/InGame/TopPanel/GoldPerTurn"):
    When I saw it once, I didn't understand it, but I think it's actually powerful tool.
     

Share This Page