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

Civ 5 modding help

Discussion in 'Civ5 - Creation & Customization' started by Question, Aug 27, 2014.

  1. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,219
    Location:
    Illinois, USA
    Not a problem with <FreeBuildingThisCity> as I've made a wonder give a Public School when the wonder was placed in the tech tree far earlier than the tech for the Public School. I believe the empire-wide <FreeBuilding> will not have a problem either but I haven't specifically engineered a test for that condition.

    Nope. Not without some lua that's looking at whether the player has discovered tech so-and-so and then "manually" thru lua adding the buildings.

    You can give the same civ pretty much an unlimited number of UU's or UB's, though it does tend to make the civilopedia page kind of crowded.

    With the harbor bonuses you are talking about the only things you can tie in to a later technology are direct yield enhancements and tourism enhancements. You cannot directly through the pre-supplied XML make the internal city-connection-to-the-capital effect wait for the discovery of a later tech, for example.

    You should also get into the habit of showing the table-names within which such an update is to be encapsulated. You should do this for two reasons:
    1. To get into the proper required habit when writing XML lines
    2. So that we can know when you are asking for advice whether you are trying to stick the XML lines into the wrong XML table.
    As in like this, both so we can see that you have correctly understood which table the Update is writing to, and so that you get into the correct habit, and thereby save yourself a load-dump of head-wallbashing:
    Code:
    <GameData>
    	<Units>
    		<Update>
    			<Where Type="UNIT_DESTROYER"/>
    			<Set Combat="60"/>
    		</Update>
    	</Units>
    </GameData>
     
  2. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Thanks, but what do i do with that LUA code? Do i just put it into modbuddy as a LUA script?

    Im also trying to figure out why a particular code isnt working....

    Some other stuff :

    Is there a way to make marble give the wonder bonus as long as you have it connected, instead of only for a particular city? The XML file just lists a wonder mod bonus, but thats it...

    Is there a way to make buildings like Alhambra, Brandenburg gate, etc give the bonus promotions empire wide, and not just with one city? I guess i can do it like the great light house but that would be retroactive...

    Im assuming that <FreeStartEra>ERA_INDUSTRIAL</FreeStartEra> for the Amphitheater means that you will get a free amphitheater if you pick legalism in the industrial age right? Any ideas what <OneShot> does for Legalism?

    Is there a way to make the free aqueduct from the Tradition finisher override existing Aqueducts (So you get a maintainance free aqueduct instead of nothing)?

    Im trying to edit some wonders like machu pichu so that you can build it as long as you have a mountain in your territory, instead of just within two tiles. But the XML just says <NearbyMountainRequired>true</NearbyMountainRequired>...im guessing the 2 tile distance is already defined in the DLL?

    Is there a way to mass update several columns at once? For example, updating everything under <Units> that has <CombatClass>UNITCOMBAT_NAVALMELEE</CombatClass>.

    E.G.

    Code:
    <Units>
    <Update>
    <Where CombatClass="UNITCOMBAT_NAVALMELEE"/>
    <Set>
    <Moves>10</Moves>
    </Set>
    </Update>
    </Units>
    
    If it does work, is there a way to have it increase the current value by 1, instead of changing it to a set number?

    Is there any way to make a unit upgrade to more than one choice? For example instead of upgrading a swordsman to the next tier, have him upgrade to the highest tier possible (based on your tech)?

    Is there a way to set polders to be buildable next to rivers? as well as marsh/floodplains I tried this but it didnt work :

    Code:
    	<Improvement_ValidFeatures>
    		<Row>
    			<ImprovementType>IMPROVEMENT_POLDER</ImprovementType>
    			<FeatureType>FEATURE_RIVER</FeatureType>
    		</Row>
    	</Improvement_ValidFeatures>
    How do i allow a civ to build the normal unit in addition to the UA? E.G. Korea can build caravels and turtle ships?
     
  3. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Hanging Gardens, Petra (Vanilla) and Hubble Telescope do that too.

    In the Content Tab (below the Action tab you tell the mod what to do with XML files) you must do the same to Lua files; put the name first (in the last dropdown box) or you'll have to put it by hand later, then choose InGameUIAddin in the first box, choose a name (mandatory) and a description (optional).

    It doesn't do that already?! :eek:

    Yes. But if you're willing to go the Lua route, look here.

    I think so, yes, with the <Update> tag, but I am no longer allowed to help in regarding to this. :lol:

    First part, yes. Second part, probably.

    That must be a problem with river being false feature, I believe.
    Possibly the RiverSideMakesValid boolean? Maybe it is a prohibitive (MUST have river to be valid) instead of an enabler (VALID if adjacent to river or...).
     
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,341
    Location:
    Near Portsmouth, UK
    XML
    Code:
    <Units>
      <Update>
        <Where CombatClass="UNITCOMBAT_NAVALMELEE"/>
        <Set Moves="10"/>
      </Update>
    </Units>
    
    SQL
    Code:
    UPDATE Units SET Moves=10 WHERE CombatClass='UNITCOMBAT_NAVALMELEE';
    
    SQL only
    Code:
    UPDATE Units SET Moves=Moves+1 WHERE CombatClass='UNITCOMBAT_NAVALMELEE';
    
     
  5. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Thanks, just a quick update : I tried RiverSideMakesValid but i think it conflicts with the required terrain type...the game still requires marsh/floodplains even if its riverside.

    Just noticed something odd, i tried to move remove jungle/marsh to mining, and its displayed that way in the ingame tech tree, but my workers still refuse to remove jungle/marsh?

    Code:
    <Builds>
    		<Update>
    			<Where Type="BUILD_REMOVE_JUNGLE"/>
    			<Set>
    				<PrereqTech>TECH_MINING</PrereqTech>
    			</Set>
    		</Update>
    		<Update>
    			<Where Type="BUILD_REMOVE_MARSH"/>
    			<Set>
    				<PrereqTech>TECH_MINING</PrereqTech>
    			</Set>
    		</Update>
    	</Builds>
    Did i miss something?
     
  6. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,341
    Location:
    Near Portsmouth, UK
    The BuildFeatures table
     
  7. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Thanks.

    Okay so now that ive looked at it a bit more...

    LUA lets you do stuff that is not originally defined in the game files right....what about SQL, is it just an alternative means of updating the databases compared to XML?

    Im looking at the LUA page now that bane linked, but im confused as to how it works. How would i get it to check whether a mountain is in your territory (if thats even possible)?

    Does anyone know how to have a civ build a unit in addition to the special unit that replaces it?

    Code:
    <Civilization_UnitClassOverrides>
    		<Row>
    			<CivilizationType>CIVILIZATION_KOREA</CivilizationType>
    			<UnitClassType>UNITCLASS_CARAVEL</UnitClassType>
    			<UnitType>UNIT_KOREAN_TURTLE_SHIP</UnitType>
    		</Row>
    Do i just remove this override?

    Also for whoward's alternative upgrade paths mod...how does the interface work for that? Do you get multiple upgrade buttons? I suppose i could just put in a TON of XML entries to let a warrior upgrade to riflemen or whatever, but thats not a very efficient way of doing it, and im not sure how the interface would deal with so many upgrade paths....

    Speaking of which, there is a major problem where ranged units upgraded to melee units still retain their ranged promotions which are now useless. Any ideas on how to fix that?
     
  8. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    Kind of. It is hard to explain without giving too much information, but, in a sense, yes, it does let you do stuff you wouldn't do just messing with XML game files, BUT, it is still limited by the API in what we can do (which is, in a sense, part of the game files).
    About SQL, it is a programming language (like Lua, unlike XML), I do not know much of it, but as far as I know it is designed with the purpouse of database in mind. It is a better (not only alternative) mean of updating databases than XML.

    That's possible. First you need to understand a bit of how to program in Lua (a quick read at the manual is good enough for starting).
    Then you will understand how to use methods and how they will respond to you. In your case, you would need to check every plot in the city radius and compare that plot's PlotType to mountain's PlotType, then do what your code is supposed to do. Something like this:

    *I'm writing a tutorial for Lua beginners. I don't have enough credentials but the errors will be pointed out by the more experienced modders, so, just wait a bit please*


    I don't understand the question exactly. This subtable is responsible to assign units as Unique Units to the respective Civ. It does that by telling the game that when the Civ in question is CivilizationType, replace whichever is the default Unit for UnitClassType with UnitType.

    I don't know HOW it works, in addition to tables, UI is another thing that conspires against me. :lol:
    Answering the others: Yes, it shows multiple. The interface can accomodate plenty, as far as I know, just as how the Promotions can accomodate a hell lot of promotion options rows.

    There is a mod by whoward in the site I mentioned (how did you not see that? :() right here.


    EDIT: heh, it wasn't here that I mentioned his website.
     
  9. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Thanks. For korea, i meant how do i let korea build both the turtle ship AND the caravel, which the turtleship replaces?

    Also would anyone happen to know what the table/rows are for AI diplomacy defines.xml? Its not listed at the beginning of the xml like most xml files, so i have no idea what i can edit. Im trying to add decay values for stuff like being caught spying, which isnt in the game (so civs will hate you forever for spying, which is pretty stupid).

    Also how do i make the great wall's effects not apply to any civ that has researchd dynamite, instead of beocming obsolete when the owner researches dynamite?

    I also tried updating the Brandenburg gate with the <GlobalExperience> value to give every unit produced 15 xp instead of just units trained in that city. But that just made the brandenburg gate not give any xp at all?
     
  10. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,219
    Location:
    Illinois, USA
    It's not possible by manipulation of the <Civilization_UnitClassOverrides> table. A player either can construct the default unit within the class, or the unique unit within the class.

    You could probably do it by creating a new unit that is a virtual copy of the Caravel, assign this new unit a new unit-class, and allow Korea to build the unit. As I recall from what Bane_ says, you can set NONE as the default unit within a class, like this:
    Code:
    <UnitClasses>
    	<Row>
    		<Type>UNITCLASS_CARAVEL2</Type>
    		<Description>TXT_KEY_UNIT_CARAVEL2</Description>
    		<DefaultUnit>NONE</DefaultUnit>
    	</Row>
    </UnitClasses>
    and then you'd have a <<Civilization_UnitClassOverrides> table that looks something like this for that new Unit / Class for Korea:
    Code:
    <Civilization_UnitClassOverrides>
    		<Row>
    			<CivilizationType>CIVILIZATION_KOREA</CivilizationType>
    			<UnitClassType>UNITCLASS_CARAVEL2</UnitClassType>
    			<UnitType>UNIT_KOREAN_CARAVEL2</UnitType>
    		</Row>
    </Civilization_UnitClassOverrides>
    I've never had any luck so far trying to use <GlobalExperience> in the <Buildings> table. It doesn't seem to do anything so far as I've ever been able to see.
     
  11. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Ah ok, thanks.

    Then do you know any way to make the brandenburg gate give +15 xp to every unit produced by the civ who owns it, instead of just one city?

    At the moment im using a workaround where every city gets a free brandenburg gate, but its kind of a clusmy work around....
     
  12. AW Arcaeca

    AW Arcaeca Deus Vult

    Joined:
    Mar 10, 2013
    Messages:
    2,958
    Gender:
    Male
    Location:
    Operation Padlock ground zero
    The solution isn't much different. :/ It would involve using lua to detect if the player has the Brandenburg gate, and if that returns true, giving all of the player's cities a dummy building that gives +15XP. Firaxis didn't provide us with global experience modifiers for buildings.
     
  13. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Okay...is it possible for a building to give a specific policy then? Since policies can give global experience modifiers.

    I modified a policy tree, moved some pre-reqs around, but the UI doesnt seem to have updated to reflect that change...how do i move the icons around?

    Edit : Any ideas how i can increase all embarked unit moves by 1? Denmark's trait has a row called <ExtraEmbarkMoves>1</ExtraEmbarkMoves> but that probably wont work in the units table...and that doesnt appear to be anything in the units table taht would let me do it.
     
  14. bane_

    bane_ Howardianism High-Priest

    Joined:
    Nov 27, 2013
    Messages:
    1,559
    With Lua: Use Building Created Event and give a Policy using this method.

    As far as I know, if you just give a Policy, the Culture threshold will increase as if you just adopted one, so you need to add the following:
    Code:
    pPlayer:SetNumFreePolicies(1)
    pPlayer:SetNumFreePolicies(0)
     
  15. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Ah ok, thanks.

    I was also trying to mod beliefs and found that it broke the reformations policy.

    In the beliefs table i did :

    Code:
    	<Update>
    				<Where Founder="true"/>
    				<Set>
    					<Enhancer>true</Enhancer>
    					<Follower>true</Follower>
    					<Reformation>true</Reformation>
    				</Set>
    		</Update>
    This worked fine for enhancer and followers (i could pick founder beliefs for enhancer and follower categories) but it broke the reformation policy so that i wouldnt get the popup asking me to pick a reformation belief. The moment i removed that tag, it worked just fine. No errors in database.log. Any idea why it would do that?
     
  16. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Also i cant seem to change the score given for building wonders, theres one bit in globaldefines.xml but changing it to 0 seems to do absolutely nothing....
     
  17. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,219
    Location:
    Illinois, USA
    generally everything that is in the globaldefines.xml and the AIglobeldefines.xml files need to be changed before the start of a game. IE, your changes need to be active in the mod before you go to the SET-UP GAME menu. I've never had much luck trying to change anything mid-stream for anything that goes into the <Defines> or <PostDefines> tables. If you were trying to change "mid-stream" that may be why there was no effect.
     
  18. Question

    Question Chieftain

    Joined:
    Mar 12, 2008
    Messages:
    945
    Yea i wasnt trying to change it mid stream, i just noticed that there were two wonder score modifiers, one is for total score and the other is the score per wonder, which was what i was looking for.

    I still cant figure out why adding more reformation abilities seems to break the policy though....might need to start a seperate thread for that.

    Also still trying to figure out how to modify embark movement points....

    Edit : Well what i did was set Agriculture to modify embarked movement just like steam power....i guess that works.
     

Share This Page