Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Project & Mod Development > Civ4 - BTS Unaltered Gameplay (BUG, BAT and BULL)

Notices

Reply
 
Thread Tools
Old Oct 31, 2008, 07:14 AM   #1
draco963
Prince
 
draco963's Avatar
 
Join Date: Jan 2007
Location: Ottawa
Posts: 438
Trying ot change the "General" of the GG Bar to an icon...

As the title says, that's what I'm trying to do. I'd much prefer a Great General icon instead of the word "General". Unfortunately, it's not as easy as just defining:
Code:
def getGreatGeneralText(iNeededExp):
	sGreatGeneralIcon = u"%c" % ArtFileMgr.getUnitArtInfo("ART_DEF_UNIT_WARLORD_COUNTER").getButton()
	return BugUtil.getText("INTERFACE_NEXT_GREAT_GENERAL_XP", (sGreatGeneralIcon, iNeededExp,))
in GGUtil.py and changing the "General" in the BUG_CIV4GameText.xml to "%s1". Doing this causes the GG Bar to not load at all. Yes, I have defined the art file. Any ideas?
__________________
The Modiki (seen above) still needs detailes on the XML files. Please help in transferring data from the old Civ IV Wiki. Thank-you.

Impaler[WRG]'s Upgrade Cost Modifier, updated for BtS v3.19, TheLopez's Great Generals from Barbarian Combat Mod, updated to BtS v3.19 English Spelling Mod
"It's not your blue blood, your pedigree or your college degree. It's what you do with your life that counts." - Millard Fuller
"Imagination is the foundation of reality." - Dylan Henry
draco963 is offline   Reply With Quote
Old Oct 31, 2008, 09:04 AM   #2
The Doc
Time Lord
 
The Doc's Avatar
 
Join Date: Feb 2008
Location: between time and space
Posts: 344
That's in the feature tracker for BUG but maybe there are reasons why the actual implementation takes so long.
__________________
"Doctor? Doctor who...?"

The Beyond the Sword Unaltered Gameplay (BUG) Mod
"It'll blow your mind!" - Sid M.
Check out BAT and BULL, too.
The Doc is offline   Reply With Quote
Old Oct 31, 2008, 12:44 PM   #3
Del69
Chieftain
 
Join Date: Oct 2008
Location: Covington, WA
Posts: 33
Its not working because your trying to shove an art file into a text string. The only "pictures" you can use in strings are the ones from the GameFont.tga file.

Try something like this

Code:
def getGreatGeneralText(iNeededExp):
    icon = u"%c" % CyGlobalContext().getGame().getSymbolID(FontSymbols.GREAT_PEOPLE_CHAR)
    text = icon + " : " + str(iNeededExp)
    return text
Del69 is offline   Reply With Quote
Old Oct 31, 2008, 02:26 PM   #4
NikNaks
Deity
 
NikNaks's Avatar
 
Join Date: Jul 2006
Location: England
Posts: 2,972
I could add a GG glyph to the font file if you want. It would be pretty painless.
__________________
My work: Units - Leaderheads - Expanded Natives and Scandinavia Expansion (WIP) for BAT
The BtS Unaltered Gameplay (BUG) Project Forum - BUG 4.4, BAT 3.0.1 and BULL 1.2 Now Out!
NikNaks is offline   Reply With Quote
Old Oct 31, 2008, 10:26 PM   #5
draco963
Prince
 
draco963's Avatar
 
Join Date: Jan 2007
Location: Ottawa
Posts: 438
Wow! Three answers! Cool!

@ Doc, sorry I don't get you...

@ Del69, that code looks (from my extremely limited understanding of Python) like it would probably work. One question though: GREAT_PEOPLE_CHAR defines slot 13,13 in the two GameFont files. And I know that in BtS, the FontButtonIndex tag of CIV4ArtDefines_Bonus.xml indicates which icon in GameFont to use for resources. But where are the definitions for everything else, and how to I tell the game that slot 13,24 (after the lightning bolt) is GREAT_GENERAL_CHAR?

@ NikNaks, I think I'm ok with the graphic. I was able to take the GG icon from WarlordsAtlas_1 slot 5,10, and take out the background, so it's just the Generals head, with the rest transparent. Looks nice, if I do say so myself . So I have a template to work from, and I think I should be ok. But thank-you for the offer, and if I have trouble sizing it down, I will definately take you up on it.
__________________
The Modiki (seen above) still needs detailes on the XML files. Please help in transferring data from the old Civ IV Wiki. Thank-you.

