Mod for multiple Policy-screens?

Skajaquada

Crazy Engineer
Joined
Mar 4, 2007
Messages
134
Did anyone ever make one? There's a suggestion in the multiple tech-tree threads but I can't find anything about one. If not was there a reason like some obstacle making it impossible? Just thought I'd ask before I re-invent the wheel.

Otherwise I'll give it a try. It doesn't seem too complicated, I was thinking a button on the left-hand side of the panel with the Advanced View-button to the right would be a nice place to flip through the Policy-types.

Going through the SocialPolicyPopup.lua-file I was thinking letting the button limit the loop in the UpdateDisplay-function up and down. Though I haven't done any custom-UI modding I suspect the XML-file sets the position and size of all the frames as I can't find anything about it in the LUA-code. Then I'm thinking I can simply define copies of branches with the same positions in the XML-file.
 
Did anyone ever make one? There's a suggestion in the multiple tech-tree threads but I can't find anything about one. If not was there a reason like some obstacle making it impossible? Just thought I'd ask before I re-invent the wheel.

Otherwise I'll give it a try. It doesn't seem too complicated, I was thinking a button on the left-hand side of the panel with the Advanced View-button to the right would be a nice place to flip through the Policy-types.

Going through the SocialPolicyPopup.lua-file I was thinking letting the button limit the loop in the UpdateDisplay-function up and down. Though I haven't done any custom-UI modding I suspect the XML-file sets the position and size of all the frames as I can't find anything about it in the LUA-code. Then I'm thinking I can simply define copies of branches with the same positions in the XML-file.

FiresForever created a multiple social policies mod. I believe it was incorporated into one of the last versions of Dec/Procylon's Call to Power mod.
 
Thanks, it's great to know there's a way in-case I fail horribly.

Looking at all the Policy-files makes me imagine they're generating separate Policy-screens all-together. I might still look into my way of printing several windows over each-other and hiding them (mostly for fun, plus I've been looking for an excuse to learn the UI-modding). That event for the advanced check-box seem to be doing something similar so I guess it's a start.
 
Yeah the way i created the multiple policy mod for CTP was to just create a new policy page for each different group of ten policies. The reason for doing it this way was simply because it was a quick fix and didn't require that many changes, the method you are wanting to do is of course the better way of implementing it. I didn't comment the files but if you take one eg. socialpoliciesgovernments.xml and .lua, and compare it side by side with the original popup then the changes should be quite obvious and should help you a bit :). Good luck
 
This is how it worked out. I basically just added this part to the SocialPolicyPopup.lua:

Code:
----------------------------------------------------------------
-- Checkboxes to switch Policy-views.
----------------------------------------------------------------
function OnTerra( bIsChecked )
	-- Simulate radio-button
	if (bIsChecked ~= true) then
		Controls.TerraInfo:SetCheck( true );
		return;
	end
	Controls.MilitaryInfo:SetCheck( false );
	Controls.ChaosInfo:SetCheck( false );
	-- Resize the main window
	Controls.EntirePolicyGrid:SetSize( { x = 1005; y = 768; } );
	-- Show the selected policies and hide the rest
	Controls.TopTerraStack:SetHide( false );
	Controls.BottomTerraStack:SetHide( false );
	Controls.BottomHorizontalTrim:SetHide( false );
	Controls.MilitaryStack:SetHide( true );
	Controls.ChaosStack:SetHide( true );
	-- Resize the trim
	Controls.TopHorizontalTrim:SetSize( { x = 970; y = 5; } );
	Controls.MiddleHorizontalTrim:SetSize( { x = 970; y = 5; } );
	-- Offset the baubles to fit new size
	Controls.PolicyInfo:SetOffsetVal( 0, 0 );
	Controls.UtopiaBox:SetOffsetVal( 0, 0 );
	Controls.InfoStack:SetOffsetVal( 200, 20 );
	Controls.InfoStack2:SetOffsetVal( 450, 20 );
	Controls.PlayerTitleLabel:SetOffsetVal( 0, 6 );
