Trying to make a mod to change a unit's art.

The Tollan

Prince
Joined
Oct 29, 2005
Messages
418
I am trying to make a mod (I have the expansion installed) that changes the graphic of a specific unit (Mechanized Infantry).

I have looked at one tutorial and attempted to follow the instructions to compile a mod that changes the art on the unit, but when I load the mod and test it the unit looks exactly as it does in the default game.

I am not sure exactly what xml code must be placed in Modbuddy to ensure that the mod file (s) have the needed information. I added a copy of the content of the Civ5ArtDefines_Units files with one section modified and then built the mod but nothing changes in the game. What steps should I take to make this mod work?

I am trying to change the formation on the unit so that two different art types appear within the formation. When I edit the Civ5ArtDefines_Units file without using Modbuddy then I can achieve the desired result. However, I want to leave that file in its default form and use a mod to make the changes.

Edit: I have set the OnModActivation to update both the database and the user database, but still no changes occur in game. I have one XML file with the unit formation XML code lines in a mod folder called "Units."
 
Gedemon explained the issue pretty well here, and gave one possible method to do a conversion:

Another very good change (with the working dependencies/references/blocks) is that the artdefines for units are now in the database (mod adding new units will be compatible).

But it's important to note that you can't use Civ5ArtDefines_Units.xml and Civ5ArtDefines_UnitMembers.xml with VFS to true anymore, it seems those files are loaded in the DB before the mod engine is started, and are ignored when used in a mod. IMO it's good, will force user to make compatible mods, but lot's of work to convert existing mods using new units.

If it can be useful to someone else, here's how I've quickly converted the WWII mod (200+ units) to the new system :
- Replace the vanilla Civ5ArtDefines_Units.xml and Civ5ArtDefines_UnitMembers.xml in "\Steam\steamapps\common\sid meier's civilization v\Assets\Units" with the files from the mod
- Load the game, use SQLite Manager to export the 5 tables now containing artdefines for the mod units in SQL (including CREATE TABLE statement, but for mods wanting to keep compatibility with others you don't want that, and you'll have to update the tables only, not erase/recreate, that means editing a bit those SQL files)
- Added the sql files in my project with OnModActivated flag
- Restore vanilla Civ5ArtDefines_Units.xml and Civ5ArtDefines_UnitMembers.xml


I haven't tried the Landmark ArtDefines table, maybe there's some wanted changes here too.
 
Gedemon explained the issue pretty well here, and gave one possible method to do a conversion:

Whoa, they fixed that? Oh, I am so happy right now!

Wait so UnitArtDefines are modded by just making a new XML file (like with Buildings or something)? And we can use <Update> tags on them too?
 
Whoa, they fixed that? Oh, I am so happy right now!

Wait so UnitArtDefines are modded by just making a new XML file (like with Buildings or something)? And we can use <Update> tags on them too?

Yes :) Open Civ5DebugDatabase.db in SQLite Manager to see what can be changed.
 
I am trying to change the formation on the unit so that two different art types appear within the formation. When I edit the Civ5ArtDefines_Units file without using Modbuddy then I can achieve the desired result.

Post the section of the artdefine file(s) you changed and someone (possibly me if I get bored checking my mods for G&K compatibility) may be able to convert it to the new format xml for you (as this seems a pretty common question at the moment, so a "worked example" would be generally useful)
 
This is the part of the Civ5ArtDefines_Units file that I changed. If I can find or make art to replace the Paratrooper then I will also modify the Civ5ArtDefines_UnitMembers file.

<UnitArtInfos>
<!-- UNIT_MECHANIZED_INFANTRY ****************************************** -->
<UnitArtInfo>
<Type>ART_DEF_UNIT_MECHANIZED_INFANTRY</Type>
<Formation>Vehicle</Formation>
<DamageStates>1</DamageStates>
<UnitMemberArt>
<MemberType>ART_DEF_UNIT_MEMBER_PARATROOPER</MemberType>
<MemberCount>4</MemberCount>
</UnitMemberArt>
<UnitMemberArt>
<MemberType>ART_DEF_UNIT_MEMBER_MECHANIZEDINFANTRY</MemberType>
<MemberCount>2</MemberCount>
</UnitMemberArt>
</UnitArtInfo>
</UnitArtInfos>
 
Try

Code:
<GameData>
  <ArtDefine_UnitInfos>
    <Replace>
      <Type>ART_DEF_UNIT_MECHANIZED_INFANTRY</Type>
      <DamageStates>1</DamageStates>
      <Formation>Vehicle</Formation>
    </Replace>
  </ArtDefine_UnitInfos>

  <ArtDefine_UnitInfoMemberInfos>
    <Replace>
      <UnitInfoType>ART_DEF_UNIT_MECHANIZED_INFANTRY</UnitInfoType>
      <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_PARATROOPER</UnitMemberInfoType>
      <NumMembers>4</NumMembers>
    </Replace>
    <Replace>
      <UnitInfoType>ART_DEF_UNIT_MECHANIZED_INFANTRY</UnitInfoType>
      <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_MECHANIZEDINFANTRY</UnitMemberInfoType>
      <NumMembers>2</NumMembers>
    </Replace>
  </ArtDefine_UnitInfoMemberInfos>
