Civ 5 Custom Civ Not Showing Up

modder489

Chieftain
Joined
Dec 24, 2015
Messages
18
I'm new to modding and I tried to create a modded version of Russia, so I used the http://forums.civfanatics.com/showthread.php?t=490901 Civ files to create a mod. I used mostly the base Russian files (used Persian UB because I haven't finished it yet and wanted a placeholder), didn't touch the Civilization or Leader, but I think I may have screwed up elsewhere. Regardless, the Civ shows up in Mods ingame, I enable it, hit Next, and try to start a game with the mod, but it doesn't show up in the Civs list. However, the bar on the side of the screen is still there. I've chcecked a lot of other forums and none of them have helped. I've deleted my Cache folder and it still hasn't helped. If anyone knows what I can do, it would be great. Thanks.
 
If your mod contains this:
Code:
<GameData>
  <Civilizations>
    <Row>
      <Type>CIVILIZATION_RUSSIA</Type>
and this:
Code:
<GameData>
  <Leaders>
    <Row>
      <Type>LEADER_CATHERINE</Type>
Then the game is discarding the entire file(s) where these statements appear.

Whoward's thread is intended for you to use the included files as templates for creating a civilization. But the game never allows you to repeat data it already has, and it already has data for LEADER_CATHERINE in the table <Leaders>, and it already has data for CIVILIZATION_RUSSIA in table <Civilizations>. Same will be true for unique buildings and units the game already has defined within its database of XML.

You need to change all the occurances of CIVILIZATION_RUSSIA, etc., to something new, such as CIVILIZATION_RUSSIA_NEW. Use a text editor and use "find/replace" to seek out all these occurances within the templates whoward provided.

Also, whoward69's zip your mods and attach tutorial and whoward69's enable error logging tutorial. The first gives you instructions on how/where to grab the mod and put it into a zip that can be attached to a forum post (because otherwise I am really just guessing about the mistake you most likely made). The second shows how to enable error logging so you can look in the error log files to see if the game is reporting an error related to your mod.
 
Thanks, I'll try it. I did make that mistake multiple times and it hopefully will fix it. One question though. Can I not copy anything? For example, can I still use the map provided? Or audio files? Or dawn of man image?
 
You can reference and use the maps, the audio files, and the DOM image. But what you can't restate is a <Type>SOMETHING_SOMETHING</Type> that has already been used. So you have to change all your <Type>SOMETHING_SOMETHING</Type> into something new and unique to all others within the same game-table. Then you have to change all the usages within the follow-on tables that refer to your new civilzation, unit, building, etc., to reference that new and unique designation. Like as this:
Code:
<GameData>
	<Buildings>
		<Row>
			<Type>[color="blue"]BUILDING_NEW_BUILDING[/color]</Type>
			<ArtDefineTag>ART_DEF_BUILDING_FORGE</ArtDefineTag>
			............................
			.....snipped out stuff......
			............................
		</Row>
	</Buildings>

	<Building_YieldChanges>
		<Row>
			<BuildingType>[color="green"]BUILDING_NEW_BUILDING[/color]</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>3</Yield>
		</Row>
		<Row>
			<BuildingType>[color="green"]BUILDING_NEW_BUILDING[/color]</BuildingType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>3</Yield>
		</Row>
	</Building_YieldChanges>
</GameData>
  1. In the blue part where the column name is <Type> I am creating a new XML-name for a building, and it has to be unique to all other usages of <Type> within the <Buildings> table.
  2. In the green parts (in the follow-on table called <Building_YieldChanges>) where the column name is <BuildingType> I am referencing this designation from the 1st table (<Buildings>)
  3. Notice that I am re-using the ART_DEF_BUILDING_FORGE. This is allowed, and so would a repeat usage in your civ of
    Code:
          <ArtDefineTag>ART_DEF_CIVILIZATION_RUSSIA</ArtDefineTag>
          <ArtStyleType>ARTSTYLE_EUROPEAN</ArtStyleType>
          <ArtStyleSuffix>_EURO</ArtStyleSuffix>
          <ArtStylePrefix>EUROPEAN</ArtStylePrefix>
          <IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
          <AlphaIconAtlas>CIV_ALPHA_ATLAS</AlphaIconAtlas>
          <MapImage>MapRussia512.dds</MapImage>
          <DawnOfManQuote>TXT_KEY_CIV5_DAWN_RUSSIA_TEXT</DawnOfManQuote>
         <DawnOfManImage>DOM_Catherine.dds</DawnOfManImage>
          <DawnOfManAudio>AS2D_DOM_SPEECH_RUSSIA</DawnOfManAudio>
    Because in this case you are telling the game to use the pre-defined data that Russia uses, but you are not trying to create new data with the same "names".

Nor in <Language_en_US> can you re-state a Tag="TEXT_KEY_SOMETHING". Same rule applies as for <Type>. The "TEXT_KEY_SOMETHING" part needs to be unique to all other usages of a TXT_KEY
 
