Changing Unit Flags/Icons

edit
Seems that if you change the flag on a unit it will mess up the icons in the strategic view(example your settler icon might turn into a warriors axe icon in the strategic view only.) Hopefully someone smarter than me will come along and figure out the right way of doing this.
edit

Hey, I spent most of the night working and tweaking this and I still dont think I made the icon right with gimp. But I will share what I did to make an acceptable icon for myself.

First you need to make changes to your Unit xml file ... then you need to add another file with some IconTextureAtlases code.

In this code (Units) you need to change 2 lines (UnitFlagAtlas) and (UnitFlagOffsetIcon) they are highlited in red text
Spoiler :

Code:
I removed some unrelated code to make it shorter for this example.

<GameDate>
       <Units>
	<Row>
		<Class>UNITCLASS_SEMAPHORE</Class>
		<Type>UNIT_SEMAPHORE</Type>
		<!--<PrereqTech>TECH_AGRICULTURE</PrereqTech>-->
		<Combat>1</Combat>
		<Cost>-1</Cost>
		<Moves>3</Moves>
		<CombatClass>UNITCOMBAT_RECON</CombatClass>
		<Domain>DOMAIN_LAND</Domain>
		<DefaultUnitAI>UNITAI_EXPLORE</DefaultUnitAI>
		<Description>TXT_KEY_UNIT_SEMAPHORE</Description>
		<Civilopedia>TXT_KEY_CIV_ANTIQUITY_SCOUT_TEXT</Civilopedia>
		<Strategy>TXT_KEY_UNIT_SCOUT_STRATEGY</Strategy>
		<Help>TXT_KEY_UNIT_HELP_SEMAPHORE</Help>
		<NoBadGoodies>true</NoBadGoodies>
		<Pillage>false</Pillage>
		<MilitarySupport>true</MilitarySupport>
		<MilitaryProduction>false</MilitaryProduction>
		<!--<ObsoleteTech>TECH_SCIENTIFIC_THEORY</ObsoleteTech>-->
		<AdvancedStartCost>10</AdvancedStartCost>
		<XPValueAttack>3</XPValueAttack>
		<XPValueDefense>3</XPValueDefense>
		<UnitArtInfo>ART_DEF_UNIT_SEMAPHORE</UnitArtInfo>
		[color=red]<UnitFlagAtlas>MY_SEMA_FLAG</UnitFlagAtlas>[/color]
		[color=red]<UnitFlagIconOffset>0</UnitFlagIconOffset>[/color]
		<IconAtlas>UNIT_ATLAS_1</IconAtlas>
		<PortraitIndex>5</PortraitIndex>
	</Row>
       </Units>
</GameData>

make a new file and add this code (IconTextureAtlases)
Spoiler :

Code:
<GameData>
	<IconTextureAtlases>
		<Row>
			<Atlas>MY_SEMA_FLAG</Atlas>
			<IconSize>32</IconSize>
			<Filename>Icon_Flag_SEMAPHORE.DDS</Filename>
			<IconsPerRow>1</IconsPerRow>
			<IconsPerColumn>1</IconsPerColumn>
		</Row>
	</IconTextureAtlases>
</GameData>


So my modbuddy tree looks like the picture in the spoiler below.
Spoiler :

(units) file is called UnitSemaphore.xml and my (IconTextureAtlases) file is called IconTextureAtlases.xml
Also in the Art folder I added the Icon_Flag_Semaphore.dds image I used for the flag icon.

filelist.jpg



Ok so ... the actual DDS file for the icon is something I am not sure I did right .. but I will explain how I got it to work ... maybe someone else will point out what I did wrong or can show me a better way.

I used gimp to start a new image file 32 x 32 with a transparent background (advanced options -background fill- transparency). Then I added the image(if the image you create/copy&paste is white , the game will automatically apply the right civ colors to it) I wanted and saved as a dds file with an alpha channel (Format rgba8)

