Where did I go wrong?

Before I edited out the pathnames, I checked the atlas-defining code in other mods which added resources, but which didn't cause any problems on my computer. All those mods showed the same syntax: keep the .dds extensions, exclude the pathnames.
I based my font icon observation on Firaxis' uses in the IconFontTextures table:
IconFontTexture='ICON_FONT_TEXTURE_DEFAULT', IconFontTextureFile='FontIcons'
IconFontTexture='ICON_FONT_TEXTURE_EXPANSION2', IconFontTextureFile='FontIcons_Expansion2'

EDIT: I think you're talking about IconTextureAtlases, which uses the .dds extension. Different table.


Good luck! :goodjob:
 
News from the latest playtest: Deleted the .dds extensions in FontIcons.xml and corrected some icon mappings. The XML font error is gone, but I've discovered another bug: none of the new buildings, their icons, or their in-game text is appearing. I'm attaching the updated mod and playtest logs; if you could please help me find and fix this last bug, the mod should be ready for re-release. Thank you for taking so much time!
 
This is probably your problem:
Code:
		<Row>
			<Type>BUILDING_COURT_JEWELER_ISN</Type>
			<BuildingClass>BUILDINGCLASS_COURT_JEWELER_ISN</BuildingClass>
			<Cost>250</Cost>
			<PrereqTech>TECH_METALLURGY</PrereqTech>
			<Description>TXT_KEY_BUILDING_COURT_JEWELER_ISN</Description>
			<Civilopedia>TXT_KEY_BUILDING_COURT_JEWELER_ISN_TEXT</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_COURT_JEWELER_ISN_STRATEGY</Strategy>
			<Help>TXT_KEY_BUILDING_COURT_JEWELER_ISN_HELP</Help>
			<ArtDefineTag>ART_DEF_BUILDING_NATIONAL_TREASURY</ArtDefineTag>
			[COLOR="Red"]<Capital>true</Capital>[/COLOR]
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<SpecialistCount>2</SpecialistCount>
			<Happiness>2</Happiness>
			<MinAreaSize>-1</MinAreaSize>
			<NukeImmune>true</NukeImmune>
			<ConquestProb>100</ConquestProb>
			<FreeBuildingThisCity>BUILDINGCLASS_JEWELER_ISN</FreeBuildingThisCity>
			<HurryCostModifier>-1</HurryCostModifier>
			<IconAtlas>NEWSHOPS_ATLAS</IconAtlas>
			<PortraitIndex>2</PortraitIndex>
		</Row>
It is telling the game that this building is to be the empire capital, not that it needs to be built in the capital city.

Also this is no can do, though it should only be ignored by the game, not cause a load fail (unless you had something buried in your luas to allow it, as I did not look at those):
Code:
	<Building_YieldModifiers>
	
		<Row>
			<BuildingType>BUILDING_COURT_JEWELER_ISN</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>10</Yield>
		</Row>
		
[COLOR="red"]		<Row>
			<BuildingType>BUILDING_COURT_JEWELER_ISN</BuildingType>
			<YieldType>YIELD_CULTURE</YieldType>
			<Yield>10</Yield>
		</Row>[/COLOR]

	</Building_YieldModifiers>

This will actually be 8 cities
Code:
		<Row Tag="TXT_KEY_BUILDING_COURT_JEWELER_ISN_STRATEGY">
			<Text>The Court Jeweler provides a late-game boost to Gold, Culture, and Happiness in the capital.  It also improves the chances of spawning Great Merchants, and acts as a free Jeweler's Shop.  Before building this national wonder, the player must have built Goldsmith's Shops in at least [COLOR="red"]four[/COLOR] cities.
			</Text>
		</Row>

Since this is doubled by the game when a real whole number is used:
Code:
	<Building_PrereqBuildingClasses>
		
		<Row>
			<BuildingType>BUILDING_COURT_JEWELER_ISN</BuildingType>
			<BuildingClassType>BUILDINGCLASS_GOLDSMITH_ISN</BuildingClassType>
			<NumBuildingNeeded>[COLOR="red"]4[/COLOR]</NumBuildingNeeded>
		</Row>

	</Building_PrereqBuildingClasses>
 
