Sid Meier's Civilization VI

Sid Meier's Civilization VI

RwF: Dark Age Policies
Madisonian 28 Oct, 2021 @ 11:48pm
Broken Government panel fix
Hi,

So after applying all the known fixes from the comments on the various RwF Policy mods and RwF Government Overview, I was still having the problem with the Fill Policy/Government window not opening with this Dark Ages mod enabled.

I'm not very familiar with Lua but I took a look at the GovernmentScreen_Expansion1.lua file and compared it to the same file from the game files. It seemed like the game files were using 'expansionPolicy' and 'GameInfo.Policies_XP1[policy.PolicyHash]' in certain spots instead of 'policy' and 'GameInfo.Policies[policyType]' so I changed each instance to more closely match the official game files.

The Dark Ages lua file was also using 'Governments_JFD_DarkCard' instead of the 'Governments_DarkCard' that's declared in the RwF Government Overview mod so I changed that as well.

Now my Government panel works again with all the RwF Policy mods enabled (except for Technical policies since I can't figure out what's bugged there and have it disabled). If anyone more knowledgeable is able to double-check my work and make sure I did things properly, that'd be much appreciated.

Here is the updated lua code, just copy/paste over all the other data in LUA>UI>Overrides>GovernmentScreen_Expansion1.lua of the Dark Ages Policy mod folder and save. (Back up the original file to be safe.)

-- Copyright 2018, Firaxis Games include("GovernmentScreen"); BASE_GetPolicyBGTexture = GetPolicyBGTexture; BASE_PopulateLivePlayerData = PopulateLivePlayerData; BASE_RealizeFilterTabs = RealizeFilterTabs; -- =========================================================================== function FilterDarkPolicies(policy) local policyDef = GameInfo.Policies_XP1[policy.PolicyHash]; if policyDef ~= nil and policyDef.EraScore < 0 then return true; end return false; end -- =========================================================================== function FilterGoldenPolicies(policy) local policyDef = GameInfo.Policies_XP1[policy.PolicyHash]; if policyDef ~= nil and policyDef.EraScore > 0 then return true; end return false; end -- =========================================================================== function GetPolicyBGTexture(policyType) local expansionPolicy = GameInfo.Policies_XP1[policyType]; if expansionPolicy and policy.EraScore < 0 then return "Governments_DarkCard"; elseif expansionPolicy and policy.EraScore > 0 then return "Governments_GoldenCard"; end return BASE_GetPolicyBGTexture(policyType); end -- =========================================================================== function PopulateLivePlayerData( ePlayer:number ) if ePlayer == -1 then return; end BASE_PopulateLivePlayerData(ePlayer); if(ePlayer == Game.GetLocalPlayer() and m_kUnlockedPolicies) then local eraTable:table = Game.GetEras(); if eraTable:HasDarkAge(ePlayer) and Game.GetCurrentGameTurn() == eraTable:GetCurrentEraStartTurn() then for policyType, isUnlocked in pairs(m_kUnlockedPolicies) do if isUnlocked then local expansionPolicy = GameInfo.Policies_XP1[policyType]; if expansionPolicy and policy.EraScore < 0 then m_kNewPoliciesThisTurn[policyType] = true; elseif expansionPolicy and policy.EraScore > 0 then m_kNewPoliciesThisTurn[policyType] = true; end end end end end end -- =========================================================================== function RealizeFilterTabs() BASE_RealizeFilterTabs(); CreatePolicyTabButton("LOC_GOVT_FILTER_DARK", FilterDarkPolicies); CreatePolicyTabButton("LOC_GOVT_FILTER_GOLDEN", FilterGoldenPolicies); end
Last edited by Madisonian; 29 Oct, 2021 @ 12:02am
< >
Showing 1-2 of 2 comments
Madisonian 29 Oct, 2021 @ 12:20am 
One thing I'm uncertain about are whether the 'policy.EraScore' lines also need to be changed to 'expansionPolicy.EraScore' or not since it's written slightly different to allow for the policies to be slottable outside of a Dark Age.

For example, the game files have entries that look like this:

expansionPolicy.RequiresDarkAge

But the original Dark Ages lua uses this instead:

policy.EraScore < 0

So while my Government panel now opens with my above fix, I would like to be sure that the lua code is written correctly and working properly from someone more knowledgeable, if anyone could lend a hand.
Last edited by Madisonian; 29 Oct, 2021 @ 12:20am
bbbbbruh 22 Jan @ 11:03pm 
This fix actually broke my government panel, not sure why.
< >
Showing 1-2 of 2 comments
Per page: 1530 50