1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Exotic Foreign Advisor

Discussion in 'Civ4 - Mod Components' started by Requies, Dec 9, 2005.

  1. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    This is currently on version 0.94.

    [Edit] See this post for 0.95, which is compatible with the 1.61 patch [/Edit]

    Code:
    Exotic Foreign Advisor
    ______________________
    
    	This advisor came about because the original Advisors seems to have a dearth of important information
    
    Credits: SupremeOverlord - for the Enhanced Foreign Advisor from which the code for the Resource and Tech screens were taken (with a fix or two and some changes)
    	 Bhruic - for the "Tradeable" mod from which the idea was gained to separate the resources into "Surplus" (more than just 1) and "Used" (only 1).
    	 Mysterio10000 - for suggesting adding the qualitative attitude to glance screen and the centering of the Foreign Advisor title
    	 Cammagno - for pointing out and testing a bug related to Glance coloring and translating some of the text into Italian.
    	 Major Tom - for pointing out a bug and providing a save file to fix it with
    
    Features
    ________
    
    	1. Added in a "Glance" screen which shows how each AI feels toward everyone else. Also added in color coding and the ability to sort this screen.
    		a) This is basically a big table which I generated myself where the ROW leaderhead is the target and the COLUMN leaderhead is the one whose attitude is listed (so if you check on the number where Washington's ROW meets Montezuma's COLUMN, you are viewing Montezuma's attitude TOWARD Washington).
    		b) The color coding right now is based on player's attitude toward another. If he's friendly to another, it's green. If he's pleased with another, it's cyan. If he's annoyed with another, it's magenta. If he's furious with another, it's red.
    		c) To sort on a leaderhead (how that leader feels about other players), just LEFT-click on that leaderhead or ANY NUMBER in that leaderhead's COLUMN.
    		d) To change the direction of sorting, click on the big + button in the top left corner.
    		e) None indicates either the leaders have not met or that they are the same leader.
    	2. Added in an Info screen with the following information.
    		a) A player's state religion (and if he has the holy city)
    		b) The trade is the net trade you have with EACH opponent for ALL your cities. So, if you close open borders, you will LOSE this amount of commerce (and likely gain a much smaller amount)
    		c) The current civics this player is running (from left to right is Government, Legal, Labor, Economy, Religion)
    		d) The player's favorite civic (along with the type of civic)
    	3. Added in resources and technologies that the leader WANTS to the main resource and technology trading screens. Resources are divided into "Surplus" (Player has > 1) and "Used" (Player has ONLY 1) resources. Thanks to Supreme Overlord for the basic code.
    	4. Added in the technologies that the other players can research BASED ON THE INFORMATION from the technology trading screen. IOW, it will only calculate which technologies the other players can research based on what you know they have.
    
    From SupremeOverlord's Readme:
    _____________________________
    FEATURES
    --------
    General:
     - Displaying the names of the leaders of the other civs can be switched on or off.
     - The border around the rows can be switched on and off.
    Resources:
     - At the top of the screen the available amount is shown for all the resources that a 
       player has extra's of.
     - The amount can be configured to show the total available amount or the extra available 
       amount (total - 1).
     - The resources that a player can trade with another civ are shown on the same row as the 
       resources that that civ will or won't trade with the player.
     - The resources that a player can trade are divided into two groups. One for the 
       resources for which the player has extra's available and another for those resources 
       for which the player has no extra's.
     - It is possible to group the columns showing resources together as export or import.
     - The amount of gold that a civ can pay per turn is displayed
     - It is possible to show two extra columns to display the resources that are traded in
       active deals.
     - When the active deals are displayed the total gold amount that is traded is also shown,
       a positive amount means that the civ is paying the player, a negative amount means that the
       player is paying the other civ
    Technologies:
     - For each other civ three columns are used to display the techs that civ wants, the techs 
       that civ will trade and the techs that civ won't trade.
     - An extra column is used to display the amount of gold that the civ can pay
     - You can use small (32x32) and large (64x64) icons for the technologies.
     
    
    CHANGING THE LAYOUT
    -------------------
    You can change the layout of the screen by editing the file 'CvForeignAdvisor.py' in the 
    'Assets\python\screens' folder of the mod.
    
    In this file you need to look for the line 'def __init__(self):' (somewhere at the top of 
    the file). All the options are listed below this line and have the format 
    'self.OPTION_NAME = value. 
    
    Installation
    ____________
    
    	Exotic Foreign Advisor should NOT be installed in your main Civ IV location, as it will overwrite one necessary file.
            Instead, it should be installed at:  "My Documents\My Games\Civilization 4\.
    	Prior to installation make sure you have upgraded to patch 1.09 as the compatibility changed when Civ IV upgraded (some functions were renamed).
    	Please note that you MAY have to clear your cache once or twice before the installation/uninstallation will be complete. To do this, hold down the SHIFT button right after you launch Civ IV (i.e., double click the icon). Or go to your cache folder (for me it's My Documents\TempSettings\(UserName)\AppData\My Games\Civilization 4\cache) and delete everything from the directory (this is the recommended method).
    	To install: Just unzip the zip file with the target being the above indicated directory (may be different for different languages).
    	Installation will create many new files. The following is the list:
    
    -CvExoticForeignAdvisor.py in subdirectory CustomAssets\python\screen
    -TechTree.py in subdirectory CustomAssets\python\screen
    -IconGrid.py in subdirectory CustomAssets\python\screen
    -CvReqScreensInterface.py in subdirectory CustomAssets\python\entrypoints,
    -DomPyHelpers.py in subdirectory CustomAssets\python
    -CIV4AdvisorInfo.xml in subdirectory CustomAssets\xml\text
    -CIV4EnhancedTextInfos.xml in subdirectory CustomAssets\xml\text
    -white_circle_50.tga and white_circle_50.dds in subdirectory CustomAssets\art\Interface\buttons
    -white_circle_40.tga and white_circle_40.dds in subdirectory CustomAssets\art\Interface\buttons
    -white_circle_20.tga and white_circle_20.dds in subdirectory CustomAssets\art\Interface\buttons
    -up_arrow.xcf, up_arrow.tga and up_arrow.dds in subdirectory CustomAssets\art\Interface\buttons
    -down_arrow.xcf, down_arrow.tga and down_arrow.dds in subdirectory CustomAssets\art\Interface\buttons
    
    and will create a new copy of two files:
    
    -CvScreensInterface.py in CustomAssets\python\entrypoints
    -CIV4ArtDefines_Interface.xml in CustomAssets\xml\art
    
    	To uninstall, all that is needed is to move, remove, or rename the CvScreensInterface.py from the My Documents\My Games\Civilization 4\ directory AND ANY SUBDIRECTORIES OF IT.
    	Note: If you have BOTH the Special Domestic Advisor and the Exotic Foreign Advisor, install the CvReqScreensInterface.py AS CvScreensInterface.py in the aforementioned directory.
    	To combine this mod to another mod, just add the new files CvExoticForeignAdvisor.py, DomPyHelpers.py, and Civ4AdvisorInfo to the aforementioned My Documents directory (or your mod directory) and make the changes documented in CvScreensInterface.py if you have changed it in your mod.
    
    Known Problems
    ______________
    
    None
    
    Future TODO
    ___________
    
    
    
    History
    _______
    
    v0.94
    - Fixed a major bug where if another civ can trade a technology but "can't research" it, the foreign advisor screen becomes unresponsive.
    
    v0.93
    - Fixed a bug where the glance screen wasn't colored correctly for Italian
    - Added in the technologies which another player can research to the technology trading screen.
    - Added in cammagno's italian translated xml file
    
    v0.92
    - Fixed a bug where the glance screen wasn't colored correctly for foreign languages.
    - Changed the Foreign Advisor Title so that it's in the center of the screen.
    
    v0.91
    - Colored the glance number based on the qualitative attitude one player has toward another
    - Changed the resource and tech trading screens to SupremeOverlord's version because they were far superior to mine
    - Added in religion, civic, and favorite civic information to the renamed "Info" screen (was "Gold")
    - Made it compatible with v1.52 patch
    - Changed Exotic Foreign Advisor so that it actually inherits from the Foreign Advisor so that the code we actually don't change is used (in case Firaxis makes some improvements in other areas).
    
    v0.9
    - beta version of release (waiting for feedback on it and still need to pretty up and document a lot of the code).
    
     

    Attached Files:

  2. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    New Screenshot!

    Spoiler :


    Basic Glance Screen

    Spoiler :


    Sorted Glance Screen

    Spoiler :


    Info Screen

    Spoiler :


    Resource Trading

    Spoiler :


    Tech Trading

    Spoiler :
     
  3. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    Future Issues
     
  4. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    Reserved for future use
     
  5. Major Tom

    Major Tom Immortal

    Joined:
    Jun 1, 2005
    Messages:
    582
    Location:
    Oslo
    This is great work, Requies. Seems to be a must have.
    Had a quick glance at it and it works fine. However, as you point out it is unfortunately not to find Gold/Turn amount that the opponent is willing to trade. The treasury amount of an AI in the "gold screen" is not the same amount as in the trade screen. Am I missing something?
     
  6. Mysterio10000

    Mysterio10000 Prince

    Joined:
    Nov 8, 2005
    Messages:
    311
    Location:
    Wesley Chapel, FL
    Excellent job, Requies!

    Thanks for incorporating Bhruic's mod, since it's very useful and one whose functions should have been in Civ IV from the start.

    I have a suggestion:

    Since +3 net relations (as an example) with one leader doesn't always equate to the same attitude as +3 net relations with another leader, it'd be helpful to see the leader's attitude toward the target listed below the net relations number, if possible.

    Also, in your readmes, I'd suggest indenting the required files and their path locations instead of listing them all in a single paragraph. It'd make it more user friendly on the reader.

    Keep up the good work!
     
  7. Mysterio10000

    Mysterio10000 Prince

    Joined:
    Nov 8, 2005
    Messages:
    311
    Location:
    Wesley Chapel, FL
    I can confirm, as well, that this is a bug.
     
  8. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    Thanks! That's because it seems as though in the diplomacy screen, they round down the actual gold they have to the nearest 10 :eek:. Ever wonder why their treasury is always a multiple of 10? :cool:

    Hmmmm, I wonder if I should change it.... Well, what do you guys think? Change it so the gold is always rounded down?

    Req
     
  9. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381

    Heh, I do.

    The only problem is that these forums take out all white space :rolleyes:. If you look at the actual README file, you'll see the indentation.... I could put it as a code snippet, if that would help?

    Req
     
  10. Major Tom

    Major Tom Immortal

    Joined:
    Jun 1, 2005
    Messages:
    582
    Location:
    Oslo
    Regerding treasury. It is not a matter of rounding down (not important). I am trying to persuade Cathrine into something and in gold screen she has 3517 gold (or is it commerce?). In diploscreen she has 1720 available.
     
  11. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    It's gold.... hmmmm, that could be the case. All my games, nobody had accumulated that much gold :crazyeye:.

    Hmmm, not sure what to do since the diplomacy screen seems to be written in C++ and I don't have access to the same functions.

    I'll try looking for another function which simulates the diplo screen function.

    Req
     
  12. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    Can you post a save file where the leaders have a larger amount of gold? I want to see if I can come up with the formula that they use in the diplomacy screen.

    Thanks,
    Req
     
  13. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    I'll see if this is possible, though space IS at a premium....

    Req
     
  14. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    Hmm, looks like you should be able to get the Gold they'll trade from the Civ4LeaderHeadInfos table.

    getMaxGoldPerTurnTradePercent()
    getMaxGoldTradePercent()

    Problem is, it seems most leaders have 10 and 5/10 respectively. From the above description of Catherine (who has a '5' for iMaxGoldTradePercent), that means she should have only been willing to trade 175 gold.

    Bh
     
  15. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    Hmmm, that's good to know. I'd like to see if I can try to determine the formula they are using. Unfortunately, I need saves which have those large amounts of gold.

    Otherwise, I might have to scrap the Gold part, and since that's a part that so many people clamor for, I'd hate to do that.

    Thanks for the input!
    Req
     
  16. Tubby Rower

    Tubby Rower Chronic Slacker

    Joined:
    Nov 15, 2004
    Messages:
    5,832
    Location:
    Middle of Virginia Hair: None
    in your demo screens, How does everyone have extra hit singles, movies, and musicals?
     
  17. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    Yeah, that was the first place I looked to. Plus, it isn't even completely correct since if their treasury is low enough, they're willing to trade much more than 5% (or even 50% which would be my guess).

    Req
     
  18. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    They don't, surplus shows what YOU have which they don't.

    It basically combines both what they might want to trade for and what YOU might want to trade for on the same line.

    I was trying to figure out a better way to do it, but this was the best so far. I also posted a poll (which only 4 people responded too :p) and 3 of them liked the new screen while 1 wasn't sure why he didn't like it....

    If you have a better idea of how to divide it up and still show all the data, please let me know!

    Req
     
  19. Tubby Rower

    Tubby Rower Chronic Slacker

    Joined:
    Nov 15, 2004
    Messages:
    5,832
    Location:
    Middle of Virginia Hair: None
    I don't look for polls.. sorry. But I do have a suggestion... Eliminate the Used section from the AI's line. You can see your used resources at the top. I just now saw the "Will Trade" section ;) .
     
  20. Requies

    Requies Prince

    Joined:
    Nov 15, 2005
    Messages:
    381
    Hmmm, that's true, you don't usually want to trade from your used resources in regular trades....

    Any other thoughts on this?

    I was also wondering what to do with the top row, but I might just leave it as is if I remove the used resources from the line for each player.

    Req
     

Share This Page