Replacing a single element in ArtDefs and replacing the original

spincrus

sol invictus
Joined
Dec 6, 2001
Messages
1,084
Location
Europe
Hello everyone. I've looked high and low for a solution, but could not get anything to work. Only after two days of experimentation have I finally decided to post a question about this. I hope any solution that may come out of this may help the community.

So I'm working on a mod where I've created unique civilizations using only pre-built assets and traits. For example, I combined England and Scotland into one civ for Great Britain, by merging the leaders, unique units, buildings and improvements into one, etc.

The mod works perfectly, except for one thing: the unique buildings do not render on the districts when built. Instead, I get a big red exclamation point.

Through extensive research, I stumbled upon this specific thread where it identified the problem: you have to cut the ties of the asset with its parent civilization within Landmarks.artdef by replacing this element:

HTML:
<Element class="AssetObjects..ArtDefReferenceValue">
   <m_ElementName text="CIVILIZATION_MONGOLIA"/>
   <m_RootCollectionName text="Civilization"/>
   <m_ArtDefPath text="Civilizations.artdef"/>
   <m_CollectionIsLocked>true</m_CollectionIsLocked>
   <m_TemplateName text="Civilizations"/>
   <m_ParamName text="Tag_Culture"/>
</Element>

with this one:

HTML:
<Element class="AssetObjects..ArtDefReferenceValue">
    <m_ElementName text="DEFAULT"/>
    <m_RootCollectionName text="Culture"/>
    <m_ArtDefPath text="Cultures.artdef"/>
    <m_CollectionIsLocked>true</m_CollectionIsLocked>
    <m_TemplateName text=""/>
    <m_ParamName text="Tag_Culture"/>
</Element>

In this example, I'm trying to make the Mongolian Ordu's asset not specific to Mongolia.

I first tested this by editing the base game's original Ladnmarks.artdef (made a backup of course) and reloading it in-game, and it worked. Such a simple solution.

Of course, I can't just leave it in like this and need to cook the solution into my mod, but no matter what I do, the Landmarks.artdef that I pull into the game (all dependencies etc. accounted for, no errors in the cooker.log), but no matter what I try, the game does not seem to overwrite the original .artdef.

I even set the m_ReplaceMergedCollectionElements to true. In my frustration, I even replaced all "false" for m_ReplaceMergedCollectionElements and even m_AppendMergedParameterCollections to "true" within my Landmarks.artdef.

I made sure that the expansion's ID gets recalled within my .dep file as RequiredGameArtIDs. The In-Game actions is set correctly, the ArtDefs are set to build action as ArtDefs, etc. so I basically did all.

All the fuss just to simply replace a single element of a single building. Wish it was as easy as replacing stuff with SQL.

What may I be missing?
 
I have given up hope. I truly can't find a simpler way.

The closest I came to success was by duplicating BUILDING_ORDU (I just named it BUILDING_ORDU2) and copying the original ArtDefs for the original building and assigning it to BUILDING_ORDU2 as well. Even then, it didn't work, but at least the exclamation mark was gone and the graphics defaulted back to DIS_ENC_Classical_Base_01 for the district when I built an Ordu when testing in-game. I just can't get to load the building-specific graphics though.

I even tried defining the custom civilization within Civilizations.ArtDef and reverting the BuildingVariants to refer to that specific civilization, to mimic the same thing that was going on between Ordu and Mongolia. It still didn't work.

I am about to throw the towel. I have yet to see any other building or unit do the same. I checked other ArtDefs (not within every DLC but the major ones) and didn't come across any BuildingVariants based on civilization, so I may be in the clear.
 
I figured it out. Here's the deal:

1) MOD ID is not the same as DEPENDENCY ID. These are two separate unique values. When setting the Mod.Art.XML, make sure to include your dependencies with the CORRECT ID as present within the .dep file of your dependencies. For instance, if you are modding something out of Rise & Fall, open up its .dep file and copy-paste the ID there, rather than the ID present within the .modinfo.

2) m_AppendMergedParameterCollections needs to be "true" to APPEND changes. m_ReplaceMergedCollectionElements needs to be "true" to CHANGE the given entries. Make sure to set these as such for the given nested element that you're changing.

Modding Civ6 compared to previous iterations has really been a challenge with the not-so-simple ArtDef asset structure.
 
Top Bottom