Creating a New Unit, Can I change the Icon?

roadmaster

Chieftain
Joined
Apr 28, 2015
Messages
20
I have created a new Unit and have called it the M1Abrams which is of course a ripoff of the American M1Abrams Battle Tank, I have been using the LEV Tank art up til now. I wanted to create my own Icon for it, instead of using the Lev Tanks Icon. So I got to looking around and after unpacking a bunch of fpk files I found the xml file that had <UnitArtInfos><UnitArtInfo>. Just what I had been looking for. so I found the entry for the LEV Tank and copied it over into a xml file in my Mod, I first noticed that the UnitArtInfos did not have the GameData root tag so I tried my xml code both inside and outside of the GameData root tag. this is what I got from the LEV Tank info.

<UnitArtInfos>

<!-- Modified Lev Tank entry -->
<UnitArtInfo>
<Type>ART_DEF_UNIT_M1ABRAMS</Type>
<UnitFlagAtlas>UNIT_FLAG_ATLAS</UnitFlagAtlas>
<UnitFlagIconOffset>19</UnitFlagIconOffset>
<PortraitAtlas>AF_UNITS_ATLAS</PortraitAtlas>
<PortraitIndex>0</PortraitIndex>
<Formation>ThreeBigGuns</Formation>
<DamageStates>3</DamageStates>
<PortraitCamera>ART_DEF_PORTRAIT_CAMERA_VEHICLE_XLG02</PortraitCamera>
<UnitMemberArt>
<MemberType>ART_DEF_UNIT_MEMBER_LEV_TANK</MemberType>
<MemberCount>1</MemberCount>
</UnitMemberArt>
</UnitArtInfo>
</UnitArtInfos>

The only elements I changed were the Type, PortraitAtlas, and PortraitIndex. From within my M1Abrams Unit xml I call for <UnitArtInfo>ART_DEF_UNIT_M1ABRAMS</UnitArtInfo>, the Portrait Atlas points to a atlas I created using the 256x256 8x8 Template, my Icon is in the Top Left Circle so I call it with a Portrait Index of 0.

This has all been guesswork so far on my part, however it does not seem to work. With the UnitArtInfos xml Code in my M1Abrams Unit xml file, the game wouldn't even load my Tank Unit into the game regardless of whether or not the code was or was not in the GameData root tag. Before I did all this my Unit worked fine it just showed the Icon for the LEV Tank, after I took the UnitArtInfos xml code out of my Unit xml and put it in its own xml file my Tank would load again, however since I didn't change my Unit pointing to ART_DEF_UNIT_M1ABRAMS it came up with a Soldiers Icon, that's not an issue if I completely change it back, what is at issue is I would like to use my own Icon, not necessarily new Graphics for moving around, just the icon when purchasing the unit or when looking into the Pedia Entry.

So Can this be done? If so does anyone see what I have done wrong here?

I have successfully changed icons in the Buildings xml code, but Units does not have a IconAtlas or a PortraitIndex so my assumption was that it did this through the UnitArtInfo type. What I have tried is not working though.
 
The UnitArtInfos are defined differently in the Game's Database table than what they are in the xml file you found in the .fpk. Thus when adding art deines through mods, you have to use their alternate names. You can look up my mod's artdefines table for an example of how to structure your artdefine for your mod.

http://steamcommunity.com/sharedfiles/filedetails/?id=400212531
 
The UnitArtInfos are defined differently in the Game's Database table than what they are in the xml file you found in the .fpk. Thus when adding art deines through mods, you have to use their alternate names. You can look up my mod's artdefines table for an example of how to structure your artdefine for your mod.

Thanks, that did the trick. It took me awhile to fix my mod, for the life of me I just couldn't get those defines to work with my mod, for the longest time every time I started up the game my Sponsor wouldn't be displayed on the Setup's Sponsor screen. I finally realized I had added some bad language enUS entries at the same time that I added the ArtDefines. Thanks for the help.
 
Back
Top Bottom