Hmm. Still not working. I probably screwed up in a few places. Here's what I have. NOTE: "Cossacks" is not a mistake, I did it to differentiate it from the current Russian UU name, Also, I've tried it without the ULA and it still didn't work, so I know that's not it.
 

Attachments

  • Russia Civ Mod (2).zip
    18.3 KB · Views: 49
Sorry, here's the build. I've noticed that it's very short compared to other mods I have downloaded though.
 

Attachments

  • Improved Russia (v 1).civ5mod
    9.5 KB · Views: 71
  • Build.zip
    13 KB · Views: 64
  • This code
    Code:
    GameEvents.PlayerDoTurn.Add(
    function(iPlayer)
    	local pPlayer = Players[iPlayer]
    	if not (pPlayer:IsGoldenAge()) then return end
    	if (pPlayer:GetID() == 63) then return end
    	for pUnit in pPlayer:Units() do
    		local pPlot = pUnit:GetPlot()
    		if (pPlot:GetTerrainType() ~= GameInfoTypes.TERRAIN_TUNDRA) then return end
    		local iPlotOwner = pPlot:GetOwner()
    		if (iPlotOwner ~= iPlayer) and (iPlotOwner ~= -1) then
    			if not (Players[iPlotOwner] == GameInfoTypes.CIVILIZATION_YOURCIVNAMEHERE) then return end
    			if (not (pPlayer:IsPlayerHasOpenBorders(iPlotOwner))) then
    				pUnit:ChangeDamage(iDelta)
    			end
    		end
    	end
    end)
    belongs in an lua scipt and cannot be placed in any xml file. If placed within an xml file, will cause the entire file to fail and be discarded by the game.
  • Your custom trait TRAIT_RUSSIAN_WINTER is not being used for anything anyway because you have this in your leader file:
    Code:
    <Leader_Traits>
    	<Row>
    		<LeaderType>LEADER_PETER</LeaderType>
    		<TraitType>TRAIT_STRATEGIC_RICHES</TraitType>
    	</Row>
    </Leader_Traits>
    So your leader Peter is being assigned to use Catherine's trait. This is OK so far as game-code is concerned because multiple leaders can all be assigned to use the same trait.
  • However, this is no good within your leader file:
    Code:
    		<Row Tag="TXT_KEY_LEADER_CATHERINE_PEDIA">
    			<Text>
    				<!-- Add Civilopedia text here -->
    			</Text>
    		</Row>
    It is a repeat of a TXT_KEY_SOMETHING the game already has, therefore the entire file is discarded, taking your leader Peter along with it
  • In your unit you should have:
    • in order to make the unit conform to the ability to FaithBuy units:
      Code:
      <FaithCost>170</FaithCost>
      <RequiresFaithPurchaseEnabled>1</RequiresFaithPurchaseEnabled>
      instead of
      Code:
      <FaithCost>0</FaithCost>
      <RequiresFaithPurchaseEnabled>0</RequiresFaithPurchaseEnabled>
    • In order to have an ART_DEF the game recognizes:
      Code:
      <UnitArtInfo>ART_DEF_UNIT_HORSEMAN</UnitArtInfo>
      instead of
      Code:
      <UnitArtInfo>ART_DEF_UNIT_U_RUSSIAN_COSSACK</UnitArtInfo>
    • You need a WorkRate in the <Units> table if you are going to allow the unit to do improvement-building. Such as
      Code:
      <WorkRate>100</WorkRate>
      as is used by the Roman Legion.
    • This also will be a problem
      Code:
          <Row Tag="TXT_KEY_CIVILOPEDIA_UNITS_RENAISSANCE_COSSACKS_TEXT">
            <Text><!-- Add Civilopedia text here --></Text>
          </Row>
      as I believe it also is a repeat of existing TXT_KEY from the base game.
  • Your ArtDefineTag
    Code:
    <ArtDefineTag>Peter_Scene.xml</ArtDefineTag>
    references a leaderscene fallback xml-file that doesn't exist. For now just use Catherine's:
    Code:
    <ArtDefineTag>Catherine_Scene.xml</ArtDefineTag>
    since this is only used when the leader is running as an AI.
  • This also is a repeat use of a TXT_KEY:
    Code:
    <Row Tag="TXT_KEY_CIV5_RUSSIAN_EMPIRE_HEADING_9">
    	<Text>Summary</Text>
    </Row>
    [color="red"]<Row Tag="TXT_KEY_CIV5_RUSSIAN_EMPIRE_HEADING_1">
    	<Text>History</Text>
    </Row>[/color]
    <Row Tag="TXT_KEY_CIV5_RUSSIAN_EMPIRE_HEADING_10">
    	<Text>Peter the Great</Text>
    </Row>
    as reported by this error in the Database.log file:
    Code:
    [86036.640] columns Language, Tag are not unique
    [86036.640] While executing - 'insert into Language_en_US('Tag', 'Text') values (?, ?);'
    [86036.640] In XMLSerializer while inserting row into table insert into Language_en_US('Tag', 'Text') with  values (TXT_KEY_CIV5_RUSSIAN_EMPIRE_HEADING_1, History, ).
    [86036.640] In XMLSerializer while updating table Language_en_US from file XML/Civilization.xml.
    You already have used that same TXT_KEY designation earlier, in this segment:
    Code:
        <Row Tag="TXT_KEY_CIV5_RUSSIAN_EMPIRE_FACTOID_TEXT">
          <Text><!-- Add Civilopedia text here --></Text>
        </Row>
       <Row Tag="TXT_KEY_CIV5_RUSSIAN_EMPIRE_HEADING_1">
          <Text>History</Text>
        </Row>
        <Row Tag="TXT_KEY_CIV5_RUSSIAN_EMPIRE_HEADING_2">
          <Text>Terrain and Climate</Text>
        </Row>
    The error causes the entire file with the definition of the civilization to be discarded by the game. In fact you have multiple repeats of TXT_KEY_CIV5_RUSSIAN_EMPIRE_HEADING_X all within that same file.
 
