Sid Meier's Civilization VI

Sid Meier's Civilization VI

CQUI - Community Quick User Interface
This topic has been locked
the_m4a  [developer] 17 Mar, 2021 @ 1:43am
CIVITAS City States and CQUI Inline Quests
This is possible to do, the best thing to do is that CIVITAS integrates the CQUI inline CityState quest stuff -- if Seeling Cat is interested. I've reached out on Discord and we'll see if something can be worked out... I know there's lots of folks that like the default view for the quests and think the 2nd place suzerain makes things a bit cluttered. I'll offer to have it exist behind some option that can be enabled, etc.

See screenshot of what this looks like.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2427237898

To make this work, the changes should be made to CIVITAS. I haven't tested extensively yet but I believe this will work. It's also not perfect, as I think the right size of the panel gets cluttered. That said, it is pretty nice.

How to update Civitas City States Expanded with the CQUI Inline Quests and 2nd place Suzerain (at your own risk)
-- This works for Gathering Storm and probably Rise and Fall games. Like I said, I haven't tested extensively so I'm not sure.
-- Being familliar with XML and Lua would be useful here...
-- I suggest copying the original files that you'll be updating in case of error.
-- You *can* update these files while the game is running, it should update the UI accordingly.. but you should do the XML first and then the LUA. Until you have both files updated, things may look wonky.

CIVITAS City States Expanded is Mod #1331757859.

Navigate to the location of your Steam folder, to the workshop:

(YourSteamFolder)\steamapps\workshop\content\289070\1331757859\Core\Utilities\UI Replacements\XP1

In the file CityStates.xml file, you will be updating the "CityStateRowInstance" section.
  1. Find this line (around line 190):
    <Instance Name="CityStateRowInstance">
  2. Select everything from that line to the closing tag
    </Instance>
    (around line 270)
  3. Replace what you have selected with the XML snippet from my next reply to this discussion
  4. Save the XML file. If you have Civ6 open and if you did this correctly, you should see a bunch of "$CQUI_Quest$" appear below the City State icons/names in the list of City States.

In the CityStates_Expansion1.lua file, you will be adding a few things. There will be 3 separate chunks of code to paste in, which will all be in the 3rd reply I make to this discussion.
  1. Near the top of the file, right after the line
    local m_CityStateGovernors:table = {}
    , add the three lines from section 1 of my reply with the Lua code.
  2. In the function AddCityStateRow (around line 60), above the like that says
    return kInst;
    , insert the 96(!) lines of code from section 2 of my reply with the Lua code.
  3. At the absolute end of the file after the last line that simply says
    end
    , add the CQUI_RemoveQuestIconsFromString function, found in section 3 of my reply with the Lua code.
  4. Save the file. If you are running Civ6 while making these changes, you should now see the inline city state quests and 2nd place Suzerains on your City States panel.
