Regarding Social Policies

Putmalk

Deity
Joined
Sep 26, 2010
Messages
2,652
Location
New York
Oh boy.

That time has come, the time where I have absolutely no idea what I'm doing. I'm about to edit the social policies of my Mesopotamia scenario, and I'm going to need help.

I know my way around adding effects and deletions and updates, but I do have questions regarding the Social Policies. And nobody had answered on the 2K forums so this is my best shot.

1) How do I replace the Social Policy pictures? Last I checked, there was no atlas or portrait index to specify. I'm specifically referring to the large Social Policy Tree pictures (the Patronage painter, for example). PolicyBranchTypes.xml doesn't have portraits, and I'm pretty sure the IconAtlas referred to by the PolicyTypes.xml is the small icons, not square pictures.

2) How do I completely remove a Policy Branch? I've tried this myself, using the Polynesia scenario as a reference, and it doesn't seem to have deleted the trees. I've deleted the individual policies but the branches still remain. I've since reverted all changes, now I need help with this one. Does it involve messing with the LUA code?

3) Any specific dimensions for the Policy Branch artwork?

I thought I had more questions than this, but these are the first things that come to mind. Thanks for any help.
 
1) How do I replace the Social Policy pictures? Last I checked, there was no atlas or portrait index to specify.

The names of the graphical files are hard-set inside SocialPolicyPopup.xml (in the UI/InGame/Popups directory). See my own mod for an example of how to change this; I've added an 11th branch, complete with picture.

2) How do I completely remove a Policy Branch? I've tried this myself, using the Polynesia scenario as a reference, and it doesn't seem to have deleted the trees.

Standard Delete in the PolicyBranchTypes table. The problem is that SocialPolicyPopup.lua hard-codes the names of the branches it's expecting, so if you're creating new ones, you'll have to alter that file. Again, see my own mod for an example.

3) Any specific dimensions for the Policy Branch artwork?

Yes. I don't remember the value offhand, but it's in SocialPolicyPopup.xml; I can check it when I get home, although you could look it up much more quickly. The values picked are specifically set such that 10 pictures in that 2x5 arrangement, plus the titles and borders, exactly fit a 1024x768 screen without the need for scrollbars, so it's somewhere in the neighborhood of 200x350ish.
 
You're the best. I'll scour the social policy popup files then. :)

Hardcoding is always a terrible way to program.

neighborhood of 200x350ish

190x290. Thanks, though! Appreciate it.
 
I'll be honest, I'm stumped. :P See attachments.

Added in the Slavery policies, but it screws up the entire UI; for some reason, every past Honor gets messed up. Didn't change anything in the LUA, didn't think I had to.

I was going to post the XMLs and LUA but it's ridiculously long.

Brief description:

1. Deleted Piety policies
2. Added Slavery policies, and prereqs
3. Updated Piety branch to refer to new Slavery policies/title
4. Deleted policy branch restrictions
5. Made Autocracy and Rationalism restrictive (they're renamed to Monotheism and Polytheism)

Can't see why the buttons would screw up here. Any ideas on what might be causing the issue?
 

Attachments

  • policybugfix_1.jpg
    policybugfix_1.jpg
    129 KB · Views: 116
  • policybugfix_2.jpg
    policybugfix_2.jpg
    148.9 KB · Views: 72
Didn't change anything in the LUA, didn't think I had to.

You'd think wrong. The branch names are hard-coded into the Lua; there's no way around it, if you're adding new branches then you need to modify at least four different places within SocialPolicyPopup.lua.

I was going to post the XMLs and LUA but it's ridiculously long.

That's what attachments are for. Zip 'em up and attach them.

Can't see why the buttons would screw up here. Any ideas on what might be causing the issue?

Many ideas, but without the code I couldn't tell you. The pipes are drawn using a separate bit of logic from the buttons, and you have to change both.
 
You'd think wrong. The branch names are hard-coded into the Lua; there's no way around it, if you're adding new branches then you need to modify at least four different places within SocialPolicyPopup.lua.



That's what attachments are for. Zip 'em up and attach them.



Many ideas, but without the code I couldn't tell you. The pipes are drawn using a separate bit of logic from the buttons, and you have to change both.

But I didn't change the branch names, I updated the Piety branch. I deleted policy names and added new ones for Piety, though. I'll zip em up. Your help is greatly appreciated, and if you can fix this problem, you'll be thanked in the mod as well. :D
 

Attachments

1> First of all:
Code:
<Update>
  <Set>
    <EraPrereq>ERA_CLASSICAL</EraPrereq>
  </Set>
  <Where>
    <Type>POLICY_BRANCH_AUTOCRACY</Type> 
    <Type>POLICY_BRANCH_RATIONALISM</Type>
    <Type>POLICY_BRANCH_PATRONAGE</Type>
  </Where>
</Update>

Set and Where both use an implicit AND syntax, which'd make the above mean "where Type is equal to autocracy, rationalism, AND patronage", which is obviously never going to trigger. You might want to double-check that one, but it wouldn't be the thing causing this all to break.

2> You deleted a number of policies, but you didn't delete the entries in all of the other tables for those policies, like the Flavor ratings and, more importantly, the PREREQUISITES. Just because you deleted the entry in the <Policies> table doesn't mean you can safely ignore all of those other tables; the Lua code uses quite a few of those others.

There's a DeleteMissingReferences function that you can try, or you could just brute-force it and delete them by hand. But the thing is, the pipe commands in SocialPolicyPopup.lua are set based on entries in the prerequisite table, and if you don't remove the unused ones there, it'll try to draw a connection to a policy that no longer exists (and therefore has no X or Y value). This would break things.

There might be more, and I'll look through the files, but start with those.
 
Thanks Spatz for those suggestions, but the result is still, sadly, the same. Any other ideas? If not, I'll just resort to updating old policies with the next text. That is brute forcing though, and very annoying.
 
Back
Top Bottom