How can I add the ULA using a Lua file? Can I create an empty file with nothing but that and then have it open when the mod is activated? Or is there a way I can accomplish a similar ULA using just an XML file. But thanks for actually reviewing it and telling me all the places I messed up.
 
Also, I double checked (d) and the text from the game is
Spoiler :
<Row Tag="TXT_KEY_CIVILOPEDIA_UNITS_RENAISSANCE_COSSACK_TEXT">
<Text><!-- Add Civilopedia text here --></Text>
</Row>

It's not a huge difference but there is no "s" in Cossack. However the other changes are all great and are very helpful.
 
To get lua into a mod:

1) Get Notepad++
2) Open Notepad++
3) Copy and paste the code I gave you into a new file
4) Set language to Lua (technicality: why do you keep calling it ULA? For United Launch Alliance? The name of the language literally means "moon" in Portuguese.)
5) Change encoding to ANSI or UTF-8; I recommend UTF-8 so that the logs can render foreign characters. But it's extremely important that if you set the encoding to UTF-8, it must not be UTF-8-BOM, which adds a byte order mark to the file, causing a syntax error that will cause the entire file to be discarded.
6) Save file as
7) Import into mod (right-click on the project while the project is open is modbuddy (see thumbnail) -> Add -> Existing Item -> Navigate to where you saved the file
8) Set to UIInGameAddin
9) Save and build mod
10) Profit!

The whole process is actually a lot less scary and complicated than it sounds like.

The reason I don't just add lua straight into the mod via Add -> New Item -> Lua Script is because Step #5 - ModBuddy, helpfully, automatically adds in a nice BOM for me. :p
 

Attachments

  • thumbnail.png
    thumbnail.png
    88.3 KB · Views: 102
Ah. We call that a "UA" - Unique Ability. Sometimes called a "trait", since they're defined in the table <Traits>. In my defence, I've also seen people call Lua "lau" before, which has since made me wonder why 3-letter words are so hard to spell.
 
How do I assign the trait to the LUA file? Do I change <TraitType> to the name of the file?
 
No, no, no no no no no. <Traits> is a database table, which means it belongs in either an XML or SQL file. But you've only learned the syntax of XML so far, so don't even attempt doing <Traits> in SQL, unless you're already familiar with SQLite. Lua is the language for doing stuff with things already in the database. XML is the language for editing the database created by SQL.

You also need to get into your head that Lua, XML and SQL are very different languages with very different syntaxes used for very different purposes. You CANNOT use any of the languages and their derivative syntaxes and file types interchangeably.

That said, the UA needs to be created in XML, but the XML instructions don't need to contain any instructions for making the UA actually "do" anything useful - that's what the Lua code, in a separate .lua file, is for. The game doesn't even need to know - and wouldn't know anyway - that those two files are related. The XML tells the game that the civ has a UA, and the lua tells the game to damage enemy units when they begin their turn in your territory, and though split between two files, together they create what is perceived by the player as "the UA".
(That illustrates another point about modding - it doesn't matter what's actually happening in the code, it only matters what the player sees is happening.)
 
Thank you very much for your help. It's working now. Even though I'll probably only use it myself and send it to my friends, I'll give both of you guys a Special Thanks in the modpack.
 
Hmm, it was working and I'm not sure what changed, but now it's not. Here's the modpack, but I'm really not sure where I screwed up.
 

Attachments

  • Civ5 Russian Empire.zip
    56.7 KB · Views: 43
1) You attached the solution instead of the built mod again, and
2) If you had enabled logs, they should've given you a clue...
 
You've included two different mods in that zip. One has an action for the lua file and the other does not. This is the very reason we ask for the current version of the mod taken directly from the game's MODS folder and only that current version taken directly from the game's MODS folder.
 
Top Bottom