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

New modder looking for some pointers on a custom Civ

Discussion in 'Civ5 - Creation & Customization' started by DarkScythe, May 14, 2014.

  1. DarkScythe

    DarkScythe Hunkalicious Holo

    Joined:
    May 6, 2014
    Messages:
    804
    Hello, everyone!

    I am new around here, and to Civ, and modding in general, so I know there is still much more I need to learn, and I am hoping that I may receive some assistance from all the knowledgeable folk here.

    First, and foremost, I'd like to say that a seeing a bunch of the Touhou Civs, and Vicevirtuoso's Civs on the workshop inspired me to try and make a Civ of my own.

    To that end, I'm working on my first ever mod for this game, and I'm quickly running into situations where I'm not too sure how to proceed.

    I'm still reading through various tutorials and guides and such, but while I'm doing that, I am also planning out my Civ's strengths and weaknesses.

    One thing that has me stumped right now is whether or not it is possible to mod or alter the amount of food consumed by all Specialists.
    I believe they currently consume 2 food each, same as a regular citizen, but I want to increase that only for those assigned to the Specialist slots.
    From scouring the XML files (inside the BNW folder, anyway) I see there's a policy for HalfSpecialistFood and also a few tables set to variants of SpecialistYields. However, HalfSpecialistFood does the opposite of what I want to do, and I don't believe I can set a negative food amount in the Yields, unless I am mistaken?

    Is there any way to do this, or do I have to scrap this idea?

    Thanks, everyone!
     
  2. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    The Policies command HalfSpecialistFood is a true/false command, so you wouldn't be able to adjust the amount of food other than by halving it with that command.

    The real questions are:
    1. which expansions do you have? It's always nice to know because there are some commands that are only available to BNW, for example, and will simply cause any mod to fail if attempted to run on say, Vanilla CIV5. Not saying any of those apply to specialists (can't remember any off the top of my head, anyway), but there are such commands.
    2. are you wanting to adjust specialist's food consumption only for a custom civ or across the board for all civs?
     
  3. DarkScythe

    DarkScythe Hunkalicious Holo

    Joined:
    May 6, 2014
    Messages:
    804
    I have BNW, and am planning on making this Civ BNW-only.
    It relies heavily on the "international' trade route system introduced in BNW, and I don't think I can make it work nearly as well with Vanilla or G&K.

    I am looking to adjust the food consumption only for this custom Civ, and not across the board. I am using this as a sort of counterbalance for my Civ (among other things.)

    By the way, LeeS, I am reading through your fairly extensive advanced XML building guide as well, and it is incredibly informative. You have my many thanks for compiling those massive 4 pages of information. If only the rest of the game's moddable systems like units and promotions were similarly well-documented!
     
  4. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    :lol:Only fairly extensive? I thought I was beating the completeness horse to death with a stick :lol:

    Serious: Nice ! Glad it's of use.
     
  5. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    Oof! Have to give that some thought. I was afraid that was where you wanted to go. Hopefully one or other of the really big brains on the forum will give some feedback in the meantime.
     
  6. bouncymischa

    bouncymischa Synthetic Genie

    Joined:
    Nov 28, 2012
    Messages:
    1,537
    Location:
    In a bottle
    Hmmm... in the <Trait_SpecialistYieldChanges> table, can you set a specialist to produce -1 Food?
     
  7. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    I would think you should be able to. That's kind of where my thinking was heading. I've never actually tried it, though.

    It would make the specialist consume a total of 3 food from the city yield box, I would think.

    Darkscythe,

    You could test it on an existing civ. If I were going to test it using Korea as my guinea pig, I'd want this as part of a test mod:

    Code:
    </GameData>
    	<Trait_SpecialistYieldChanges>
    		<Row>
    			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
    			<SpecialistType>SPECIALIST_ARTIST</SpecialistType>
    			<YieldType>YIELD_FOOD</YieldType>
    			<Yield>-1</Yield>
    		</Row>
    		<Row>
    			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
    			<SpecialistType>SPECIALIST_WRITER</SpecialistType>
    			<YieldType>YIELD_FOOD</YieldType>
    			<Yield>-1</Yield>
    		</Row>
    		<Row>
    			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
    			<SpecialistType>SPECIALIST_MUSICIAN</SpecialistType>
    			<YieldType>YIELD_FOOD</YieldType>
    			<Yield>-1</Yield>
    		</Row>
    		<Row>
    			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
    			<SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
    			<YieldType>YIELD_FOOD</YieldType>
    			<Yield>-1</Yield>
    		</Row>
    		<Row>
    			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
    			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
    			<YieldType>YIELD_FOOD</YieldType>
    			<Yield>-1</Yield>
    		</Row>
    		<Row>
    			<TraitType>TRAIT_SCHOLARS_JADE_HALL</TraitType>
    			<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
    			<YieldType>YIELD_FOOD</YieldType>
    			<Yield>-1</Yield>
    		</Row>
    	</Trait_SpecialistYieldChanges>
    </GameData>
    TRAIT_SCHOLARS_JADE_HALL is the XML-name for Seajong's leader trait.
     
  8. DarkScythe

    DarkScythe Hunkalicious Holo

    Joined:
    May 6, 2014
    Messages:
    804
    Yeah, I had the same thoughts as you two, and I haven't tried it yet, but the reason I haven't is because I believe in my searching for information about that parameter I came across some information that said it could not be a negative yield (or it'd be treated as zero, or something.)

    I suppose I can try that, though I'm not sure how to go about that without making a new Civ.
     
  9. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,528
    Location:
    Near Portsmouth, UK
    You can, but it won't have any effect, as that's one of the (many) tables that Firaxis (unnecessarily) ignore negative values in

    Code:
    for(int iSpecialistLoop = 0; iSpecialistLoop < GC.getNumSpecialistInfos(); iSpecialistLoop++)
    {
      int iChange = trait->GetSpecialistYieldChanges((SpecialistTypes)iSpecialistLoop, (YieldTypes)iYield);
      [B][COLOR="Red"]if(iChange > 0)[/COLOR][/B]
      {
        Firaxis::Array<int, NUM_YIELD_TYPES> yields = m_ppaaiSpecialistYieldChange[iSpecialistLoop];
        yields[iYield] = (m_ppaaiSpecialistYieldChange[iSpecialistLoop][iYield] + iChange);
        m_ppaaiSpecialistYieldChange[iSpecialistLoop] = yields;
      }
    }
    
     
  10. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    Whoward69, Am I correct in my interpretation of this code that <Building_SpecialistYieldChanges> would also be a no go ? I've used positive Food in that table, but I never tried negative.

    Would he be able to create the "3 food consumed by specialists" effect for his civ through an lua (or dll) ?
     
  11. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,528
    Location:
    Near Portsmouth, UK
    The C++ (DLL) code is spaghetti. Just because X works one way does not mean Y works the same; just because Yield A under X works one way doesn't mean Yield B under X works the same way. You pretty much have to track them through the C++ code on a case by case basis.
     
  12. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    I'll just have to run a test on that table then. No problem. :)

    And from everything you've said elsewhere wrt this sort of thing, "spaghetti" seems an apt description.
     
  13. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,528
    Location:
    Near Portsmouth, UK
    And is if to prove my point ...

    Code:
    for(iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
    {
      for(iJ = 0; iJ < NUM_YIELD_TYPES; iJ++)
      { 
        changeSpecialistExtraYield(((SpecialistTypes)iI), ((YieldTypes)iJ),
     (pBuildingInfo->GetSpecialistYieldChange(iI, iJ) * iChange));
      }
    }
    
    Building_SpecialistYieldChanges can take negative numbers!
     
  14. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    And I just whomped up a unique palace and tested it all with a little help from our friend IGE. Works!
     
  15. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    Darkscythe,

    Let me clean do some clean-up on the file I used to test concept for a replacement palace that will subtract the specialist food yields. I'll post it here as a link to a mediafire file sharing address.

    I've been having internet connection problems all day so I might take a while to get back to you again.
     
  16. LeeS

    LeeS Imperator Supporter

    Joined:
    Jul 23, 2013
    Messages:
    7,139
    Location:
    Illinois, USA
    You can tack-on just about anything you want to try out to an exisiting civ if you know the leader's actual XML trait-name and the XML-name of the civ.

    Civilizations and Leaders is a link to a mediafire file share "dropbox" where I've shown all the firaxis-made civs, their leader names, and leader traits as they must appear in XML. You can download it to your desktop if you wish.

    Special American Palace is a link to a mediafire file share "dropbox" where I've shown all the commands necessary to add a unique palace to CIV America that has the commands "built-in" to make every specialist type except unemployed citizens consume 1 more food than normal. No other changes to the palace are made. So far as the player would be concerned there wouldn't seem to be any difference. The extra palace for America will show up as an extra building in the civilopedia, but the text and icon will be the same as is used by the usual palace.


    All you would have to do to subtract a food yield to every specialist for America is:

    1. Create a mod in ModBuddy.
    2. ADD > EXISTING XML file in ModBuddy
    3. Tell ModBuddy in the "Mod Properties > Actions" Tab to do a "OnModActivated", "Update Database", and file-name of the XML-file.
    4. Save the Mod
    5. Build the Mod
    6. Build the Mod Solution
    7. Go look for the Mod in the Game's MODS menu so you can enable it, and test the outcome of the mod in-game.

    When you're ready to start building your civ all you would need to do is change "CIVILIZATION_AMERICA" to the name of your custom CIV. This change would be to the <CivilizationType> in the <Civilization_BuildingClassOverrides> table at the very top of the file. It wouldn't actually be necessary to make any changes anywhere else in the Palace_Neg_Specialist_Food.xml file.

    Of the steps I listed, at least 6 of them are required for any Mod you wish to create. So, this list may seem a little daunting at first, but remember you're going to need to learn to do all those to create your custom civ. A little practice with ModBuddy and with creating XML files really is a good policy to follow.

    If you haven't found a tutorial yet showing how to do things in ModBuddy, you might try this one on the steam workshop. Ceej12's guide.

    If you haven't actually tried to build a mod in ModBuddy yet my advice would be to follow either ceej12's guide or whichever other tutorial you may have found, and actually build yourself a small mod so that when you go to build your civilization you are at least confident that you are doing everything correctly so far as operating ModBuddy is concerned. There are bunches of mods on the Steam Workshop that don't actually do anything because the Mod Author never learned how to use ModBuddy correctly.

    And I've been having nothing but troubles with my internet connection this morning. If you see this and respond back, any delay in my responding back again to you is to do with my internet connection.
     
  17. Vicevirtuoso

    Vicevirtuoso The Modetta Man

    Joined:
    May 14, 2013
    Messages:
    775
    Location:
    The Wreckage, Brother
    You know, when I told you to look at the policies to change Specialist food consumption, it never occurred to me that it could just be a boolean value for half consumption -- didn't actually look at the Policies table for it. I still give Firaxis too much credit...my bad! :blush:
     
  18. DarkScythe

    DarkScythe Hunkalicious Holo

    Joined:
    May 6, 2014
    Messages:
    804
    Jeez, you guys are fast!
    I was agonizing over how to modify my Civ's bonuses and penalties last night, eventually giving up and heading to bed. I get up and you guys have solved this already!

    This inconsistency seems like it would be extremely annoying, to say the least. Unfortunately, I'm not sure how to check the DLL, and that C++ code confuses me. If it needs to be handled on a case-by-case basis, I hope no one minds if I have to impose myself a little bit more on your knowledge as I continue to run into these sort of limitations.

    You certainly went out of your way to be helpful; I appreciate it!
    No worries about your internet connectivity -- you've posted multiple times and even tested before I had a chance to get on today, lol.

    For what it's worth, I have not created any mods before, but I figure the best way to learn is to just dive right in, so my very first mod is this Civ, and all it entails. I've already started work on it within ModBuddy, and have the basic skeleton XML files ready, I'm just at the stage where I need to build the Uniques, and as such, is where I ran into these roadblocks.

    For guides, I saw you link to that Steam Workshop one on your Building XML thread, and I've also got Kael's Modder's Guide and LuvToBuild's (incomplete) Newbie reference guide open. They were certainly helpful for getting the skeleton files built quickly, but at this point I need to make the UA, UB, UU, and all the diplomatic responses (and the artwork. Oh god, the artwork. I am so bad at it.)

    In any case, I should have been a bit clearer -- sorry.
    What I meant to say was that I wasn't sure how I would go about modifying a stock Civilization, like America, just to test a building without having the entire Civ turned into a mod. But, come to think of it, I suppose that's where the <Update> tag comes in handy. I will check out your Special palace file and see how it goes. I also assume that if I wanted those unemployed citizens to also consume more food that I'd add SPECIALIST_CITIZEN to the list as well (if I'm interpreting the XML correctly, I think this is how they are defined.)

    Haha, no worries at all!
    It was a good starting point for me to look, and I found a few other things digging through the Policies. It also gave me what I needed to start poking through the Building, Trait, Unit, and Promotion schemas as well.

    With all that said, I have a few more 'issues' that I need to resolve, and I will be searching for solutions as time, and my Google-fu, permits. However, I'll put some of them here in case you guys already know the answer, or if you can confidently say that it is impossible with only XML (and maybe LUA) editing.

    (In that vein, is there any sort of LUA reference or guide?)
    1) I'll probably need to make invisible dummy buildings to distribute to every city, in order to have Specialists in every city consume 3 food, unless Building_SpecialistYieldChanges is global. I'll have to look up in more detail how to go about this, though I think LeeS' Building guide already touches on this.

    With that, I'll probably also stick a bunch of other things onto that building; I'll ask separately on those properties later, once I've decided on which ones, but it seems like this would be less effort than trying to make a hidden Social policy.

    2) I still might need to make a hidden Social policy, but I haven't figured out how to do this yet. Brief searching on the subject seems to indicate that policies must be assigned to branches or something?

    3) I have been unable to figure out how to (if even possible) modify faith costs Civ-wide. There is the social policy FaithCostModifier, but I don't believe that affects the amount of Faith required for the next GP to pop, etc. It should only affect regular buildings and units?

    4) Along those lines, is it possible to completely disable a Civ from getting Missionaries by setting Trait_NoTrain to UNIT_MISSIONARY? (Sounds like it would prevent them from getting Missionaries, but I don't know about the Borobudur which grants 3 free ones.)

    5) I have been unable to find a way to grant extra Happiness to a specific resource(s). None of the parameters in any of the XML files I've looked at so far seem to be that specific. I'm not sure if I can simply do this in LUA, or something.

    6) This game makes it easy to require a building in every city before you can build a National Wonder. But from reading LeeS' guide, it seems impossible to do it the other way -- require a National Wonder before being able to build another building. Is there no way to do this? My current workaround is to simply make the NW appear earlier than normal, and hope you build it before finishing research on the next tech which unlocks the normal building.

    Phew, that was a lot longer than I expected..

    Thanks again for all of your assistance and support!
     
  19. bouncymischa

    bouncymischa Synthetic Genie

    Joined:
    Nov 28, 2012
    Messages:
    1,537
    Location:
    In a bottle
    Unfortunately, there is no LUA guide, although there's the Lua reference at the modiki. It's handy to check to find functions your may need, although I'm still trying to learn my way around it...

    I'm pretty sure it's global -- the Statue of Liberty uses it to affect all specialists in your civ. So you shouldn't need Lua for that, as you can just add it as a free building along with your Palace.

    Actually, I think the key to making hidden policies is to not assign them to branches -- thus, they won't show up as being selectable. I haven't tried making one myself, yet, so I can't be sure, though.

    That's odd... if I remember correctly, National Wonders have their own building classes, so you should be able to set a NW as a prerequisite building for another building...? I've never tried it, so again, I can't be sure...
     
  20. DarkScythe

    DarkScythe Hunkalicious Holo

    Joined:
    May 6, 2014
    Messages:
    804
    Ah!

    Thanks for pointing out the Statue of Liberty -- I had completely forgotten about its bonus.
    I just checked the XML, and you are right, it does use Building_SpecialistYieldChanges to add 1 production to every specialist globally. In that case, I can add it to a building in the Capital.

    (I'm still debating whether or not to replace the Palace outright, or add a custom free building only to the Capital. I'm confused over what the implications are when your Capital gets captured, and Vicevirtuoso had recommended against modifying the Palace, for compatibility reasons.)

    I know you can assign the NW as a prerequisite, but that actually doesn't work the way I'd need it to -- the building will try to check if the NW exists in its own city before allowing it to be built. Thus, a regular building who has a NW as its prerequisite would only be able to be built in the one city where the NW was erected. Am I wrong in this assumption?

    Kind of sucks about the LUA guide, but hey, at least there's a reference so we won't be totally in the dark! Thanks for the link!
     

Share This Page