How to Create City Bar Icons for your New Units

Shqype

Shqyptar
Joined
Nov 15, 2005
Messages
2,468
Location
New York + Shqypni
This tutorial is something I quickly came up with after I discovered how to get that pesky "!" to disappear whenever I built my newly made units. I've seen many mods with the exclamation mark where a unit icon should be, so hopefully this will make it easier for people to correct it.

First, use GIMP to open up the unit icon .dds file.

The size of the image will need to be cut in half to get a better selection. Click on Image, Scale Image, and set the height and width to 32x32 pixels (instead of 64x64). Then click scale. Now you are ready to make your selection.

Use the "Select elliptical regions" tool to select the region from the icon that you want to appear in the CityBar Atlas. The following options should be selected:
-Antialiasing, Feather Edges, and Autoshrink should be unchecked
-Make sure you select "Fixed Size" instead of "Free Select."
-Set the dimensions to 26x26 pixels.

Now you are ready to make your selection from the unit icon. I recommend zooming the unit icon file to 800% to make it easier to choose the selection. By moving the pointer to a position near the top left corner, and (while holding down the left mouse button) moving to the right, you will notice the selection has been made. If it is not to your liking, you can move over a pixel or two and do it again until you are satisfied.

Next, go to Edit, then Copy to copy the selection. Go into the template I have provided (this time at 1600% zoom) and go to Edit, Paste to paste the new layer you have selected. It should appear exactly in place, although you can move the layer if you need to.

When it is where you want it, go to Layer, Anchor Layer (or Merge Down if available), to merge the top layer onto the bottom. Don't despair if there are still pixels that are transparent: Use the "Pick colors from the image" tool to pick a color next to a transparent spot, then switch to the Pencil icon tool to paint them in (only possible if layers have been merged). The pencil should be set as follows:
-Opacity: 100%
-Mode: Normal
-Brush: Circle (01)
-With Fade Out, Incremental, and Use color from gradient all unchecked.

When done, Save As (so as not to overwrite the template) with a unique name. Save it as a .dds file; it's not necessary to use DXT3 compression because either way it won't be able to compress (non power-of-2 sized image).

Next, go to the CityBar_Atlas_32.dds file (make sure it is a copy that will be used for the mod) and select File, Open as Layer. Select the image you just created, and add it in the correct place on the Atlas. The positions correspond to the positions on the unit_resource_atlas.dds file, so just put it where it belongs. Use the 4-arrows button ("Move layers & selections") to move the layer into its slot. 800% zoom helps in putting the layer over the exact spot it needs to be in for it to work. Once it's in correctly, once again merge the layer down to the Atlas.

Save the file as a .dds with DXT3 compression. This time it will work.

Repeat this process for as many unit icons as necessary.

NOTE: I zipped the .dds file since I cannot upload them. Sorry for any inconvenience.
 

Attachments

  • CityBarButtonTemplate.zip
    601 bytes · Views: 408
CORRECTION:

I just tested out my theory to make sure it worked... as it turns out my changes work for making the round unit icon show correctly when the unit is "off the screen," but the city bar icon still remains the same.

By giving a new unit the icon of an original unit in XML (<Button>,Art/Interface/Buttons/Units/Conquistador.dds ) , you ensure that they get that units city bar icon ... yet custom made units' are unavailable and show up with the "!" ... perhaps there is a special channel in the standalone unit icon that determines what the city bar icon will look like?
 
Those "pesky !'s" have really annoyed me. I have tried this advice and several others, but to no avail. So after numerous evenings with trial and error - heres my take on the stake. Now I might have missed a trick somewhere, if so please provide an xml snippet with the solution. Either way, I hope my "findings" will be usefull for you all.

Problem
The problem and the solution is in this tag:
Code:
<Button>,Art/Interface/Buttons/Units/Panzer.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,3,11</Button>
Most mods usually just put one value in the tag:
Code:
<Button>Art/Interface/Buttons/Units/Panzer.dds</Button>
Easy enough, but the city bar icon will turn up as a "!". Playable - but not that "nifty".

What I found out
Having only one value in the button-tag will not provide a city bar icon. Putting a comma (or not) as the first character, doesn't remove the "!". Nothing actually does - besides copying all the values of the tag off an existing unit. But that's no fun, you'll just end up with two identical units. Let's take a look at the tag in details:
Code:
<Button>,path/icon.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,x,y</Button>

path/icon.dds = path to any built-in Firaxis icon. For instance to existing units, promotions, unit types icons. This icon is the one that get's in the city bar display. It cannot be custom(!). It cannot refference any icon in a mod- or CustomAssets folder. (Too bad really). Apparently there's a loading bug - see this post by Thalassicus. I suggest that you leave this part unchanged, and refference the icon of the "original" unit icon.