Also, it occurs to me that this part of your code
Code:
	<Building_ClassesNeededInCity>

		<Row>
			<BuildingType>BUILDING_JEWELER_ISN</BuildingType>
			<BuildingClassType>BUILDINGCLASS_GOLDSMITH_ISN</BuildingClassType>
		</Row>

	</Building_ClassesNeededInCity>

	<Building_LocalResourceOrs>

		<Row>
			<BuildingType>BUILDING_GOLDSMITH_ISN</BuildingType>
			<ResourceType>RESOURCE_GOLD</ResourceType>
		</Row>

		<Row>
			<BuildingType>BUILDING_GOLDSMITH_ISN</BuildingType>
			<ResourceType>RESOURCE_SILVER</ResourceType>
		</Row>

	</Building_LocalResourceOrs>
Is covering you for this, so you wouldn't actually need these.
Code:
	<Building_LocalResourceOrs>

		<Row>
			<BuildingType>BUILDING_JEWELER_ISN</BuildingType>
			<ResourceType>RESOURCE_GOLD</ResourceType>
		</Row>

		<Row>
			<BuildingType>BUILDING_JEWELER_ISN</BuildingType>
			<ResourceType>RESOURCE_SILVER</ResourceType>
		</Row>
		
	</Building_LocalResourceOrs>
IE, a player can't build BUILDING_JEWELER_ISN in a city unless there already is a BUILDING_GOLDSMITH_ISN.
BUILDING_JEWELER_ISN has the exact same resources in the <Building_LocalResourceOrs> as BUILDING_GOLDSMITH_ISN, so you are actually already covering the requirement with the <Building_ClassesNeededInCity> table.
You could get rid of those entries, and everything would still function in the same way. Plus this avoids any possible conflict to having a single building with entries in both the <Building_LocalResourceOrs> and the <Building_LocalResourceAnds> tables. Never tried that, so don't know if that might also be causing a problem.
 
Also, again, I just realized I've been overlooking the painfully obvious (*headsmack* double-treble *headsmack*) :
Code:
	<Resources>
	
		<Update>
			<Where Type="RESOURCE_JEWELRY" />
			<Set OnlyMinorCivs="false" />
		<Update>
	
	</Resources>

No '/' in the Update closer. This I'm pretty sure is causing the game to discard the entire file.

Though you still need to do something different with the <capital> command. The rest of it was intended more as 'advices' than 'you must fix'.
 
Now that the most obvious bugs are gone (whew!), I thought I wouldn't need to post in this thread again. A player on the Steam site, however, reported that my mod kept city-states from being generated on the map. I have no idea of what could cause that, let alone how to fix it. Would somebody please examine my attached files and help me kill the city-state bug? Thank you again!

EDIT: the same player just reported that no ruins/goody huts were appearing, either. Does reloading the landmark system and/or the strategic-view system cause this kind of bug? I thought that was necessary before putting modded resources on a map.
 