Last edited by the_m4a; 17 Mar, 2021 @ 1:44am
< >
Showing 1-14 of 14 comments
the_m4a  [developer] 17 Mar, 2021 @ 1:45am 
This is the XML code for the CitStateRowInstance. See the directions in the first post.
<Instance Name="CityStateRowInstance"> <GridButton ID="CityStateBase" Size="parent,48" Style="SubContainer4" Color="59,62,63,255"> <!-- ==== CQUI Modification: changed Anchor and Offset value for Button ==== --> <BoxButton ID="Button" Anchor="L,T" Offset="8,4" Size="40,40" Color="0,0,0,0"> <Image ID="Icon" Anchor="L,C" Size="36,36" Texture="CivSymbols36" /> <!-- ==== CQUI Modification: changed Offset value for DiplomacyPip ==== --> <Image ID="DiplomacyPip" Anchor="L,B" Offset="-10,-2" Size="23,23" Texture="Diplomacy_RelationshipPips" /> <Label ID="QuestIcon" Anchor="L,T" Offset="-9,0" String="[ICON_CityStateQuest]" Size="28,28" /> </BoxButton> <!-- ==== CQUI Modification: added Anchor and changed OffsetY ==== --> <GridButton ID="NameButton" Anchor="L,T" Offset="42,11" Size="126,33" Texture="Controls_CityBannerSmall" SliceCorner="14,9" SliceSize="5,4" SliceTextureSize="33,28" Color="50,50,50,255"> <Label ID="NameLabel" Anchor="C,C" Offset="0,-2" Style="FontFlair11" SmallCaps="16" SmallCapsStyle="EveryWord" String="Name" /> </GridButton> <!-- ==== CQUI Modification: changed Anchor and Offset for Envoy ==== --> <Image ID="Envoy" Anchor="L,T" Offset="190,4" Size="40,40" Texture="Controls_CircleRim40"> <Button ID="EnvoyLessButton" Anchor="L,C" Offset="-6,0" Size="34,34" Texture="Controls_Stepper" AnchorSide="O,I" FlipX="1" /> <Button ID="EnvoyMoreButton" Anchor="R,C" Offset="-6,0" Size="34,34" Texture="Controls_Stepper" AnchorSide="O,I" /> <Label ID="EnvoyCount" Anchor="C,C" Offset="-1,1" String="0" Style="FontFlairLua" Color="160,160,160,240" /> </Image> <!-- ==== CQUI Modification: changed AnchorY and OffsetY ==== --> <Image ID="BonusImage1" Anchor="L,T" Offset="256,3" Size="29,42" Texture="CityState_BonusSlotOff"> <Label ID="BonusText1" Anchor="R,T" Offset="3,2" Style="FontNormal12" String="1" /> <Image ID="BonusIcon1" Anchor="C,B" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="104,0" /> </Image> <!-- ==== CQUI Modification: changed AnchorY and OffsetY ==== --> <Image ID="BonusImage3" Anchor="L,T" Offset="286,3" Size="29,42" Texture="CityState_BonusSlotOn"> <Label ID="BonusText3" Anchor="R,T" Offset="3,2" Style="FontNormal12" String="3" /> <Image ID="BonusIcon3" Anchor="C,B" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="104,0" /> </Image> <!-- ==== CQUI Modification: changed AnchorY and OffsetY ==== --> <Image ID="BonusImage6" Anchor="L,T" Offset="316,3" Size="29,42" Texture="CityState_BonusSlotOn"> <Label ID="BonusText6" Anchor="R,T" Offset="3,2" Style="FontNormal12" String="6" /> <Image ID="BonusIcon6" Anchor="C,B" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="104,0" /> </Image> <!-- ==== CIVITAS/CQUI: Add Bonus for 10 Envoy ==== --> <Image ID="BonusImage10" Anchor="L,T" Offset="346,3" Size="29,42" Texture="CityState_BonusSlotOn"> <Label ID="BonusText10" Anchor="R,T" Offset="3,2" Style="FontNormal12" String="10" /> <Image ID="BonusIcon10" Anchor="C,B" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="104,0" /> </Image> <!-- ==== CQUI Modification: Changed AnchorY and OffsetY, SizeX of SuzerainStatus container changed from 108 to 110 in order to fix a spacing issue ==== --> <Container ID="SuzerainStatus" Anchor="L,T" Offset="376,3" Size="110,42"> <Grid ID="BonusImageSuzerainOff" Size="parent,parent" Texture="CityState_BonusSlotBigOff" SliceCorner="31,21" SliceTextureSize="34,42" /> <Grid ID="BonusImageSuzerainOn" Size="parent,parent" Texture="CityState_BonusSlotBigOn" SliceCorner="31,21" SliceTextureSize="34,42" /> <!-- ==== CQUI Modification: Moved SuzerainLabel and Suzerain above BonusTextSuzerain and BonusIconSuzerain, changed Anchors and Offsets ==== --> <Label ID="SuzerainLabel" Anchor="L,T" Offset="32,2" Style="FontNormal10" String="LOC_CITY_STATES_SUZERAIN" /> <Label ID="Suzerain" Anchor="L,C" Offset="46,0" Style="FontNormal10" String="LOC_CITY_STATES_NONE" TruncateWidth="60" /> <!-- ==== CQUI Modification: Changed Anchor and Offset for BonusTextSuzerain ==== --> <Label ID="BonusTextSuzerain" Anchor="L,C" Offset="32,0" Style="FontNormal10" String="4" /> <Image ID="BonusIconSuzerain" Anchor="L,B" Offset="2,0" Size="26,26" Texture="EnvoyBonuses26" TextureOffset="156,0" /> <!-- ==== CQUI Modification: Added SecondHighestName and SecondHighestEnvoys ==== --> <Label ID="SecondHighestEnvoys" Anchor="L,B" Offset="32,2" Style="FontNormal10" /> <Label ID="SecondHighestName" Anchor="L,B" Offset="46,2" Style="FontNormal10" TruncateWidth="60" /> </Container> <Button Hidden="1" ID="LookAtButton" Anchor="R,C" Offset="10,-7" Size="23,31" Texture="Controls_ShowMe" StateOffsetIncrement="0,0" ToolTip="LOC_CITY_STATES_LOOK_AT" /> <!-- ==== CQUI Modification: Changed AnchorY and OffsetY ==== --> <Button ID="AmbassadorButton" Anchor="R,T" Offset="7,5" Size="22,22" Texture="XP1_GovernorsCityBannerFill22" TextureOffset="66,0" StateOffsetIncrement="0,0" ToolTip="LOC_CITY_STATE_PANEL_HAS_AMBASSADOR_TOOLTIP" /> <Label ID="TypeLabel" Anchor="L,C" Offset="125,0" Style="FontNormal16" Hidden="1" String="[ICON_Faith]Religious" Note="DEPRECATED" /> <Label ID="QuestsLabel" Anchor="L,C" Offset="250,0" Style="FontNormal16" Hidden="1" String="[COLOR_GREEN]![ENDCOLOR]" /> <GridButton ID="GiveTokenButton" Anchor="L,C" Offset="270,0" Size="140,32" Style="MainButton" Hidden="1" String="Send Envoy" /> <Label ID="CurrentTokensLabel" Anchor="L,C" Offset="415,0" Style="FontNormal16" Hidden="1" String="Current Tokens" /> <Label ID="TypeBonusLabel" Anchor="L,C" Offset="510,0" Style="FontNormal16" Hidden="1" String="Next Bonus" /> <Label ID="UniqueBonusLabel" Anchor="L,C" Offset="620,0" Style="FontNormal16" Hidden="1" String="Most Tokens Y/N?" /> <!-- <GridButton ID="LevyMilitaryButton" Anchor="R,C" Offset="150,0" Size="140,32" Style="MainButton" Hidden="1" String="Levy Military"/> <GridButton ID="ChangeWarStateButton" Anchor="R,C" Offset="0,0" Size="140,32" Style="MainButton" Hidden="1" String="Declare War!"/> --> <!-- ==== CQUI Modification: Added QuestRow to show text of the CityState quest ==== --> <Grid ID="QuestRow" Size="parent,23" Anchor="L,B" Offset="0,0" AutoSize="H"> <Label ID="CityStateQuest" Anchor="L,C" Offset="12,2" String="$CQUI_Quest$" Style="FontNormal10"/> </Grid> </GridButton> </Instance>
the_m4a  [developer] 17 Mar, 2021 @ 1:50am 
Here is the Lua code. See directions above. All three parts are required.