</GameData>

but if the <Replace> tags don't work, use the equivalent <Update> elements
 
I used that XML with the <GameData> and <Replace> tags, but the mod did not change the unit graphics.

I also tried using <Update> tags, but I do not know what to tags and locations to use for the "Where" and "Set" portions so I was probably unable to test this fully.
 
Code:
  <ArtDefine_UnitInfoMemberInfos>
    <Update>
      <Where UnitInfoType="ART_DEF_UNIT_MECHANIZED_INFANTRY" UnitMemberInfoType="ART_DEF_UNIT_MEMBER_MECHANIZEDINFANTRY"/>
      <Set NumMembers="2"/>
    </Update>
    <Row>
      <UnitInfoType>ART_DEF_UNIT_MECHANIZED_INFANTRY</UnitInfoType>
      <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_PARATROOPER</UnitMemberInfoType>
      <NumMembers>4</NumMembers>
    </Row>
  </ArtDefine_UnitInfoMemberInfos>
 
I tried using code posted above, but still could not produce any changes in the game. I do not receive any type of error messages or CTD, but nothing changes in the game. The mod seems to be functioning properly except for using this XML file (though that is the only change in the mod).

I am also looking at what Nutty posted, but have not been able to test that method yet.
 
The mod seems to be functioning properly

It's not

7459182434_0006fff25c.jpg


double check your OnModActivated->UpdateDatabase entries, your xml.log and database.log files

Something in your mod is broken
 
I am looking through the mod to see the problem. I have OnModActivated set to Update the database with UnitArt/NewArtDefines_Units.xml. This folder and the file are the only ones that I use in the mod at present. Reload Units System is checked.

This is from the database log:

Code:
[3339.560] constraint failed
[3339.560] While executing - 'INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset) VALUES(?,?,?)'
[3345.347] Validating Foreign Key Constraints...
[3345.347] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[3345.347] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[3345.347] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[3346.673] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[3346.673] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[3346.673] Failed Validation.
[3347.282] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		381696		32933272
PageCache:	4357		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29417600
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		10
------------------------------

From the XML log:

Code:
[3345.332] **** Validating Game Database *****
[3346.673] Performing Localization Checks
[3346.673] Checking Tag Format...
[3346.673] Note: Tags must only use [A-Z_] characters, start with 'TXT_KEY_', and be under 128 characters long.
[3346.673] In table Language_en_US...
[3346.673] Tag (TXT_KEYMODDING_SHOWDLCMODS) does not start with 'TXT_KEY_'
[3346.705] Validating UnitGameplay
[3346.705] Number of selection sounds doesn't match number of units.
[3346.705] Validating Notifications
[3346.705] Number of notification xml entries does not match enum size
[3346.705] **** VALIDATION FAILED *****
[3346.705] Validation Took 1.363089 seconds
[3347.282] **** Validating Prefetch Process *****
[3347.282] **** Validation Success *****
[3347.282] SetGlobalActionInfo
[3347.282] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		381696		32933272
PageCache:	4357		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29417600
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		10
------------------------------
 
so that rules out database.log and xml.log so the problem must be in your mod config (.modinfo) file
 
I looked at the .modinfo file for awhile and tried to changing the <file> section in a few ways, but the problem remains.

This is the contents of the .modinfo file:

Code:
 <?xml version="1.0" encoding="utf-8"?>
<Mod id="6b326f24-940e-4fce-bfbf-e12a0bb4d09e" version="1">
  <Properties>
    <Name>Mechanized Infantry</Name>
    <Stability>Experimental</Stability>
    <Teaser>Mechanized Infantry</Teaser>
    <Description>Mechanized Infantry</Description>
    <Authors>The Tollan</Authors>
    <HideSetupGame>0</HideSetupGame>
    <AffectsSavedGames>1</AffectsSavedGames>
    <MinCompatibleSaveVersion>0</MinCompatibleSaveVersion>
    <SupportsSinglePlayer>1</SupportsSinglePlayer>
    <SupportsMultiplayer>1</SupportsMultiplayer>
    <SupportsHotSeat>1</SupportsHotSeat>
    <SupportsMac>1</SupportsMac>
    <ReloadLandmarkSystem>0</ReloadLandmarkSystem>
    <ReloadStrategicViewSystem>0</ReloadStrategicViewSystem>
    <ReloadUnitSystem>1</ReloadUnitSystem>
  </Properties>
  <Dependencies />
  <References />
  <Blocks />
  <Files>
    <File md5="29EB172C6731E588D595C77ABB02353C" import="0">UnitArt/NewArtDefines_Units.xml</File>
  </Files>
  <Actions>
    <OnModActivated>
      <UpdateDatabase>UnitArt/NewArtDefines_Units.xml</UpdateDatabase>
    </OnModActivated>
  </Actions>
</Mod>
 
Just zip and post the mod, as I'm now down to "is the file really called that" and "are you actually starting a game with the mod enabled" type questions
 
Edit: I noticed something from your post. I did not have the mod enabled when testing it... Uggh..

Been there, seen that, got the T-shirt ... but still ... ROFLMAO :lol:

Once you have enabled it and tested, post back if there are still problems!
 
Back
Top Bottom