THIS JUST IN: I suspect a Lua error somewhere in the resource generator; the "lite" version of this mod (which doesn't include its own Lua code) places city-states and ruins normally. (It did take four eras to discover my first city-state in a playtest, but that may have been a fluke of the map.) Now, if I only knew how to fix the standalone version...!
 

Attachments

  • AutoSave_0000 BC-4000.Civ5Save
    812.7 KB · Views: 23
LiveTuner is a little beyond my technical ability, but I do have IGE in my mods folder; thanks for the reminder! If you need screenshots, please let me know.
 
Update on both editions:

  1. The Lite edition (judging by a playtest with IGE enabled) is very well-behaved, but I found two more mods which are incompatible; I'll add them to the Block list in my next release.
  2. The standalone version didn't show any obvious errors in Lua.log (at least, none that I could spot on sight). The Database.log file, however, showed several "no such table" and "no such column" errors. I suspect that either my deleting the Gems resource threw the listings off, or I've mis-coded/mis-entered a resource somewhere.

Could someone please take a look at my logs and find out whether my suspicions are correct? If you are able to find and fix the map bug, I'd be extremely grateful. Take care!
 
When debugging it is very important to know which errors are being caused by your mod and which are not.

For Civ 5 this is simple to ascertain. Start Civ, enable all mods EXCEPT the one you are developing/testing and setup a game, play the first turn. Exit Civ 5. Copy the database.log, xml.log and lua.log files - there is nothing in these log files that can be caused by your mod - it was disabled.

Now start Civ, enable your mod, setup a game exactly as before, and play the first turn. Compare the database.log, xml.log and lua.log files against those you saved earlier. ONLY the extra lines are being caused by your mod.

In the case of the database.log you attached above, you will discover that neither the "no such table" nor the "no such column" errors are from your mod
 
I've finally gotten the map-generation bug out of my latest project; a fellow forum member chatted with me on Steam and confirmed that I'd caused the problem by deleting a resource from the main game. The solution my friend suggested? Replacing an existing resource with a new one, which more people might want to learn.

My friend has already replaced existing resources in a few mods, but most of his code is in SQL (which I have trouble following). How would you use XML <Update>s to do the same thing? The game completely ignored my attempts, although I'd defined everything and included the replacements in <OnModActivated>:

Spoiler :

Code:
<!-- Major bugfix as of version 4:  deleting generic Gems kept the core map-generating code from working -->
<!-- correctly; so I'm renaming the resource to Opal instead, changing everything but the stats and -->
<!-- artdefs (Diamond gets its own graphics already, and Opal fits the iridescent stones in Firaxis' art) -->

<GameData>



	<Resources>
	
		<Update>
		
			<Where Type="RESOURCE_GEMS">
			
				<Set Description="TXT_KEY_RESOURCE_OPAL_ISN" />
				<Set Civilopedia="TXT_KEY_CIV5_RESOURCE_OPAL_ISN_TEXT"/>
				<Set IconString="[ICON_RES_OPAL_ISN]" />
				<Set PortraitIndex="8" />
				<Set IconAtlas="NEWMINS_ATLAS" />
			
			</Where>
		
		</Update>
	
	</Resources>
	
	
	<!-- Use the new Opal icon in strategic-view mode -->
	
	<ArtDefine_StrategicView>

		<Update>
		
			<Where StrategicViewType="ART_DEF_RESOURCE_GEMS">
				<Set Asset="sv_opal.dds" />
			</Where>
		
		</Update>
	
	</ArtDefine_StrategicView>



</GameData>
 

Attachments

  • (G+K or BNW) Goldsmith, Jewelers, and New Luxuries (v 4).civ5mod
    3.6 MB · Views: 38
Set is a subtag of Update, not of Where. And there is only one Set allowed per Update (but it can set several things). So it should be like this:
Code:
	<Resources>
	
		<Update>
		
			<Where Type="RESOURCE_GEMS"/>

			<Set Description="TXT_KEY_RESOURCE_OPAL_ISN" Civilopedia="TXT_KEY_CIV5_RESOURCE_OPAL_ISN_TEXT" IconString="[ICON_RES_OPAL_ISN]" PortraitIndex="8" IconAtlas="NEWMINS_ATLAS"/>

		</Update>
	
	</Resources>
 
Corrected the code (thank you, PawelS) -- but it had no effect. :sad:
 
I've examined the logs and the cache from two recent playtests: one mod-free game, one with only the mod discussed here. The modded playtest showed a database validation failure; the art-define tables confirmed that most of my new resource icons had loaded. Only the atlas and strategic-view icons for Opal didn't get into the database (even though I put both into the VFS). Could one of you please check my code and find the glitch that caused the validation failure? Many thanks!
 
You didn't read (or understand) post #33.

I've pointed to this cheat sheet before, but I'll do it again.

Code:
<GameData>
	<Resources>
		<Update>
			<Where Type="RESOURCE_GEMS" />
			<Set Description="TXT_KEY_RESOURCE_OPAL_ISN" Civilopedia="TXT_KEY_CIV5_RESOURCE_OPAL_ISN_TEXT" IconString="[ICON_RES_OPAL_ISN]" PortraitIndex="8" IconAtlas="NEWMINS_ATLAS" />
		</Update>
	</Resources>
	
	<!-- Use the new Opal icon in strategic-view mode -->
	<ArtDefine_StrategicView>
		<Update>
			<Where StrategicViewType="ART_DEF_RESOURCE_GEMS" />
			<Set Asset="sv_opal.dds" />
		</Update>
	</ArtDefine_StrategicView>
</GameData>
 
Now I understand -- two tables = two <Update> blocks. Multiple items in a <Set> = OK if they're from the same table and row.
 
Now that I've created a separate artdefine for Opal (identical to Gems except for a few icons), this bugfix should hypothetically work; I handled the text changes in the same file as others I've already made.

Code:
<!-- This code *should* fix the icon bug in the Gems/Opal substitution (thank you, Nutty!) -->

<GameData>


	<Resources>
	
		<Update>
		
			<Where Type="RESOURCE_GEMS" />
			<Set ArtDefineTag = "ART_DEF_RESOURCE_OPAL_ISN"
			IconString = "[ICON_RES_OPAL_ISN]"
			PortraitIndex = "8"
			IconAtlas = "NEWMINS_ATLAS" />
		
		</Update>
		

	</Resources>


</GameData>
 
Top Bottom