end
Controls.TerraInfo:RegisterCheckHandler( OnTerra );

function OnMilitary( bIsChecked )
	-- Simulate radio-button
	if (bIsChecked ~= true) then
		Controls.MilitaryInfo:SetCheck( true );
		return;
	end
	Controls.TerraInfo:SetCheck( false );
	Controls.ChaosInfo:SetCheck( false );
	-- Resize the main window
	Controls.EntirePolicyGrid:SetSize( { x = 1005; y = 478; } );
	-- Show the selected policies and hide the rest
	Controls.TopTerraStack:SetHide( true );	
	Controls.BottomTerraStack:SetHide( true );
	Controls.BottomHorizontalTrim:SetHide( true );
	Controls.MilitaryStack:SetHide( false );
	Controls.ChaosStack:SetHide( true );
	-- Resize the trim
	Controls.TopHorizontalTrim:SetSize( { x = 970; y = 5; } );
	Controls.MiddleHorizontalTrim:SetSize( { x = 970; y = 5; } );
	-- Offset the baubles to fit new size
	Controls.PolicyInfo:SetOffsetVal( 0, 0 );
	Controls.UtopiaBox:SetOffsetVal( 0, 0 );
	Controls.InfoStack:SetOffsetVal( 200, 20 );
	Controls.InfoStack2:SetOffsetVal( 450, 20 );
	Controls.PlayerTitleLabel:SetOffsetVal( 0, 6 );

end
Controls.MilitaryInfo:RegisterCheckHandler( OnMilitary );

function OnChaos( bIsChecked )
	-- Simulate radio-button
	if (bIsChecked ~= true) then
		Controls.ChaosInfo:SetCheck( true );
		return;
	end
	Controls.TerraInfo:SetCheck( false );
	Controls.MilitaryInfo:SetCheck( false );
	-- Resize the main window
	Controls.EntirePolicyGrid:SetSize( { x = 1200; y = 478; } );
	-- Show the selected policies and hide the rest
	Controls.TopTerraStack:SetHide( true );	
	Controls.BottomTerraStack:SetHide( true );
	Controls.BottomHorizontalTrim:SetHide( true );
	Controls.MilitaryStack:SetHide( true );
	Controls.ChaosStack:SetHide( false );
	-- Resize the trim
	Controls.TopHorizontalTrim:SetSize( { x = 1165; y = 5; } );
	Controls.MiddleHorizontalTrim:SetSize( { x = 1165; y = 5; } );
	-- Offset the baubles to fit new size
	Controls.PolicyInfo:SetOffsetVal( -190, 0 );
	Controls.UtopiaBox:SetOffsetVal( -190, 0 );
	Controls.InfoStack:SetOffsetVal( 245, 20 );
	Controls.InfoStack2:SetOffsetVal( 575, 20 );
	Controls.PlayerTitleLabel:SetOffsetVal( 95, 6 );
end
Controls.ChaosInfo:RegisterCheckHandler( OnChaos );

In addition to the new policies and copies of the layout in the XML-file as well as a bunch of new ID-attributes. The biggest "find" was how the Control-object lets me select elements and then change their attributes. I've attached some pictures of how it looks.

Btw, anyone know if there's some create-command for the Control-object to create the XML-elements for layout? I think it could be fun releasing this as a mod if I could wrap it up by generating everything from the fields in the PolicyBranchTypes-table (of-course adding fields for row, column, picture and category).
 
They're in SocialPolicyPopup.xml. You need to replace it and the LUA-file with VFS set to true and nothing else, then the pictures need VFS set to true as well. Just include the pictures without any file-path for the Texture-attributes.
 
They're in SocialPolicyPopup.xml. You need to replace it and the LUA-file with VFS set to true and nothing else, then the pictures need VFS set to true as well. Just include the pictures without any file-path for the Texture-attributes.

Got it. Thank you:)

The files are in UI folder instead of XML folder...That's why I didn't find them.
 
Back
Top Bottom