Impaler[WRG]'s Upgrade Cost Modifier, updated for BtS v3.19, TheLopez's Great Generals from Barbarian Combat Mod, updated to BtS v3.19 English Spelling Mod
"It's not your blue blood, your pedigree or your college degree. It's what you do with your life that counts." - Millard Fuller
"Imagination is the foundation of reality." - Dylan Henry
draco963 is offline   Reply With Quote
Old Oct 31, 2008, 11:31 PM   #6
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,624
I tried this before, and you can embed images into text using "<img src=/Art/Foo/Bar.dds></img>" or something similar. The problem was that when doing so, images get shifted a bit above the baseline of the text, making it look ugly.

My next thought was to simply place an icon as an image next to the text, but I got side-tracked with other things. This would still work, but I think NikNaks's suggestion of putting the image you've yanked out into the font file is the best route. It will align nicely with the baseline and be quite easy. I think it would be useful elsewhere, too, e.g. the CDA for settled specialists.

Oh, I suppose you could embed the settled Military Instructor instead of the GG for the CDA thing, NN. Both is probably best.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Nov 01, 2008, 03:35 AM   #7
Caesium
Radiant!
 
Caesium's Avatar
 
Join Date: Jan 2006
Posts: 526
Quote:
Originally Posted by NikNaks View Post
I could add a GG glyph to the font file if you want. It would be pretty painless.
That would be great.
Caesium is offline   Reply With Quote
Old Nov 02, 2008, 03:10 PM   #8
draco963
Prince
 
draco963's Avatar
 
Join Date: Jan 2007
Location: Ottawa
Posts: 438
Ok, here are the two GameFont files with a GG icon added in.

fonts.rar

I still odn't know how to tell the game where the new icon is located... I thought there would be a file somewhere in the BUG mod specifying the six new smilies on the last line of GameFont_75, but I can't find anything...
Attached Thumbnails
Click image for larger version

Name:	GameFont.JPG
Views:	34
Size:	44.4 KB
ID:	193237   Click image for larger version

Name:	GameFont_75.JPG
Views:	30
Size:	31.3 KB
ID:	193239  
__________________
The Modiki (seen above) still needs detailes on the XML files. Please help in transferring data from the old Civ IV Wiki. Thank-you.

Impaler[WRG]'s Upgrade Cost Modifier, updated for BtS v3.19, TheLopez's Great Generals from Barbarian Combat Mod, updated to BtS v3.19 English Spelling Mod
"It's not your blue blood, your pedigree or your college degree. It's what you do with your life that counts." - Millard Fuller
"Imagination is the foundation of reality." - Dylan Henry
draco963 is offline   Reply With Quote
Old Nov 02, 2008, 11:32 PM   #9
draco963
Prince
 
draco963's Avatar
 
Join Date: Jan 2007
Location: Ottawa
Posts: 438
OK, so I thought I had it figured out, when I saw all the FontSymbols definitions at the end of CvUtil.py. But no, it doesn't work either.

Adding the line
Code:
'great general' : FontSymbols.GREAT_GENERAL_CHAR,
at the end of the "OtherFontIcons =" argument causes the entire interface to not load at all. The game loads fine, but no interface, which you'll agree makes playing a trifle difficult.

So, commenting out the line in CvUtil.py, and using this
Code:
def getGreatGeneralText(iNeededExp):
	sGreatGeneralChar = u"%c" % CyGame().getSymbolID(FontSymbols.OCCUPATION_CHAR)
	return BugUtil.getText("INTERFACE_NEXT_GREAT_GENERAL_XP", (sGreatGeneralChar, iNeededExp,))
in GGUtil.py and this
Code:
	<TEXT>
		<Tag>INTERFACE_NEXT_GREAT_GENERAL_XP</Tag>
		<English>%s1 (%d2)</English>
in BUG_CIV4GameText.xml worked like a charm. I now have a lovely red fist in the GG Bar, instead of the word "General".

As you can see above, I have added a GG icon to the GameFont files, and the game seems fine loading those files instead of ones without the GG. But getting the game to recognize the existence of that icon is proving difficult. So, I don't know where to go from here. Any advice?
__________________
The Modiki (seen above) still needs detailes on the XML files. Please help in transferring data from the old Civ IV Wiki. Thank-you.

