1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Question on Dummy Policies

Discussion in 'Civ5 - Creation & Customization' started by Troller0001, Apr 8, 2016.

  1. Troller0001

    Troller0001 Not an actual Troll

    Joined:
    Mar 9, 2016
    Messages:
    732
    Gender:
    Male
    Location:
    The Netherlands
    So I am currently trying to add the following to the game: Great people cost no maintenance.
    My idea is to use dummy policies which add 1, 2, 4, 8, 16, 32, 64 and/or 128 free maintenance units with help of the <BaseFreeUnits>-tag (Volunteer army tenet for reference). These policies would be applied/un-applied when great people are born/expended (using Lua). I however have a question upon adding dummy policies. My current setup:
    Spoiler :
    Code:
    <Policies>
    		<Row>
    			<Type>POLICY_NO_MAINTENANCE_COST_1</Type>
    		        <Description>TXT_KEY_POLICY_NO_MAINTENANCE_COST</Description>
    			<PolicyBranchType>POLICY_BRANCH_LIBERTY</PolicyBranchType>
    			<CultureCost>-1</CultureCost>
    			<BaseFreeUnits>1</BaseFreeUnits>
    			<Level>3</Level>
    			<PortraitIndex>25</PortraitIndex>
    			<IconAtlas>POLICY_ATLAS</IconAtlas>
    			<IconAtlasAchieved>POLICY_A_ATLAS</IconAtlasAchieved>
    		</Row>
                    ----other dummy policies------------
    </Policies>
    

    My questions:
    1. Would I need to add any <PolicyBranchType> here?
    2. Could I prevent the policy from being chosen by setting the <CultureCost> to -1?
    3. What does level do here?
    4. Am I missing some other important tags here?
    5. I know about the "player:SetNumFreePolicies(1)"-method. However, I also read about it breaking the game and making it so that a message doesn't show up if a new policy can be acquired. Has this been fixed already or has someone come up with a solution?
    6. When giving the desired player a free dummy policy (so that I can safely swap it with another dummy policy so that policy costs don't increase), their score should increase. Is there a way to remove this for the specific policy?
    7. Score increases when a player acquires a policy, does it also decrease when one is taken away?
    NOTE: I have a general idea of how I want to write the Lua file; I don't think I need help there (yet) :) :p

    Phew, that were quite some questions. Anyway, thanks if you decide to respond!

    -Troller0001
     
  2. Cyphose

    Cyphose y tho

    Joined:
    Feb 1, 2016
    Messages:
    181
    Gender:
    Male
    No, defining a PolicyBranchType is not necessary for dummy policies.
    Dummy policies, by their nature, cannot be chosen because they won't appear in any existing UI element to be chosen.
    It's for Ideologies and which tier their respective policies are on.
    Not that I can see. As a matter of fact, if anything, you have too many tags. Usually just defining a Type, Description, and portrait is all you need to do for dummy policies (discounting anything necessary for the policy itself, like <BaseFreeUnits>).
    I asked this same question in my own thread a short while back, and LeeS gave a wonderfully descriptive answer here.
    Not sure on the details regarding score, so you'll have to wait for an answer from someone more knowledgeable than I.
    You should never take a policy away without adding a placeholder to compensate, so this shouldn't be an issue. Read LeeS's post linked above for more details.

    Random side note: I'm not sure if your solution would work because I'm not acquainted with how unit maintenance is handled, but it seems like it should work in theory, anyway. Hopefully someone will appear that knows more about <BaseFreeUnit>'s exact functionality in relation to how you intend to use it.
     
  3. Troller0001

    Troller0001 Not an actual Troll

    Joined:
    Mar 9, 2016
    Messages:
    732
    Gender:
    Male
    Location:
    The Netherlands
    @Cyphose, Thanks for the reply and linked thread! :thumbsup: (Double :thumbsup: actually, there couldn"t have been a nicer explanation on the "notification" problem and it"s... solution?)
    (And now we wait for an answer to the score-question :p)


    EDIT:
    What about AI players? I don't want them choosing my 128*Free Unit upkeep policy :D

    EDITEDIT: For the score-problem, I can just give every player the dummy policy (without the buff) so that all of their scores are increased. It would prevent my target civ from having a tiny score advantage.
     
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,375
    Location:
    Near Portsmouth, UK
  5. Troller0001

    Troller0001 Not an actual Troll

    Joined:
    Mar 9, 2016
    Messages:
    732
    Gender:
    Male
    Location:
    The Netherlands
    @whoward69, Thanks for the link! Those are some good concerns.
    This could be a possible 'fix' for the prora-bug: Add a dummy building which adds a negative happiness (in my case -4 happiness since there'll be an additional 8 policies) within the city that has the prora. (Are there any other buildings that use the #of policies to buff the player?)

    As for the score bug, I'll just give every player the dummy (non buffing) policies as well, so that the score doesn't differ

    Since in this case I won't be changing the policies around too much (great people won't be generated as fast as something crazy as 19 per turn), I can live with the kiddy-coaster graph :)
    For the notification-bug, I guess I'll just break the original notification on purpose, and add the thing myself (as LeeS described in Cyphose's thread).
     
  6. Cyphose

    Cyphose y tho

    Joined:
    Feb 1, 2016
    Messages:
    181
    Gender:
    Male
    Just as with buildings, policies have flavors assigned to them (in <Policy_Flavors>). If you don't assign any flavors to your dummy policies (and why would you?), the AI won't ever use/try to adopt them because it doesn't know what the policy does.
     
  7. Troller0001

    Troller0001 Not an actual Troll

    Joined:
    Mar 9, 2016
    Messages:
    732
    Gender:
    Male
    Location:
    The Netherlands
    @Cyphose, ah, of course! Thanks! (That being said, I really shouldn't forget to add flavours to my buildings and units, which I have the tendency of doing)
     
  8. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,595
    Location:
    Illinois, USA
    Well, Neuschwanstein has no flavors...so where's the problem? :)
    Spoiler :
    perhaps in the fact the no AI ever builds it?
     
  9. bouncymischa

    bouncymischa Synthetic Genie

    Joined:
    Nov 28, 2012
    Messages:
    1,537
    Location:
    In a bottle
    A thought about buildings like Prora... when I made my Mothership Omicron bug, I experimented with a dummy policy that assigned -1 Happiness to my unique buildings, and it worked (although it caused the UI to look weird, since it'd list the building as providing "+-1 Happiness"). So couldn't each dummy policy just assign -X happiness to Prora?
     
  10. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,595
    Location:
    Illinois, USA
    Prora is 1 Happiness for every 2 policies, and the building-class happiness change from policies wants integer values.

    It's a tangled web we achieve when we try to mod this 'most moddable game'. William Howard's recently-added policy fixer code in VMC takes care of these irksome irritations, but then it means no other DLL mod can be used. Don't know if Gazebo plans to roll the social policy issue fixes into CP.

    You could 'fix' Prora by eliminating the column
    Code:
    <HappinessPerXPolicies>2</HappinessPerXPolicies>
    and then use lua to calculate how many happiness Prora ought to get based on 'real' policies adopted by the builder/owner of Prora, and adjust Prora's 'happiness' in one way or another. I don't remember whether HappinessPerXPolicies gives local or global happiness.

    Course, this method fails for any wonder added in a mod that has the same effect.
     
  11. Troller0001

    Troller0001 Not an actual Troll

    Joined:
    Mar 9, 2016
    Messages:
    732
    Gender:
    Male
    Location:
    The Netherlands
    I just realized that I could make the prora provide a free builiding upon completion, which would be the invisible dummy building. Essentially, since I provided every player with the same non-buffing dummy policies, they would all have 8 extra 'policies'. Doing some advanced mathematics, I came to the conclusion that my 'free dummy building' would need -4 unhappiness. It wouldn't require any lua, and would fix the bug for this specific mod! (I guess I'll just put a disclaimer in the description ;))
     
  12. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,595
    Location:
    Illinois, USA
    uh...you should test to confirm, but I am as sure as my faulty recollector can recall, <Happiness> and <UnModdedHappiness> ignore negative numbers. However, a policy with negative numbers for <ExtraHappiness> is implimented, although it displays directly in the calculations of empire happiness rather than against a building, and the way the top-panel displays such negative numbers is not as 'clean' as one would like.
     
  13. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,375
    Location:
    Near Portsmouth, UK
    It appears to be working today ;)

    Negative numbers are indeed ignored in those two columns (do I need to add "unless using a mo..." ... no I didn't think I did!)
     
  14. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    That should be in your signature, Howard.
     
  15. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,595
    Location:
    Illinois, USA
    "William". If he's anything like me, having someone refer to him by his family name is a bit too much like being teleported back into schooldays where the use of one's last name was too often a supercilious form of put-down.
     
  16. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Then, you should let him speak for himself.

    I use last names because it is more formal, shows respect.
     
  17. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,375
    Location:
    Near Portsmouth, UK
    Just don't call me "Who Ward" (or "who" for that matter)

    But I'd prefer "William" "W" or "whoward" ... LeeS is right in that "Howard" (usually with an exclamation mark at the end of it) has flash-backs to an all-boys school ... shudder!

    W
     
  18. JFD

    JFD Kathigitarkh

    Joined:
    Oct 19, 2010
    Messages:
    9,117
    Location:
    The Kingdom of New Zealand
    I cannot listen to this irreverance. And from a modder of the code, too! :p
     
  19. Troller0001

    Troller0001 Not an actual Troll

    Joined:
    Mar 9, 2016
    Messages:
    732
    Gender:
    Male
    Location:
    The Netherlands
    I guess adding one or two extra policies should do the trick then, thanks for the explanation! EDIT: Or I could simply remove the 2 <UnmoddedHappiness> that the prora provides, and then increase the cost of the wonder a little, so the cost reflects the stats it provides. (an extra +2 happiness when comparing it to the normal prora)

    Now, let's post some more messages to cover up the discussion about William's name ;) :p We don't want the moderators removing this thread :p ;)
     

Share This Page