Art/Interface/Buttons/Unit_Resource_Atlas.dds,x,y = path to the Unit Ressource Atlas, ie. a large mapfile of units and ressources. "x" is the horisontal coordinate, from the left. "y" is the vertical form the top. This is the only place to make the icon for a new unit. Copy the icon of the original unit to an empty space and redo it to your liking. Redo the icon of the original unit aswell to make them diffent. The icons in the Unit_Resource_Atlas will be used in the city display, in the unit bar, civilopedia and "off screen" pointer. Remember to copy the original atlas file to your mod and work on that one. Changing the CityBar_Atlas_32.dds file apparently have no effect, unless you refer to this one in the tag value instead of the Unit_Resource_Atlas (but don't - it looks awfull).

Example
For the SpecOps Mod Im' doing a Huey transport helicopter based on the Gunship unit. The button-tag looks like this:
Code:
<Button>,Art/Interface/Buttons/Units/gunship.dds,Art/Interface/Buttons/unit_resource_atlas.dds,5,11</Button>
Gunship and Huey's get's the same city bar icon, but different icons anywhere else due to the different icons in the Unit_Resource_Atlas. See attachment.
 

Attachments

  • screenie.jpg
    screenie.jpg
    88.9 KB · Views: 686
Most mods usually just put one value in the tag:
Code:

<Button>Art/Interface/Buttons/Units/Panzer.dds</Button>

Easy enough, but the city bar icon will turn up as a "!". Playable - but not that "nifty".

What I found out
Having only one value in the button-tag will not provide a city bar icon. Putting a comma (or not) as the first character, doesn't remove the "!". Nothing actually does - besides copying all the values of the tag off an existing unit. But that's no fun, you'll just end up with two identical units.

I have puzzled over this a long time and it has really annoyed me in our mod we refencence our unit art like this:
<Button>Art/Interface/Buttons/Units/Panzer.dds</Button>
And I end up getting pesky ! in the city bar, however our my brothers computer the city bar icons work beautifuly with exactly the same mod. This has really puzzles me. I do not want to go through the extra work to make the unit icon atlas to make it work on my computer as well.
 
I find it strange that on two different computers loading the same mod, one gets the "!" marks and the other doesn't ....

I actually began to believe that it had something to do with the alpha channel. What you have discovered, yepzer, I found out as well: Keeping the first icon path of a vanilla unit icon, and changing the second to the new one will get your new icon used everywhere except the city bar... this is what led me to believe there was an alpha channel issue.

But, matthewv, if it's true that one computer gives a "!" and one doesn't, then it must be something computer based (obviously). The only useful correlation I might come up with is if each comp had 2 different versions of python; maybe one accurately sets the citybar icon, and one doesn't.
 
Where are you placing the mod files? I got this when I put them in CustomAssets, but after moving them to a Mods/ folder, the problem went away.

thats weird. Though it does explain why I can get it to work on my brothers computer and not mine. Thanks for the help.
 
They are in the mods folder. Not custom assets, but the custom "MODS" folder in the My Game's directory in My Documents. Perhaps it would work if it was installed in the original game folder?
 
Thanks for the good replies!

No luck here yet though. I have retried CustomAssets, the "my games" mod folder and the "program files/.../civ4../mods/" folder. I have the same problem when using the Lost Units mod and Composite Mod (1.7). I generally run games under the Blue Marple mod and "Tubby's mod of Homegrowns Civilization 4 Game Clock Mod v.1.2". Removing the later's version of CvMainInterface.py does no difference (on this issue).

matthewv - could you please give any details in the differences of the two pc's? My "details" are: Civ4 patch 1.52, msxml4, directX 9.0c, ati radeon 9700 card 1280x800 (widescreen :)).

yepzer
 
matthewv - could you please give any details in the differences of the two pc's? My "details" are: Civ4 patch 1.52, msxml4, directX 9.0c, ati radeon 9700 card 1280x800 (widescreen ).

I found out why they work on one computer and not the next. I has nothing to do with the PC specs.
There are two different mods folders, one under the My games folder and one under Program Files/Firaxis/Sid Meiers Civilization 4(or were ever you install civ4) If you put the mod in the mods folder in the My Games directory, The mod will work fine except for the citybar icons. But if you put the mod in the other mods folder the city bar icons will work fine. I know you said you tried this but thats what I found worked for me.
 
Alright, but a revised citybar atlas with the icons on it must be present, correct?
 
matthewv: Thanks - that solved it.

For test purposes - I did the attached "micro" mod which replaces the scout icon with one (called terry) i had "at hand". When I put it in
C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Mods it does work, but when I put C:\Documents and Settings\...\Documents\My Games\Sid Meier's Civilization 4\MODS it doesn't.

Shqype: How does this work out in your end?

/Yepzer (reworking my Spec Ops mod)
 

Attachments

  • CityBarIcon.zip
    20.6 KB · Views: 245
matthewv said:
I found out why they work on one computer and not the next. I has nothing to do with the PC specs.
There are two different mods folders, one under the My games folder and one under Program Files/Firaxis/Sid Meiers Civilization 4(or were ever you install civ4) If you put the mod in the mods folder in the My Games directory, The mod will work fine except for the citybar icons. But if you put the mod in the other mods folder the city bar icons will work fine. I know you said you tried this but thats what I found worked for me.
Thank you! I can stop beating my head on the desk now :D For the longest time I couldn't figure out why a mod I downloaded didn't have the ! icon but when I copied all unit related stuff bit by bit to my mod it would have the damn ! icon. Of course that was because I keep all "my" mods in the user folder while all the downloaded mods in the civ4 folder.

I hope they fix this in next patch and maybe (though unlikely) clean up the whole resource_atlas/citybar_atlas thing, 'cause obviously civ4 only needs one image as source for an icon.

Shqype said:
Alright, but a revised citybar atlas with the icons on it must be present, correct?
No. I definitely know mods where there's only the first icon specified and they show up the right image everywhere just fine. It seems that the whole atlas thing is not really needed and is probably a left-over that they forgot to clean up.
 
yepzer said:
...Let's take a look at the tag in details:
Code:
<Button>,path/icon.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,x,y</Button>

path/icon.dds = path to any built-in Firaxis icon. For instance to existing units, promotions, unit types icons. This icon is the one that get's in the city bar display. It cannot be custom(!). It cannot refference any icon in a mod- or CustomAssets folder. (Too bad really). Apparently there's a loading bug - see this post by Thalassicus. I suggest that you leave this part unchanged, and refference the icon of the "original" unit icon.

does the new 1.61 patch fix this?

or can the SDK fix it?

I reskinned the great_general unit and had that pick screen for the unit (unit icon above the city) but still had to use a "vanilla" pic even though my custom pic is better (IMHO)

I was able to custom the button for Great Specialist (when having a Great general join the city)

and custom pic the Civpedia and City Specialist in the city screen

so I find it weird that this very moddable game... doesnt let you mod that part... :sad:

I also have problems with re-skinned/new wonders and buiildings I made but it isnt that bad since there is no icon units for buildings :mischief:

It does show the pink button for a moment when it is first created...

but again I able to customize the button pics...

NOTE: I am still using the 1.52 patch since I am waiting for the mod I am using to update to 1.61 :crazyeye:

any one have any ideas on this?
 
I found out why they work on one computer and not the next. I has nothing to do with the PC specs.
There are two different mods folders, one under the My games folder and one under Program Files/Firaxis/Sid Meiers Civilization 4(or were ever you install civ4) If you put the mod in the mods folder in the My Games directory, The mod will work fine except for the citybar icons. But if you put the mod in the other mods folder the city bar icons will work fine. I know you said you tried this but thats what I found worked for me.

It is absolutely the case that you have to use the Program Files/Firax Games/Sid Meier's Cvilization 4/Mods folder to get rid of the (!) icon in the citybar. Everything else about a mod I'm working on worked except the citybar until I moved it from the My Games/Sid Meier's Civilization 4/MODS.

What I found out
Having only one value in the button-tag will not provide a city bar icon. Putting a comma (or not) as the first character, doesn't remove the "!". Nothing actually does - besides copying all the values of the tag off an existing unit. But that's no fun, you'll just end up with two identical units. Let's take a look at the tag in details

You can specify both files between the <Button> tags with the commas as long as they can be found in the /Assets/art/interface/buttons directory (buttons/units for the single-image file). I gather that is how they are intended to be used.

Thanks for the help leading me to this discovery!
 
Has anyone figured out how to make the "off screen" selected unit and the completion of the unit/building customized?

I tried messing with the atlas... and that doesnt work...:mad:

I could assign "vanilla" version of pics... but what's the point of having that when you have the rest of the images as custom? :(

(not to mention the "off Screen" selected unit would be confusing to find out what unit (custom or vanilla) you have selected)


any ideas???
 
EDIT: Info already posted
 
Top Bottom