And a screenshot of the final icon in game
Spoiler :

newicon.jpg


Sorry if I over simplified it .. but I was having too much fun doing all this stuff I have never done before :)

Couple of threads dealing with images and gimp http://forums.civfanatics.com/showthread.php?t=389795

I tried to do my icon the way they explaining in there but I am not familiar enough with the terms to follow what they were talking about ... I would need a step by step hand holding , explain it to me like I am a 5 year old guide in order for me to get it to work. :)

Last edit I think...

I downloaded the queen of Iceni v3

I look that one over a lot while I am making changes to my mod and I also look over the babylon dlc stuff.
 
Wow, that's pretty cool. Did you have to add the Egyptian colors or did the game auto-colorize the graphic?

I'll give your suggestions a try– I think my problem was coding language, as I kept getting blank icons for my new units.

Also, shameless plug, but if you get a chance check out my mod 'War and Peace.' I've been working on it and need some feedback.

I imagine you are doing some kind of Egyptian conversion with more...mythical-esqe units, no? Looks cool.

-Gazebo
 
I had to use a certain shade of purple. I believe if I could do it properly like in the other threads that I linked then it would be perfect and it would change colors automatically depending on the civ that uses it. But this little thing I tossed together should work for showing whatever icon you make.

You can use the templates from the other threads .. but you would have to change the numbers around in the atlas file. I believe the templates are 8 circles x 8 circles, so you would have to put 8 in where I put 1 and I am pretty sure 0 is still the correct number to use for the first icon slot on the 8 x 8 template.

One other thing I noticed while trying to make this work is ... if you change the dds file and rebuild your mod , you have to restart the game from fresh ... you cant just go back to main menu and restart the mod. You have to exit the game back to desktop and then restart the game. If you just change the xml files , you can just restart the mod from the main menu rather than completely leaving game back to desktop.

The blank icons happened for me if I used the wrong size pic .... or if I used the wrong number when pointing to a circle in the template. Thats one of the reasons I scrapped the template and went to a single 32 x 32 dds file.

My mod is a personal use only for me. I dont really like any of the civs so I am making my own. I used kaels guide to make the egyptians unplayable then I made my mod use the egyptian theme , eventually I might make it all mine and maybe release it for others to play with. But I believe it is fairly overpowered since I gave them the Japanese trait of units always fighting at full strength even when wounded.

I also made a unique unit that replaces the swordsman. I gave them the Janisary ability to fully heal if they kill a unit. (I did lower their attack from 11 to 8) I then decided I liked the way the persian imortals looked so I used their model instead of the swordsman model.

Finally I made a new special unique unit that I can only have 1 of ... I get it as a freebie when I start the game but I am unable to make another during the game. I based it on the scout but I gave him the invisibilty ability and he can also go in to any other civ lands even if there is no open borders agreement. He can not attack or anything all he is for is scouting.

Let me know how it goes .. and if you figure out the proper way to make the dds file , please let me know how to do it ... if you use gimp that is ... seems like it is different method if you use photoshop.
 
Moderator Action: Moved to tutorials & references.

Because that's the second post essentially, a description how to do it.
I don't know if a many new modders might have problems with that, but it will not hurt to have that description here.
Nice description :).
 
So if I want to change the icon from one unit to another, would I just put the unit's icon I want and replace the current icon with the two lines from the desired icon?

What I mean is that I have replaced a texture of the rocket artillery with that of a regular modern day artillery and I want to change the icon in the game and in the Civilopedia to that of the regular artillery.

So would I just look in CIV5Units.xml in the artillery's section and replace my modded unit's icon lines with that of the artillery's?
 
So would I just look in CIV5Units.xml in the artillery's section and replace my modded unit's icon lines with that of the artillery's?

Note I replied in the other thread you have going. In short, yes. Note that the strategic view icon is defined in the ArtDefine_StrategicView table.
 
Top Bottom