Setting the "char" for a new yield type

Kastro

Chieftain
Joined
Apr 14, 2008
Messages
3
Hi,

This is my first time posting here. I'm an experienced programmer (non-game stuff) just getting into the Civ4 SDK, and have been working a mod of my own, mostly just experimenting and stuff to get a handle on things in the SDK.

One of the things I have been trying to do is to add another yield type to the game. Everything has gone smoothly except I haven't been able to figure out how to properly call the setChar function on my new CvYieldInfo object. To be clear, the "char" is used by the UI code to display the icon for each yield based on the GameFont.tga file (i.e. the slice of bread, hammer, and coin for the standard three yields).

I want to set the char for my yield the same way the base three yields have it set--to stick with convention--but can't figure out where it is done. It doesn't come from the XML file, where I thought it logically would have been. Looking at the code, it's obvious they are set via the setChar member function. It's not hard coded since there are no SDK calls to setChar, so I assume it is set somewhere in the python code. However, file searches have come up with nothing.

Does anyone know where setChar is called from for the food, production, and commerce yields? Should I just ignore it and modify the XML schema for my mod to have the char come from the XML files? Any help is appreciated, and I look forward to using the great resources that are here to come up with some cool things in Civ4.

Thanks.
 
I beat my head against the wall on this too Kastro, looking all over the SDK for the answer.

Turns out the answer isn't there in any way I could figure out. Eventually, someone had to just tell me. :)

The answer is that you need to add the icon to the fonts file as the next item in the same row as the other yield icons. Just make sure your yields stay in the same order in the XML as they do in the fonts file.

FYI, if you haven't tried it yet, editing fonts can easily break them. You will definitely want to read up about te proper way to edit them if you've never tried before. Photoshop or GIMP can do the job, but there are some very, very specific rules around how to draw the file.
 
Thanks a lot isau! I just got it working. Now I just need to change the game mechanics to make use of the new yield...
 
Back
Top Bottom