Section 1: Constants to put near the top of the file
local CITYSTATEBASE_DEFAULT_SIZEY :number = 48; local CQUI_InlineCityStateQuestFontSize = 10; local ICON_NAMES = {"%[ICON_TechBoosted%] ", "%[ICON_CivicBoosted%] ", "%[ICON_TradeRoute%] ", "%[ICON_Barbarian%] "};

Section 2: Code to add to the AddCityStateRow function
-- ==== BEGIN CQUI Modification ==== ---- -- CQUI Inline City State Quests anyQuests = false; for _,kQuest in pairs( kCityState.Quests ) do anyQuests = true; questString = kQuest.Name; end if (anyQuests) then kInst.QuestIcon:SetHide(true); -- Adjust the size of the container based on the font size of the Inline City State Quest kInst.CityStateBase:SetSizeY(CITYSTATEBASE_DEFAULT_SIZEY + CQUI_InlineCityStateQuestFontSize - 2); kInst.QuestRow:SetHide(false); kInst.CityStateQuest:SetFontSize(CQUI_InlineCityStateQuestFontSize); kInst.CityStateQuest:SetString(CQUI_RemoveQuestIconsFromString(questString)); kInst.CityStateQuest:SetColor(kCityState.ColorSecondary); else kInst.CityStateBase:SetSizeY(CITYSTATEBASE_DEFAULT_SIZEY); kInst.QuestRow:SetHide(true); end -- Determine the 2nd place (or first-place tie), produce text for Tooltip on the EnvoyCount label local envoyTable:table = {}; -- Iterate through all players that have influenced this city state local localPlayerID = Game.GetLocalPlayer(); for iOtherPlayer,influence in pairs(kCityState.Influence) do local pLocalPlayer :table = Players[localPlayerID]; local civName :string = "LOCAL_CITY_STATES_UNKNOWN"; local isLocalPlayer:boolean = false; if (pLocalPlayer ~= nil) then local pPlayerConfig :table = PlayerConfigurations[iOtherPlayer]; if (localPlayerID == iOtherPlayer) then civName = Locale.Lookup("LOC_CITY_STATES_YOU") .. " (" .. Locale.Lookup(pPlayerConfig:GetPlayerName()) .. ")"; isLocalPlayer = true; else if (pLocalPlayer:GetDiplomacy():HasMet(iOtherPlayer)) then civName = Locale.Lookup(pPlayerConfig:GetPlayerName()); else civName = Locale.Lookup("LOCAL_CITY_STATES_UNKNOWN") end end table.insert(envoyTable, {Name = civName, EnvoyCount = influence, IsLocalPlayer = isLocalPlayer}); end end if (#envoyTable > 0) then -- Sort the table by value descending, alphabetically where tied, favoring local player table.sort(envoyTable, function(a,b) if (a.EnvoyCount == b.EnvoyCount) then if (a.IsLocalPlayer) then return true; elseif (b.IsLocalPlayer) then return false; else return a.Name < b.Name; end else return a.EnvoyCount > b.EnvoyCount end end); local envoysToolTip = Locale.Lookup("LOC_CITY_STATES_ENVOYS_SENT")..":"; for i=1, #envoyTable do envoysToolTip = envoysToolTip .. "[NEWLINE] - " .. envoyTable.Name .. ": " .. envoyTable.EnvoyCount;
end

kInst.EnvoyCount:SetToolTipString(envoysToolTip);

if (#envoyTable > 1 and kInst.SecondHighestName ~= nil) then
-- Show 2nd place if there is one (recall Lua tables/arrays start at index 1)
-- The check on kInst.SecondHighestName is for cases where another mod replaces the XML, but not the citystates lua file
local secondPlaceIdx = 2;

-- is there a tie for first?
if (envoyTable[1].EnvoyCount == envoyTable[2].EnvoyCount) then
-- Already sorted above, so this is either local player or the leader appearing first alphabetically
secondPlaceIdx = 1;
end

local secondHighestIsPlayer = envoyTable[secondPlaceIdx].IsLocalPlayer;
local secondHighestName = envoyTable[secondPlaceIdx].Name;
local secondHighestEnvoys = envoyTable[secondPlaceIdx].EnvoyCount;

if (secondHighestIsPlayer) then
secondHighestName = Locale.Lookup("LOC_CITY_STATES_YOU");
end

-- Add changes to the actual UI object placeholders, which are created in the CityStates.xml file
kInst.SecondHighestName:SetColor(secondHighestIsPlayer and kCityState.ColorSecondary or COLOR_ICON_BONUS_OFF);
kInst.SecondHighestName:SetText(secondHighestName);
kInst.SecondHighestEnvoys:SetColor(secondHighestIsPlayer and kCityState.ColorSecondary or COLOR_ICON_BONUS_OFF);
kInst.SecondHighestEnvoys:SetText(secondHighestEnvoys);
end
end

-- ============ END CQUI Modification ===================[/code]

Section 3: The CQUI_RemoveQuestIconsFromString function
function CQUI_RemoveQuestIconsFromString( inStr:string ) local lookupStr :string = inStr; local outStr :string = lookupStr; for _,iconName in ipairs(ICON_NAMES) do if (string.find(lookupStr, iconName)) then outStr = string.gsub(lookupStr, iconName, ""); end end return outStr; end
Thank your so much for your effort! I'll give this a shot in a few days when I have time!
Wonderful! I got it working! Thanks again so much for your help! Did sailor cat get back to you on discord?
Hmmm.. So, my list is only showing one city state and not any more.. I initially had some trouble with your instructions.


Originally posted by the_m4a:
Select everything from that line to the closing tag
</Instance>
(around line 270)

You said the instance to replace up until should be around 270, but that's in the middle of an instance, with many more instance before and after it. BUT, after you paste your code, the last instance of yours is around 268 for me, so I'm not sure if that's the line you were referring to. The very last closing tag of </instance> is line 323.

Could you please let us know the line of the </instance> on the CIVITAS XML to replace?


Originally posted by the_m4a:
In the function AddCityStateRow (around line 60), above the like that says
return kInst;
, insert the 96(!) lines of code from section 2 of my reply with the Lua code.

So around line 60 (Also I think you made a typo saying like instead of line), has a string of text with kinst, but the return kinst; is line 82. So I pasted your 96 lines between

end
**Your 96 lines of text**
return kInst;


Here are the pastebins of the 2 files
https://pastebin.com/TcBsYzTb
https://pastebin.com/U7ZmGmuL

Here is a screenshot of what it looks like after I've met multiple city states (I'd tried normal games and it was the same thing)
https://pasteboard.co/JTqNxcA.png
Last edited by =[NK]= Col. Jack O'Neil; 19 Mar, 2021 @ 8:51pm
Also, if you don't have the mod for additional zooming out, you should! I editted his values much further though
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=871412359
Also also, I've noticed a problem that right clicking the send envoy doesn't go away. I feel like I noticed this the other day but didn't really pay attention to it. Not sure if it's related.
the_m4a  [developer] 20 Mar, 2021 @ 11:11pm 
I did hear from Sailor Cat - I offered to integrate the inline stuff into their mod. May do that in the next few days. Nice tip on the camera one, too, I'll have to check that out. Not sure what you mean on the right-click send envoy?
To dismiss the notification on the bottom right. Not the little notification, it stops the end turn. I need to end up hitting shift enter
the_m4a  [developer] 23 Mar, 2021 @ 10:39pm 
I'll have to look at that... it's probably a CIVITAS thing - maybe it's blocking the end turn stuff. Not sure offhand.
No pressure at all as I appreciate all the help you've already done, but any luck with integrating the mods? I haven't seen anything on the changelogs regarding it :)
the_m4a  [developer] 5 Apr, 2021 @ 8:37pm 
I dunno - I will have to ask... I made a pull request over on the GitHub set up for that mod.. https://github.com/seelingcat/CIVITAS-CSE-Release/pull/1
Thank you :)
the_m4a  [developer] 12 Jun, 2021 @ 9:48pm 
CIVITAS has this built in now, so I am locking this thread
< >
Showing 1-14 of 14 comments
Per page: 1530 50