Show Influence

Discussion in 'Civ5 - Mod Components' started by Moriboe, Mar 27, 2012.

  1. Moriboe

    Moriboe King

    Joined:
    Nov 30, 2010
    Messages:
    659
    Location:
    Belgium
    This is a simple mod that displays the influence of rival civilizations in the city state popup. It's useful alongside Gazebo's City State Diplomacy mod, for which I've witnessed influence go over 800. Good to know before trying to replace the culprit as ally. It looks like this:



    This component overrides InfoTooltipInclude.lua. For mods also overriding this file, a merge is in order. I tagged my changes with "Moriboe". I will show this information in my (main) mod only if there is a "consulate" in the city state (founded by a great merchant or a wonder), but this would further reduce compatibility, so I left it out here.
     

    Attached Files:

  2. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    nice addition
     
  3. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Helpful idea :thumbsup:
     
  4. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Out of interest, would it be possible to replace the CS' icon for it's allied major civ instead?
     
  5. Moriboe

    Moriboe King

    Joined:
    Nov 30, 2010
    Messages:
    659
    Location:
    Belgium
    I guess so. Interface stuff is exposed through lua, and the icon can already change as it goes red if you're at war. Go for it! ;)
     
  6. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Haha, Lua and I don't like each other much :lol:
     
  7. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,554
    Location:
    Near Portsmouth, UK


    In CityBannerManager.lua (around line 412) add the magenta bits

    Code:
            		--if( city:IsPuppet() or city:IsOccupied() ) then
            		--if( pOriginalOwner ~= player ) then
    			
    [COLOR="Magenta"]local iAlly = player:GetAlly() or -1
    if (iAlly ~= -1) then 
      local allyType = Players[iAlly]:GetCivilizationType();
      local allyInfo = GameInfo.Civilizations[allyType];
      IconHookup( allyInfo.PortraitIndex, 32, allyInfo.AlphaIconAtlas, controls.MinorIndicator );
    
      local textColour, backColour = Players[iAlly]:GetPlayerColors();
      local allyColour = textColour;
      allyColour.w = 1;
      controls.MinorIndicator:SetColor( allyColour );
    else[/COLOR]            	local _, originalColor = pOriginalOwner:GetPlayerColors();
                	originalColor.w = 1;
                	
    				civType = pOriginalOwner:GetCivilizationType();
    				civInfo = GameInfo.Civilizations[civType];
    				IconHookup( civInfo.PortraitIndex, 32, civInfo.AlphaIconAtlas, controls.MinorIndicator );
    				
    				controls.MinorIndicator:SetColor( originalColor );
    [COLOR="magenta"]end[/COLOR]
    				controls.MinorIndicator:SetHide( false );
    
     
  8. Moriboe

    Moriboe King

    Joined:
    Nov 30, 2010
    Messages:
    659
    Location:
    Belgium
    Awesome!
     
  9. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    Very cool
     
  10. Optional

    Optional Deity

    Joined:
    May 22, 2007
    Messages:
    2,935
    Location:
    It Dockumer Lokaeltsje
    I like this little mod. It's one I'm using. Also Whoward's modifications looks nice, I'll implement that.

    I'm not using many mods, no InfoAddict for me, that's way too much info for me, but I think it's reasonable that you know what stake some other civ has in a City State you are at friendly terms with. :goodjob:
     
  11. Moriboe

    Moriboe King

    Joined:
    Nov 30, 2010
    Messages:
    659
    Location:
    Belgium
    I changed it now to the way you say; before influence information would always be shown.
    See OP for v2. Influence is now also only shown for players you have already met. Before if an unkown civ adopted Aesthetics, you would learn of its existence.
     
  12. Optional

    Optional Deity

    Joined:
    May 22, 2007
    Messages:
    2,935
    Location:
    It Dockumer Lokaeltsje
    Ah, I need to re-download it then! I hadn't been trying to make a suggestion, I know the default game has some strange quirks of letting things happen between unknown parties, and I'm not sure what can be done against that, but I'm very happy with your mod!
    Also Whoward's modification to the CS banner I've implemented, and that works very nicely. I think the first time I checked for it it looked like it didn't work, but it turned out to be Russia's black logo against the black CS banner... With dark logo's it doesn't look so great, but overall I like it.
     
  13. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,554
    Location:
    Near Portsmouth, UK
    It's a trade off, either the dark ones look bad or the light ones look bad, you can always switch the text/back colours by changing the line

    Code:
    local allyColour = textColour;
    to

    Code:
    local allyColour = backColour;
    It is possible to work out the luminance/hue from the RGB values and then pick the brightest of the the two - but that's overkill!
     
  14. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    I lose upwards scrolling after adding the ally code and city banners also stay on top of everything - any ideas why?
     
  15. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,554
    Location:
    Near Portsmouth, UK
    Check the lua.log file for errors
     
  16. daviiadams

    daviiadams Prince

    Joined:
    Jul 7, 2011
    Messages:
    369
    Location:
    London
    I'm working on/off with updating my Government Buildings mod, which involves changes to TopPanel, so chances are it's more likely something I've done to that. Just don't remember any issues with city banners beforehand :)
     
  17. Mars83

    Mars83 Warlord

    Joined:
    Jun 13, 2011
    Messages:
    273
    Will this mod still work with the GaK DLC?
     
  18. llamapower

    llamapower Chieftain

    Joined:
    Jan 26, 2012
    Messages:
    64
    if you need to update it, would it be possible to add functionality that would add which religions are competing to influence the city state?
     

Share This Page