Impaler[WRG]'s Upgrade Cost Modifier, updated for BtS v3.19, TheLopez's Great Generals from Barbarian Combat Mod, updated to BtS v3.19 English Spelling Mod
"It's not your blue blood, your pedigree or your college degree. It's what you do with your life that counts." - Millard Fuller
"Imagination is the foundation of reality." - Dylan Henry
draco963 is offline   Reply With Quote
Old Nov 02, 2008, 11:44 PM   #10
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,624
Quote:
Originally Posted by draco963 View Post
OK, so I thought I had it figured out, when I saw all the FontSymbols definitions at the end of CvUtil.py.
Those lines don't actually define the FontSymbols constants. Ah, if only it were that easy.

Well, now it is!

I present to you the new FontUtil module. I just committed this to our code repository, so you'll need to be using the latest version from SVN.

To define a constant, add the <symbol> tag to init.xml.

Code:
<symbol id="greatgeneral" name="GREAT_GENERAL" from="POWER" offset="1"/>
To use it in the game, sadly you cannot embed it directly into the <TEXT> XML element like you can with bullets (e.g. [ICON_BULLET]), but you can get close. Modify your code above like so:

Code:
sGreatGeneralChar = FontUtil.getChar(FontSymbols.GREAT_GENERAL_CHAR)
and don't forget to "import FontUtil" at the top of your module.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th

Last edited by EmperorFool; Nov 02, 2008 at 11:49 PM.
EmperorFool is offline   Reply With Quote
Old Nov 03, 2008, 01:08 AM   #11
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,624
BTW, the latest SVN version added some new font symbols itself, so just use your own file for your testing or modify my code above (offset = 2) if you put your icon next to the new Generic Citizen icon.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Nov 03, 2008, 01:21 AM   #12
draco963
Prince
 
draco963's Avatar
 
Join Date: Jan 2007
Location: Ottawa
Posts: 438
EmperorFool, firstly, you are a coding genius. Thank-you.

Secondly, if adding new icons to the GameFont files is so difficult, how did you guys get the game to recognize your new War & Peace icons used by the Advanced Scoreboard?

Thirdly, the download of the nightly update of BUG is broken. It presents this instead:
Code:
An error has been encountered in accessing this page. 

1. Server: civ4bug.sourceforge.net 
2. URL path: /daily_build/ 
3. Error notes: NONE 
4. Error type: 403 
5. Request method: GET 
6. Request query string: NONE 
7. Time: 2008-11-03 08:15:14 UTC (1225700114) 

Reporting this problem: The problem you have encountered is with a project web site hosted by SourceForge.net. This issue should be reported to the SourceForge.net-hosted project (not to SourceForge.net). 

If this is a severe or recurring/persistent problem, please do one of the following, and provide the error text (numbered 1 through 7, above): 

Contact the project via their designated support resources. 
Contact the project administrators of this project via email (see the upper right-hand corner of the Project Summary page for their usernames) at user-name@users.sourceforge.net
If you are a member of the project that maintains this web content, please refer to the Site Documentation regarding the project web service for further assistance. 

NOTE: As of 2008-10-23 directory index display has been disabled by default. This option may be re-enabled by the project by placing a file with the name ".htaccess" with this line: 


Options Indexes
Thanks again EmperorFool.
__________________
The Modiki (seen above) still needs detailes on the XML files. Please help in transferring data from the old Civ IV Wiki. Thank-you.

