I thought he was referring to the overall branches, since that's the only time I've seen the tech prereq used.
![]()
I thought he was referring to the overall branches, since that's the only time I've seen the tech prereq used.
![]()
This way you could have a specific tech like "Monarchy" for example, unlock an entire Monarchy policy branch and not just the policy itself.
I'm pretty sure you can. What the UI shows as a branch is internally treated as the first policy in a tree; it's POLICY_TRADITION, POLICY_LIBERTY, and so on. So it's still listed in the same table as the rest, which means it still has the same TechPrereq field. Sure, the UI probably can't display that prereq even with my fix, but it SHOULD work.
It's kind of unfortunate because I totally agree that it should work.
-- Policy is locked
else
--thisPolicyIcon.Lock:SetTexture( lockTexture );
thisPolicyIcon.MouseOverContainer:SetHide( true );
--thisPolicyIcon.Lock:SetHide( true );
thisPolicyIcon.PolicyIcon:SetDisabled( true );
--thisPolicyIcon.Lock:SetHide( false );
--thisPolicyIcon.PolicyIcon:SetVoid1( -1 );
thisPolicyIcon.PolicyImage:SetColor( fadeColorRV );
IconHookup( policyInfo.PortraitIndex, 64, policyInfo.IconAtlas, thisPolicyIcon.PolicyImage );
-- Tooltip
-- START OF NEW CODE
local TechPrereq = policyInfo.TechPrereq;
if( TechPrereq == nil ) then
strTooltip = strTooltip .. "[NEWLINE][NEWLINE]" .. Locale.ConvertTextKey("TXT_KEY_POLICY_CANNOT_UNLOCK");
else
local TechID = 0;
local TechDesc = "";
for tech in GameInfo.Technologies() do
if( tech.Type == TechPrereq ) then
TechID = tech.ID;
TechDesc = tech.Description;
end
end
local tNum = player:GetTeam();
if( Teams[tNum]:IsHasTech(TechID) ) then
strTooltip = strTooltip .. "[NEWLINE][NEWLINE]" .. Locale.ConvertTextKey("TXT_KEY_POLICY_CANNOT_UNLOCK");
else
local strPText = Locale.ConvertTextKey( TechDesc );
strTooltip = strTooltip .. "[NEWLINE][NEWLINE]" .. Locale.ConvertTextKey("TXT_KEY_POLICY_CANNOT_UNLOCK_TECHPREREQ", strPText);
end
end
end
<Language_en_US>
<Row Tag="TXT_KEY_POLICY_CANNOT_UNLOCK_TECHPREREQ">
<Text>[COLOR_WARNING_TEXT]Requires the[ENDCOLOR] [COLOR_POSITIVE_TEXT]{1_TechType:textkey}[ENDCOLOR] [COLOR_WARNING_TEXT]Technology.[ENDCOLOR]</Text>
</Row>
</Language_en_US>
for row in GameInfo.Policies(processCondition) do
local buttonName = "B"..tostring(buttonNum);
local thisButton = thisTechButtonInstance[buttonName];
if thisButton then
IconHookup( row.PortraitIndex, textureSize, row.IconAtlasAchieved, thisButton );
-- IconHookup( 0, textureSize, "GENERIC_FUNC_ATLAS", thisButton );
thisButton:SetHide( false );
local strPText = Locale.ConvertTextKey( row.Description );
thisButton:SetToolTipString( Locale.ConvertTextKey("TXT_KEY_POLICY_TECHPREREQ", strPText ) );
buttonNum = buttonNum + 1;
end
end
<Language_en_US>
<Row Tag="TXT_KEY_POLICY_TECHPREREQ">
<Text>{1_PolicyType:textkey} policy unlocks.</Text>
</Row>
</Language_en_US>
Ah, the Civ5 Mantra. (Not to be confused with "It's all a game, I should really just relax".)
When I get home I'll post my change to SocialPolicyPopup that displays tech prerequisites. (There's also a small XML component for the text keys, of course.) I HIGHLY recommend adding it to a mod if you're going to start tweaking policy tech prerequisites. I also edited TechButtonInclude to display the unlocked policy's icon in the tech tree at the tech in question, again with an XML bit, but I've changed so many other things in that file that it might be harder to splice into your own mods.
Thing is, after using it for a while now, I can say that tech prerequisites for policies are a bit... awkward. Remember that you can't (by default) save up policies, and culture generation is not very "tunable"; like research, it's basically set by your cities and what they have in them, so outside of choosing whether or not to work a Landmark or certain natural wonders, or Artist specialists, there's not much you can adjust if you need just a little more/less culture for a few turns. (Research is the same way, but I find myself running Scientist specialists way more often than Artists.) So if you make the tech prereqs too restrictive, then the player could be left without good choices, while delaying by even a turn or two would make a huge difference. The AI, for obvious reasons, would not be as good at this as a human.
Also, it's very all-or-nothing. My own mod adds one additional policy to each of the ten trees, and only that one policy has a tech prerequisite, all of which fall in my future eras. So there's a lot of backtracking, as you grab, say, all but the final Tradition or Liberty policy in the early eras and then come back several millenia later for the final policy. (The final Tradition policy is actually the LAST of the ten to unlock.)
If you were to do this organically, with EVERY policy having a distinct prerequisite, then this'd work a bit better. But it'd also be more prone to balance issues, so it's a hard thing to balance.
Yet another question; Can you assign policies based off an event like completing the construction of a building?