Impaler[WRG]'s Upgrade Cost Modifier, updated for BtS v3.19, TheLopez's Great Generals from Barbarian Combat Mod, updated to BtS v3.19 English Spelling Mod
"It's not your blue blood, your pedigree or your college degree. It's what you do with your life that counts." - Millard Fuller
"Imagination is the foundation of reality." - Dylan Henry
draco963 is offline   Reply With Quote
Old Nov 03, 2008, 02:32 AM   #13
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,624
Hmm, I don't know why the nightly snapshot (a.k.a. daily build) is broken, but I highly recommend using SVN directly. It's not very difficult (easier than what you've done already I suspect), and the instructions are in the first post of the Download thread.

This will allow you to use a program like TortoiseSVN to get updates much more easily. In the meantime, however, to fix your code using the old way (the way I originally did the other new icons), change you code like so:

Code:
sGreatGeneralChar = u"%c" % ( CyGame().getSymbolID(FontSymbols.OCCUPATION_CHAR) + 2 )
The change is adding 2. getSymbolID() returns the unicode character value for the font symbol, and your icon is 2 to the right of the Occupation symbol IIRC.

Why did I add this new method of doing it in XML? Mostly for convenience and fun. The problem is that when merging other mods that might define their own new symbols, the positions in the files may clash. Moving those to XML makes it much easier for modders to merge font file constants--not the files themselves, though, but they're just images so that part isn't too bad.

I got sick of seeing font symbols for unrelated symbols, e.g. the War icon used to grab the CvYieldInfo object for and then offset it 25 positions in Python. That's a nightmare to explain to someone trying to do a merge that may have very limited Python skills. But telling them to modify an XML attribute from "25" to "26" is much safer.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Nov 03, 2008, 10:08 PM   #14
draco963
Prince
 
draco963's Avatar
 
Join Date: Jan 2007
Location: Ottawa
Posts: 438
Absolutely I agree with you. The new way will definately be easier to explain to noobies. In the meanwhile, this works like a charm. Just great! Thanks again!
__________________
The Modiki (seen above) still needs detailes on the XML files. Please help in transferring data from the old Civ IV Wiki. Thank-you.

Impaler[WRG]'s Upgrade Cost Modifier, updated for BtS v3.19, TheLopez's Great Generals from Barbarian Combat Mod, updated to BtS v3.19 English Spelling Mod
"It's not your blue blood, your pedigree or your college degree. It's what you do with your life that counts." - Millard Fuller
"Imagination is the foundation of reality." - Dylan Henry
draco963 is offline   Reply With Quote
Old Nov 04, 2008, 11:24 AM   #15
Caesium
Radiant!
 
Caesium's Avatar
 
Join Date: Jan 2006
Posts: 526
OK, so, when will the generals' icon be added to bug?
Caesium is offline   Reply With Quote
Old Nov 05, 2008, 06:51 AM   #16
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,624
Quote:
Originally Posted by Caesium View Post
OK, so, when will the generals' icon be added to bug?
Done. 8910
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Nov 05, 2008, 11:20 AM   #17
Caesium
Radiant!
 
Caesium's Avatar
 
Join Date: Jan 2006
Posts: 526
That's great
Caesium is offline   Reply With Quote
Old Nov 05, 2008, 07:50 PM   #18
alerum68
Priest of Hiroshima
 
alerum68's Avatar
 
Join Date: Jan 2004
Location: Bay Area, California
Posts: 2,515
Quote:
Originally Posted by draco963 View Post
EmperorFool, firstly, you are a coding genius. Thank-you.

Secondly, if adding new icons to the GameFont files is so difficult, how did you guys get the game to recognize your new War & Peace icons used by the Advanced Scoreboard?

Thirdly, the download of the nightly update of BUG is broken. It presents this instead:
Code:
An error has been encountered in accessing this page. 

1. Server: civ4bug.sourceforge.net 
2. URL path: /daily_build/ 
3. Error notes: NONE 
4. Error type: 403 
5. Request method: GET 
6. Request query string: NONE 
7. Time: 2008-11-03 08:15:14 UTC (1225700114) 

Reporting this problem: The problem you have encountered is with a project web site hosted by SourceForge.net. This issue should be reported to the SourceForge.net-hosted project (not to SourceForge.net). 

If this is a severe or recurring/persistent problem, please do one of the following, and provide the error text (numbered 1 through 7, above): 

Contact the project via their designated support resources. 
Contact the project administrators of this project via email (see the upper right-hand corner of the Project Summary page for their usernames) at user-name@users.sourceforge.net
If you are a member of the project that maintains this web content, please refer to the Site Documentation regarding the project web service for further assistance. 

NOTE: As of 2008-10-23 directory index display has been disabled by default. This option may be re-enabled by the project by placing a file with the name ".htaccess" with this line: 


Options Indexes
Thanks again EmperorFool.
Fixed the issue with the daily build.
__________________
My misconception is closest to the truth...

Beyond the Sword Unaltered Gameplay Project - BUGs, and BATs, and BULLs... oh my!

How to Release Your Mod!

لآ اِلَهَ اِلّا اللّهُ مُحَمَّدٌ رَسُوُل اللّهِ
alerum68 is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Project & Mod Development > Civ4 - BTS Unaltered Gameplay (BUG, BAT and BULL) > Trying ot change the "General" of the GG Bar to an icon...

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Real 'Near Future': "Mechs","Super Tanks","Super Soldiers","Space Elevator",Etcetera Wade. Civ4 - General Discussions 89 Jul 15, 2009 08:20 PM
The "No T&L" Bar is Now Open... agoodfella Civ4 - Technical Support 21 Oct 28, 2005 11:01 PM
Culture bar doesn't "fill up" Don Uittone Civ3 Conquests - Bug Reports 3 Jul 30, 2004 01:36 PM
Petition to rename OT to "Metaphysics Flame-Bait" Kilroy Site Feedback 9 Sep 05, 2003 04:39 AM


Advertisement

All times are GMT -6. The time now is 01:50 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR